|
•
|
A subclass of CwExtendedPrimitive can be implemented using a primary widget with child widgets, however an application programmer making use of this type of extended widget can not add any children to it.
|
|
•
|
A subclass of CwExtendedComposite can be implemented using just a single widget, say for example a CwForm with no children, but the same application programmer can create this type of extended widget and add as many children as are permitted by the extended widget's API.
|
An extended widget is implemented using a widget tree consisting of other basic or extended widgets. This tree is called the primary widget tree. The root of the primary widget tree is known as the
primary widget. The extended widget class must override the
createPrimaryWidget:parent:argBlock: method. This method creates and answers the primary widget, but does not create the children of the primary widget. If the primary widget tree consists of more than one widget, the extended widget class must override
createWidgetSystem. This method creates the remainder of the primary widget tree, that is, the children of
self primaryWidget.
Three methods can be overridden to initialize the state of the widget. The initialize method is run as the first step in extended widget creation. It is useful for initializing the internal state of the widget, except for resources. The
initializeResources method initializes the instance variables representing resources. Both of these methods are run before the primary widget tree has been created. The
initializeAfterCreate method is run after the primary widget tree has been created. It is useful for configuring widgets after they have been created, and for initializing graphics resources.
The get accessor method for a callback is a little more involved. In order to work properly with methods inherited from CwExtendedWidget, the constant used to specify the type of the callback--for example,
XmNactivateCallback for an
activate callback--is a pool variable that must be equal to the get method's selector--for example,
activateCallback. The
valueChangedCallback method in the example is a callback get accessor. Callback type specifiers are already defined in the
CwConstants pool dictionary, however, if a new name is desired, it can be added to an application-specific pool dictionary using the same naming convention.
Copyright 2005, 2020 Instantiations, Inc. All rights reserved.