1XtCreateWidget(3)                XT FUNCTIONS                XtCreateWidget(3)
2
3
4

NAME

6       XtCreateWidget, XtVaCreateWidget, XtCreateManagedWidget, XtVaCreate‐
7       ManagedWidget, XtDestroyWidget - create and destroy widgets
8

SYNTAX

10       Widget XtCreateWidget(String name, WidgetClass widget_class, Widget
11              parent, ArgList args, Cardinal num_args);
12
13       Widget XtVaCreateWidget(String name, WidgetClass widget_class, Widget
14              parent, ...);
15
16       Widget XtCreateManagedWidget(String name, WidgetClass widget_class,
17              Widget parent, ArgList args, Cardinal num_args);
18
19       Widget XtVaCreateManagedWidget(String name, WidgetClass widget_class,
20              Widget parent, ...);
21
22       void XtDestroyWidget(Widget w);
23

ARGUMENTS

25       args      Specifies the argument list to override the resource
26                 defaults.
27
28       name      Specifies the resource name for the created widget, which is
29                 used for retrieving resources and, for that reason, should
30                 not be the same as any other widget that is a child of same
31                 parent.
32
33       num_args  Specifies the number of arguments in the argument list.
34
35       parent    Specifies the parent widget.
36
37       w         Specifies the widget.
38
39       widget_class
40                 Specifies the widget class pointer for the created widget.
41
42       ...       Specifies the variable argument list to override the resource
43                 defaults.
44

DESCRIPTION

46       The XtCreateWidget function performs much of the boilerplate operations
47       of widget creation:
48
49       ·    Checks to see if the class_initialize procedure has been called
50            for this class and for all superclasses and, if not, calls those
51            necessary in a superclass-to-subclass order.
52
53       ·    Allocates memory for the widget instance.
54
55       ·    If the parent is a subclass of constraintWidgetClass, it allocates
56            memory for the parent's constraints and stores the address of this
57            memory into the constraints field.
58
59       ·    Initializes the core nonresource data fields (for example, parent
60            and visible).
61
62       ·    Initializes the resource fields (for example, background_pixel) by
63            using the resource lists specified for this class and all super‐
64            classes.
65
66       ·    If the parent is a subclass of constraintWidgetClass, it initial‐
67            izes the resource fields of the constraints record by using the
68            constraint resource list specified for the parent's class and all
69            superclasses up to constraintWidgetClass.
70
71       ·    Calls the initialize procedures for the widget by starting at the
72            Core initialize procedure on down to the widget's initialize pro‐
73            cedure.
74
75       ·    If the parent is a subclass of compositeWidgetClass, it puts the
76            widget into its parent's children list by calling its parent's
77            insert_child procedure.  For further information, see Section 3.5.
78
79       ·    If the parent is a subclass of constraintWidgetClass, it calls the
80            constraint initialize procedures, starting at constraintWidget‐
81            Class on down to the parent's constraint initialize procedure.
82
83       Note that you can determine the number of arguments in an argument list
84       by using the XtNumber macro.  For further information, see Section
85       11.1.
86
87       The XtCreateManagedWidget function is a convenience routine that calls
88       XtCreateWidget and XtManageChild.
89
90       The XtDestroyWidget function provides the only method of destroying a
91       widget, including widgets that need to destroy themselves.  It can be
92       called at any time, including from an application callback routine of
93       the widget being destroyed.  This requires a two-phase destroy process
94       in order to avoid dangling references to destroyed widgets.
95
96       In phase one, XtDestroyWidget performs the following:
97
98       ·    If the being_destroyed field of the widget is True, it returns
99            immediately.
100
101       ·    Recursively descends the widget tree and sets the being_destroyed
102            field to True for the widget and all children.
103
104       ·    Adds the widget to a list of widgets (the destroy list) that
105            should be destroyed when it is safe to do so.
106
107       Entries on the destroy list satisfy the invariant that if w2 occurs
108       after w1 on the destroy list then w2 is not a descendent of w1.  (A
109       descendant refers to both normal and pop-up children.)
110
111       Phase two occurs when all procedures that should execute as a result of
112       the current event have been called (including all procedures registered
113       with the event and translation managers), that is, when the current
114       invocation of XtDispatchEvent is about to return or immediately if not
115       in XtDispatchEvent.
116
117       In phase two, XtDestroyWidget performs the following on each entry in
118       the destroy list:
119
120       ·    Calls the destroy callback procedures registered on the widget
121            (and all descendants) in post-order (it calls children callbacks
122            before parent callbacks).
123
124       ·    If the widget's parent is a subclass of compositeWidgetClass and
125            if the parent is not being destroyed, it calls XtUnmanageChild on
126            the widget and then calls the widget's parent's delete_child pro‐
127            cedure (see Section 3.4).
128
129       ·    If the widget's parent is a subclass of constraintWidgetClass, it
130            calls the constraint destroy procedure for the parent, then the
131            parent's superclass, until finally it calls the constraint destroy
132            procedure for constraintWidgetClass.
133
134       ·    Calls the destroy methods for the widget (and all descendants) in
135            post-order.  For each such widget, it calls the destroy procedure
136            declared in the widget class, then the destroy procedure declared
137            in its superclass, until finally it calls the destroy procedure
138            declared in the Core class record.
139
140       ·    Calls XDestroyWindow if the widget is realized (that is, has an X
141            window).  The server recursively destroys all descendant windows.
142
143       ·    Recursively descends the tree and deallocates all pop-up widgets,
144            constraint records, callback lists and, if the widget is a sub‐
145            class of compositeWidgetClass, children.
146

SEE ALSO

148       XtAppCreateShell(3), XtCreatePopupShell(3)
149       X Toolkit Intrinsics - C Language Interface
150       Xlib - C Language X Interface
151
152
153
154X Version 11                      libXt 1.1.4                XtCreateWidget(3)
Impressum