Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions centrallix/htmlgen/htdrv_pane.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ htpnRender(pHtSession s, pWgtrNode tree, int z)
char name[64];
char main_bg[128];
char bdr[64];
int x=-1,y=-1,w,h;
int x=-1,y=-1,w,h,totalW,totalH,flexW,totalFlexW,flexH,totalFlexH;
int id;
int style = 1; /* 0 = lowered, 1 = raised, 2 = none, 3 = bordered */
char* c1;
Expand Down Expand Up @@ -90,6 +90,39 @@ htpnRender(pHtSession s, pWgtrNode tree, int z)
mssError(1,"HTPN","Pane widget must have a 'height' property");
return -1;
}
if (wgtrGetPropertyValue(tree, "fl_width",DATA_T_INTEGER,POD(&flexW)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'fl_width' property");
return -1;
}
if (wgtrGetPropertyValue(tree, "fl_height",DATA_T_INTEGER,POD(&flexH)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'fl_height' property");
return -1;
}
if (wgtrGetPropertyValue(tree, "total_flexW",DATA_T_INTEGER,POD(&totalFlexW)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'total_flexW' property");
return -1;
}
if (wgtrGetPropertyValue(tree, "total_flexH",DATA_T_INTEGER,POD(&totalFlexH)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'total_flexH' property");
return -1;
}

pWgtrNode parentTree = wgtrGetRoot(tree);

if (wgtrGetPropertyValue(parentTree,"width",DATA_T_INTEGER,POD(&totalW)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'width' property");
return -1;
}
if (wgtrGetPropertyValue(parentTree,"height",DATA_T_INTEGER,POD(&totalH)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'height' property");
return -1;
}

/** Border radius, for raised/lowered/bordered panes **/
if (wgtrGetPropertyValue(tree,"border_radius",DATA_T_INTEGER,POD(&border_radius)) != 0)
Expand Down Expand Up @@ -156,17 +189,17 @@ htpnRender(pHtSession s, pWgtrNode tree, int z)
/** Ok, write the style header items. **/
if (style == 2) /* flat */
{
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z);
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); Z-INDEX:%POS; }\n",id,x,y,w,totalW,flexW,totalFlexW,h,totalH,flexH,totalFlexH,totalz);
htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-radius: %INTpx; %STR}\n",id,border_radius,main_bg);
}
else if (style == 0 || style == 1) /* lowered or raised */
{
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z);
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,totalW,flexW,totalFlexW,h-2*box_offset,totalH,flexH,totalFlexH,totalz);
htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color: %STR %STR %STR %STR; border-radius: %INTpx; %STR}\n",id,c1,c2,c2,c1,border_radius,main_bg);
}
else if (style == 3) /* bordered */
{
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z);
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,totalW,flexW,totalFlexW,h-2*box_offset,totalH,flexH,totalFlexH,totalz);
htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color:%STR&CSSVAL; border-radius: %INTpx; %STR}\n",id,bdr,border_radius,main_bg);
}
if (shadow_radius > 0)
Expand Down
6 changes: 5 additions & 1 deletion centrallix/include/wgtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef struct _WN
int r_x, r_y, r_width, r_height; /** Requested geometry **/
int pre_x, pre_y, pre_width, pre_height; /** pre-layout geom. **/
int fl_x, fl_y, fl_width, fl_height;/** Flexibility **/
int total_flexW, total_flexH; /** container flexibility **/
double fx, fy, fw, fh; /** internal flexibility calculations **/
int min_width, min_height; /** absolute minimums **/
int x, y, width, height; /** actual geometry **/
Expand Down Expand Up @@ -170,7 +171,8 @@ pWgtrNode wgtrParseOpenObject(pObject obj, pStruct app_params, pWgtrClientInfo c
void wgtrFree(pWgtrNode tree); /** frees memory associated with a widget tree **/
pWgtrNode wgtrNewNode( char* name, char* type, pObjSession s,
int rx, int ry, int rwidth, int rheight,
int flx, int fly, int flwidth, int flheight); /** create a new widget node **/
int flx, int fly, int flwidth, int flheight
int flwidthTotal, int flheightTotal); /** create a new widget node **/
int wgtrSetupNode(pWgtrNode node);
int wgtrMergeOverlays(pWgtrNode node, char* objpath, char* app_path, char* overlays[], char* templates[]);

Expand Down Expand Up @@ -206,6 +208,8 @@ int wgtrSetDMPrivateData(pWgtrNode tree, void* data);
void* wgtrGetDMPrivateData(pWgtrNode tree);
int wgtrGetContainerHeight(pWgtrNode tree);
int wgtrGetContainerWidth(pWgtrNode tree);
int wgtrGetContainerFlexWidth(pWgtrNode tree); /** get widget container flexible width **/
int wgtrGetContainerFlexHeight(pWgtrNode tree); /** get widget container flexible height **/
int wgtrMoveChildren(pWgtrNode tree, int x_offset, int y_offset);

/** misc. functions **/
Expand Down
10 changes: 8 additions & 2 deletions centrallix/wgtr/wgtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ wgtrCopyInTemplate(pWgtrNode tree, pObject tree_obj, pWgtrNode match, char* base
if (match->fl_y >= 0) tree->fl_y = match->fl_y;
if (match->fl_width >= 0) tree->fl_width = match->fl_width;
if (match->fl_height >= 0) tree->fl_height = match->fl_height;
if (match->total_flexW >= 0) tree->total_flexW = match->total_flexW;
if (match->total_flexH >= 0) tree->total_flexH = match->total_flexH;

/** Check for substitutions **/
for(prop=objGetFirstAttr(tree_obj);prop;prop=objGetNextAttr(tree_obj))
Expand Down Expand Up @@ -352,7 +354,8 @@ wgtrCopyInTemplate(pWgtrNode tree, pObject tree_obj, pWgtrNode match, char* base
snprintf(new_name, sizeof(new_name), "%s_%s", base_name, subtree->Name);
if ((new_node = wgtrNewNode(new_name, subtree->Type, subtree->ObjSession,
subtree->r_x, subtree->r_y, subtree->r_width, subtree->r_height,
subtree->fl_x, subtree->fl_y, subtree->fl_width, subtree->fl_height)) == NULL)
subtree->fl_x, subtree->fl_y, subtree->fl_width, subtree->fl_height,
subtree->total_flexW, subtree->total_flexH)) == NULL)
return -1;

if (wgtrSetupNode(new_node) < 0)
Expand Down Expand Up @@ -1515,7 +1518,8 @@ wgtrSetProperty(pWgtrNode widget, char* name, int datatype, pObjData val)
pWgtrNode
wgtrNewNode( char* name, char* type, pObjSession s,
int rx, int ry, int rwidth, int rheight,
int flx, int fly, int flwidth, int flheight)
int flx, int fly, int flwidth, int flheight,
int flwidthTotal, int flheightTotal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we modify the function signature for wgtrNewNode() here, but this branch does not appear to modify any of the locations where the function is called. How do you intend for these new values to be generated?

{
pWgtrNode node;

Expand All @@ -1538,6 +1542,8 @@ wgtrNewNode( char* name, char* type, pObjSession s,
node->fl_y = fly;
node->fl_width = flwidth;
node->fl_height = flheight;
node->total_flexW = flwidthTotal; /* added for total flexible width of container */
node->total_flexH = flheightTotal; /* added for total flexible height of container */
node->ObjSession = s;
node->Parent = NULL;
node->min_height = 0;
Expand Down