Remove dead code. Make sure GetChildDimensions() returns non zero values.
git-svn-id: svn://10.0.0.236/trunk@11557 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -91,16 +91,6 @@ static void UpdateChildrenInfo (Widget);
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void GetChildDimensions (Widget,Dimension *,Dimension *);
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Layable children functions */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
#if 0
|
||||
static void LayableInfoUpdate (Widget);
|
||||
static void LayableInfoFree (Widget);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Dynamic children info functions */
|
||||
@@ -637,6 +627,18 @@ GetChildDimensions(Widget child,Dimension * width_out,Dimension * height_out)
|
||||
{
|
||||
*width_out = _XfeWidth(child);
|
||||
*height_out = _XfeHeight(child);
|
||||
|
||||
#if 1
|
||||
if (*width_out == 0)
|
||||
{
|
||||
*width_out = 2;
|
||||
}
|
||||
|
||||
if (*height_out == 0)
|
||||
{
|
||||
*height_out = 2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -773,308 +775,6 @@ _XfeDynamicManagerGetChildDimensions(Widget child,
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#if 0
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Name: _XfeDynamicManagerChildrenInfo() */
|
||||
/* */
|
||||
/* Purpose: Obtain information about the manager's children */
|
||||
/* */
|
||||
/* Ret Val: void */
|
||||
/* */
|
||||
/* Args in: w The manager widget. */
|
||||
/* */
|
||||
/* Args out: max_width_out Max managed child width */
|
||||
/* max_height_out Max managed child height */
|
||||
/* num_managed_out Num managed children */
|
||||
/* num_components_out Num component children */
|
||||
/* */
|
||||
/* Comments: Output args can be NULL - for which no value is */
|
||||
/* assigned or returned. */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
_XfeDynamicManagerChildrenInfo(Widget w,
|
||||
Dimension * max_width_out,
|
||||
Dimension * max_height_out,
|
||||
Dimension * total_width_out,
|
||||
Dimension * total_height_out,
|
||||
Cardinal * num_managed_out,
|
||||
Cardinal * num_components_out)
|
||||
{
|
||||
Dimension max_width = 0;
|
||||
Dimension max_height = 0;
|
||||
Dimension total_width = 0;
|
||||
Dimension total_height = 0;
|
||||
Cardinal num_managed = 0;
|
||||
Cardinal num_components = 0;
|
||||
Widget child;
|
||||
Cardinal i;
|
||||
|
||||
if (!XfeIsManager(w))
|
||||
{
|
||||
_XfeWarning(w,MESSAGE5);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Iterate through all the items */
|
||||
for (i = 0; i < _XfemNumChildren(w); i++)
|
||||
{
|
||||
child = _XfemChildren(w)[i];
|
||||
|
||||
/* Check for private components */
|
||||
if (_XfeDynamicManagerPrivateComponent(child))
|
||||
{
|
||||
num_components++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure widget is shown */
|
||||
if (_XfeChildIsShown(child))
|
||||
{
|
||||
Dimension width;
|
||||
Dimension height;
|
||||
|
||||
if (XfeIsPrimitive(child))
|
||||
{
|
||||
width = _XfePreferredWidth(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = _XfeWidth(child);
|
||||
}
|
||||
|
||||
if (XfeIsPrimitive(child))
|
||||
{
|
||||
height = _XfePreferredHeight(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
height = _XfeHeight(child);
|
||||
}
|
||||
|
||||
/* Keep track of largest width */
|
||||
if (width > max_width)
|
||||
{
|
||||
max_width = width;
|
||||
}
|
||||
|
||||
|
||||
/* Keep track of largest height */
|
||||
if (height > max_height)
|
||||
{
|
||||
max_height = height;
|
||||
}
|
||||
|
||||
total_width += width;
|
||||
total_height += height;
|
||||
|
||||
num_managed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign only required arguments */
|
||||
if (max_width_out)
|
||||
{
|
||||
*max_width_out = max_width;
|
||||
}
|
||||
|
||||
if (max_height_out)
|
||||
{
|
||||
*max_height_out = max_height;
|
||||
}
|
||||
|
||||
if (total_width_out)
|
||||
{
|
||||
*total_width_out = total_width;
|
||||
}
|
||||
|
||||
if (total_height_out)
|
||||
{
|
||||
*total_height_out = total_height;
|
||||
}
|
||||
|
||||
if (num_managed_out)
|
||||
{
|
||||
*num_managed_out = num_managed;
|
||||
}
|
||||
|
||||
if (num_components_out)
|
||||
{
|
||||
*num_components_out = num_components;
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Name: _XfeDynamicManagerComponentInfo() */
|
||||
/* */
|
||||
/* Purpose: Obtain information about the manager's components */
|
||||
/* */
|
||||
/* Ret Val: void */
|
||||
/* */
|
||||
/* Args in: w The manager widget. */
|
||||
/* */
|
||||
/* Args out: max_width_out Max managed child width */
|
||||
/* max_height_out Max managed child height */
|
||||
/* */
|
||||
/* Comments: Output args can be NULL - for which no value is */
|
||||
/* assigned or returned. */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
_XfeDynamicManagerComponentInfo(Widget w,
|
||||
Dimension * max_width_out,
|
||||
Dimension * max_height_out)
|
||||
{
|
||||
Dimension max_width = 0;
|
||||
Dimension max_height = 0;
|
||||
Widget child;
|
||||
Cardinal i;
|
||||
|
||||
if (!XfeIsManager(w))
|
||||
{
|
||||
_XfeWarning(w,MESSAGE5);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Iterate through all the items */
|
||||
for (i = 0; i < _XfemNumChildren(w); i++)
|
||||
{
|
||||
child = _XfemChildren(w)[i];
|
||||
|
||||
/* Check for private components */
|
||||
if (_XfeDynamicManagerPrivateComponent(child) &&
|
||||
XtIsManaged(child) &&
|
||||
_XfeIsAlive(child))
|
||||
{
|
||||
/* Keep track of largest width */
|
||||
if (_XfeWidth(child) > max_width)
|
||||
{
|
||||
max_width = _XfeWidth(child);
|
||||
}
|
||||
|
||||
/* Keep track of largest height */
|
||||
if (_XfeHeight(child) > max_height)
|
||||
{
|
||||
max_height = _XfeHeight(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Assign only required arguments */
|
||||
if (max_width_out)
|
||||
{
|
||||
*max_width_out = max_width;
|
||||
}
|
||||
|
||||
if (max_height_out)
|
||||
{
|
||||
*max_height_out = max_height;
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* Name: _XfeDynamicManagerGetLayableChildren() */
|
||||
/* */
|
||||
/* Purpose: Obtain a list of layable children */
|
||||
/* */
|
||||
/* Ret Val: void */
|
||||
/* */
|
||||
/* Args in: w The manager widget. */
|
||||
/* */
|
||||
/* Args out: layable_children_out Array of layable children */
|
||||
/* num_layable_children_out Size of the array */
|
||||
/* max_width_out Max layable children width. */
|
||||
/* max_height_out Max layable children height.*/
|
||||
/* */
|
||||
/* Comments: Its up to the caller to XtFree() the value returned in */
|
||||
/* layable_children_out (if its not NULL) */
|
||||
/* */
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* extern */ void
|
||||
_XfeDynamicManagerGetLayableChildrenInfo(Widget w,
|
||||
XfeDynamicManagerChildrenInfoRec * info)
|
||||
{
|
||||
Widget child;
|
||||
Cardinal i;
|
||||
|
||||
assert( _XfeIsAlive(w) );
|
||||
assert( XfeIsManager(w) );
|
||||
|
||||
assert( info != NULL );
|
||||
|
||||
/* Initialize the results */
|
||||
info->children = NULL;
|
||||
info->num_children = 0;
|
||||
|
||||
info->max_width = 0;
|
||||
info->max_height = 0;
|
||||
|
||||
info->min_width = 0;
|
||||
info->min_height = 0;
|
||||
|
||||
info->total_width = 0;
|
||||
info->total_height = 0;
|
||||
|
||||
/* Proceed only if children exist */
|
||||
if (_XfemNumChildren(w) > 0)
|
||||
{
|
||||
/* Allocate a layable children linked list */
|
||||
info->children = XfeLinkedConstruct();
|
||||
|
||||
/* Iterate through all the items */
|
||||
for (i = 0; i < _XfemNumChildren(w); i++)
|
||||
{
|
||||
child = _XfeChildrenIndex(w,i);
|
||||
|
||||
/* Look for layable children and add them to the list */
|
||||
if (_XfeDynamicManagerChildIsLayable(child))
|
||||
{
|
||||
/* Add a node to the list for this child */
|
||||
XfeLinkNode node =
|
||||
XfeLinkedInsertAtTail(info->children,child);
|
||||
|
||||
/* Point child's link node constraint resource to the node */
|
||||
_XfeDynamicManagerLinkNode(child) = node;
|
||||
|
||||
/* Keep track of the largest width */
|
||||
if (_XfeWidth(child) > info->max_width)
|
||||
{
|
||||
info->max_width = _XfeWidth(child);
|
||||
}
|
||||
/* Keep track of the smallest width */
|
||||
else if (_XfeWidth(child) < info->min_width)
|
||||
{
|
||||
info->min_width = _XfeWidth(child);
|
||||
}
|
||||
|
||||
/* Keep track of the largest height */
|
||||
if (_XfeHeight(child) > info->max_height)
|
||||
{
|
||||
info->max_height = _XfeHeight(child);
|
||||
}
|
||||
/* Keep track of the smallest height */
|
||||
else if (_XfeHeight(child) < info->min_height)
|
||||
{
|
||||
info->min_height = _XfeHeight(child);
|
||||
}
|
||||
|
||||
/* Keep track of the total width and height */
|
||||
else if (_XfeHeight(child) < info->min_height)
|
||||
{
|
||||
info->total_width += _XfeWidth(child);
|
||||
info->total_height += _XfeHeight(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* XfeDynamicManager public methods */
|
||||
|
||||
Reference in New Issue
Block a user