Query: constraintd
OS: hpux
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Constraint set_values() Constraint set_values() Name Constraint set_values - Constraint class method called to handle changes to constraint resources. Synopsis typedef Boolean (*XtSetValuesFunc)(Widget, Widget, Widget, ArgList, Cardinal *); Widget current; Widget request; Widget set; ArgList args; Cardinal *num-args; Inputs current Specifies a copy of the child widget (and that widget's constraint record) made by XtSetValues() before any resources are changed or any class methods are called. request Specifies a copy of the child widget (and that widget's constraint record) made by XtSetValues() after the constraint and normal resources are changed as requested, but before any class set_values() methods are called. set Specifies the child widget with constraint and normal resources set and as modified by any superclass methods that have been called by XtSetValues(). args Specifies the argument list passed to XtSetValues(). num_args Specifies the number of arguments in the args. Returns True if the resource changes require the child widget to be redrawn; False otherwise. Description The Constraint set_values() method is registered on the set_value field of the Constraint class part structure. It is invoked when XtSet- Values() is called on a child of the constraint widget to do any processing necessary to handle resource changes in the child's constraint record. The arguments to the Constraint set_values() method are the same as those passed to the child's Object, RectObj, or Core set_values() method. The constraints field of each of the widget arguments points to a copy of the child's constraints procedure made at the appropri- ate point by XtSetValues(). The Constraint set_values() procedure must perform the same sort of processing on this record as the normal set_values() method performs on the widget instance record itself. The Constraint set_values() method will deal primarily with the fields of the constraint record, but may also modify widget instance fields as necessary. If the constraint for the maximum height of a child is changed to a value that is less than the current height of the child, for example, the Constraint set_values() method may change the height instance field of the child widget. If the parent needs to change the geometry of the child, it needn't call XtConfigureWidget() directly; if any child geometry fields are changed by this or other set_val- ues() methods, XtSetValues() will call XtMakeGeometryRequest(), which will invoke the parent's geometry_manager() method, which can do any necessary processing. As with the Object set_values() method, the Constraint set_values() method should return True if the widget should be redrawn. Unless this method actually modifies fields in the widget instance structure itself, however, a redraw will never be useful because the child's expose() method cannot take constraint fields into account. The Constraint set_values() method should not assume that the child widget is realized. The args and num_args arguments were added in Release 4. The Constraint set_values() method is chained in superclass-to-subclass order, and cannot be inherited. If none of the resources in a class's constraint record need special processing when their values are changed, this method may be NULL. See set_values(4) for information on the arguments to this function, and a discussion of the typical tasks of a set_values() method. See XtSetValues(1) for full details on the widget creation process. Example The following procedure is the Constraint set_values() method, lightly edited, of the Xaw Paned widget class. Note that it obtains the constraint records of the current and set arguments (which are named old and new here) and compares their fields to determine what has changed. Note also that "new" is a reserved word in C++, and your C code will be more portable if you avoid using it as an argument name. #define PaneInfo(w) ((Pane)(w)->core.constraints) /* ARGSUSED */ static Boolean PaneSetValues(old, request, new, args, num_args) Widget old, request, new; ArgList args; Cardinal *num_args; { Pane old_pane = PaneInfo(old); Pane new_pane = PaneInfo(new); /* Check for new min and max. */ if (old_pane->min != new_pane->min old_pane->max != new_pane->max) XawPanedSetMinMax(new, (int)new_pane->min, (int)new_pane->max); /* Check for change in XtNshowGrip. */ if (old_pane->show_grip != new_pane->show_grip) if (new_pane->show_grip == TRUE) { CreateGrip(new); if (XtIsRealized(XtParent(new))) { if (XtIsManaged(new)) /* if paned is unrealized this will happen automatically at realize time.*/ XtManageChild(PaneInfo(new)->grip); /* manage the grip. */ CommitNewLocations( (PanedWidget) XtParent(new) ); } } else if ( HasGrip(old) ) { XtDestroyWidget( old_pane->grip ); new_pane->grip = NULL; } return(False); } See Also XtSetValues(1), Constraint(3), Core(3), set_values(4). Xt - Intrinsics Methods Constraint set_values()