change_managed() change_managed()
Name
change_managed - Composite class method to respond to a change in a list of managed
widgets.
Synopsis
typedef void (*XtWidgetProc)(Widget);
Widget w;
Inputs
w Specifies the widget that has had children managed or unmanaged.
Description
The change_managed() method is registered on the change_managed field of the Composite class part structure, and is invoked when a child or
children are managed or unmanaged with XtManageChild(), XtManageChildren(), XtUnmanageChild(), or XtUnmanageChildren().
When a child is managed or unmananged, it generally means that the layout of all the children of the widget should be redone. Note that
this method does not have an argument which specifies which children have had their managed state changed. change_managed() should loop
through all of the children in its children array, using XtIsManaged() to determine which are managed and should therefore be included in
the layout calculations.
The change_managed() method is not chained. A widget class that does not define a change_managed() method can inherit this method from its
superclass by specifying XtInheritChangeManaged in its Composite change_managed() class field.
Usage
Many change_managed() methods simply call a general layout routine which may also be called from other places in the widget such as the
resize() method.
Example
The following procedure is the change_managed() method for the Xaw Form widget. Note how it loops through all of its children, setting
constraint fields for those that are managed, and then calls a layout routine (which is a class method of the Form widget in this case) to
recalculate the layout of all children. It makes no attempt to determine which children have been managed or unmanaged.
static void ChangeManaged(w)
Widget w;
{
FormWidget fw = (FormWidget)w;
FormConstraints form;
WidgetList children, childP;
int num_children = fw->composite.num_children;
Widget child;
/*
* Reset virtual width and height for all children.
*/
for (children = childP = fw->composite.children ;
childP - children < num_children; childP++) {
child = *childP;
if (XtIsManaged(child)) {
form = (FormConstraints)child->core.constraints;
/*
* If the size is one (1) then we must not change the virtual sizes, as
* they contain useful information. If someone actually wants a widget
* of width or height one (1) in a form widget he will lose, can't win
* them all.
*
* Chris D. Peterson 2/9/89.
*/
if ( child->core.width != 1)
form->form.virtual_width = (int) child->core.width;
if ( child->core.height != 1)
form->form.virtual_height = (int) child->core.height;
}
}
(*((FormWidgetClass)w->core.widget_class)->form_class.layout)
((FormWidget) w, w->core.width,
w->core.height, TRUE);
}
See Also
Composite(3), Constraint(3).
Xt - Intrinsics Methods change_managed()