Method Declarations

If you add a callback as a method, for convenience X-Designer adds the declaration of the method in the enclosing class for that widget. You can view, add and remove method declarations by selecting the widget which is the enclosing class and selecting "Method declarations" from the "Widget" menu.

To find which widget is the enclosing class, use "Structure colors" from the "View" menu, and select the nearest ancestor of the widget for which you have added a method. Of course, this would be the same widget if it is defined as a C++ class.


Method Access Control

By default, methods added by X-Designer have public access. You can control the access for individual callback methods using the "Access" option menu in the Method Declarations dialog.


Pure Virtual Methods

You can set the "Pure virtual" toggle to declare the non-static member function as pure virtual. For example, if you set this toggle for a callback method OnNew() in a menubar class, X-Designer would declare the method as:



class menubar_c: public xd_XmMenuBar_c { ... public: ... virtual void OnNew( Widget, XtPointer ) = 0; };

Because the function is pure virtual, you do not have to provide an implementation of menubar_c::OnNew() and menubar_c becomes an abstract class. That is, you cannot create an instance of menubar_c but only use it as a base class for others.

By default, methods added by X-Designer are not pure virtual.


Deleting Callback Methods

When you remove a callback method from a widget you are only removing the use of the method (the call to it). When you add a method callback in X-Designer, a declaration of the method is automatically added for you. If you want to remove this declaration as well you must remove it from the method declarations list of the widget which is the enclosing class.


See also: