DwtMenuBar(3Dwt)
Name
DwtMenuBar, DwtMenuBarCreate − Creates a menu bar widget to contain menus.
Syntax
Widget DwtMenuBar(parent_widget, name, entry_callback,
help_callback)
Widget parent_widget;
char *name;
DwtCallbackPtr entry_callback;
DwtCallbackPtr help_callback;
Widget DwtMenuBarCreate (parent_widget, name,
override_arglist, override_argcount)
Widget parent_widget;
char *name;
ArgList override_arglist;
int override_argcount;
Arguments
parent_widget
Specifies the parent widget ID.
nameSpecifies the name of the created widget.
entry_callback
If this callback is defined, all menu entry activation callbacks are revectored to call back through this callback. If this callback is NULL, the individual menu entry callbacks work as usual. For this callback, the reason is DwtCRActivate. This argument sets the DwtNentryCallback attribute associated with DwtMenuCreate.
help_callbackSpecifies the callback function or functions called when a help request is made. This argument sets the DwtNhelpCallback common widget attribute.
parent_widget
Specifies the parent widget ID.
nameSpecifies the name of the created widget.
override_arglist
Specifies the application override argument list.
override_argcount
Specifies the number of attributes in the application override argument list (override_arglist).
Description
The DwtMenuBar and DwtMenuBarCreate functions create an instance of the menu bar widget and return its associated widget ID. When calling DwtMenuBar, you set the menu bar widget attributes presented in the formal parameter list. For DwtMenuBarCreate, you specify a list of attribute name/value pairs that represent all the possible menu bar widget attributes.
A menu bar widget is a composite widget that contains pull-down menu entry subwidgets. The subwidgets handle most of the I/O activity that display information and query the user for input. The menu bar widget provides no input semantics over and above those provided by its subwidgets.
If the menu bar does not have enough room to fit all its subwidgets on a single line, the menu bar attempts to wrap the remaining entries onto additional lines (if allowed by the geometry manager of the parent widget).
The menu bar widget works with these widget classes: pull-down menu entries, labels, and separators.
If DwtNentryCallback is not NULL when it is activated, all subwidgets call back to this callback. Otherwise, the individual subwidgets handle the activation callbacks.
Inherited Attributes
| Attribute Name | Data Type | Default |
| Core Attributes | ||
| DwtNx | Position | Determined by the geometry manager |
| DwtNy | Position | Determined by the geometry manager |
| DwtNwidth | Dimension | 16 pixels |
| DwtNheight | Dimension | Number of lines needed to display all entries |
| DwtNborderWidth | Dimension | One pixel |
| DwtNborder | Pixel | Default foreground color |
| DwtNborderPixmap | Pixmap | NULL |
| DwtNbackground | Pixel | Default background color |
| DwtNbackgroundPixmap | Pixmap | NULL |
| DwtNcolormap | Colormap | Default color map |
| DwtNsensitive | Boolean | True |
| Note that setting the sensitivity of the menu bar causes all widgets contained in that menu bar to be set to the same sensitivity as the menu bar. |
||
| DwtNancestorSensitive | Boolean | The bitwise AND of the parent widget’s DwtNsensitive and DwtNancestorSensitive attributes |
| DwtNaccelerators | XtTranslations | NULL |
| DwtNdepth | int | Depth of the parent window |
| DwtNtranslations | XtTranslations | NULL |
| DwtNmappedWhenManaged | Boolean | True |
| DwtNscreen | Screen * | The parent screen |
| DwtNdestroyCallback | DwtCallbackPtr | NULL |
| Common Attributes | ||
| DwtNforeground | Pixel | Default foreground color |
| DwtNhighlight | Pixel | Default foreground color |
| DwtNhighlightPixmap | Pixmap | NULL |
| DwtNuserData | Opaque * | NULL |
| DwtNdirectionRToL | unsigned char | DwtDirectionRightDown |
| DwtNfont | DwtFontList | Used only by gadget children |
| DwtNhelpCallback | DwtCallbackPtr | NULL |
| Menu Attributes | ||
| DwtNspacing | Dimension | One pixel |
| DwtNmarginHeight | Dimension | Zero pixels |
| DwtNmarginWidth | Dimension | Three pixels |
| DwtNorientation | unsigned char | DwtOrientationVertical |
| DwtNadjustMargin | Boolean | True |
| DwtNentryBorder | short | Zero pixels |
| DwtNmenuAlignment | Boolean | True |
| DwtNentryAlignment | unsigned char | DwtAlignmentBeginning |
| DwtNmenuPacking | unsigned char | DwtMenuPackingTight (for all menu types except for radio boxes) |
| DwtMenuPackingColumn (for radio boxes) |
||
| DwtNmenuNumColumns | short | One row or column |
| DwtNmenuRadio | Boolean | False |
| True (for radio boxes) |
||
| DwtNradioAlwaysOne | Boolean | True |
| DwtNmenuIsHomogeneous | Boolean | False |
| True (for radio boxes) |
||
| DwtNmenuEntryClass | WidgetClass | NULL Radio boxes, however, default to the togglebuttonwidgetclass. |
| DwtNmenuHistory | Widget | Zero |
| DwtNentryCallback | DwtCallbackPtr | NULL |
| DwtNmenuHelpWidget | Widget | NULL |
| DwtNchangeVisAtts | Boolean | True |
| DwtNmenuExtendLastRow | Boolean | True |
Widget-Specific Attributes
The menu bar widget does not currently support any widget-specific attributes.
Return Values
These functions return the ID of the created widget.
Callback Information
The following structure is returned to your callback:
typedef struct {
int reason;
XEvent *event;
Widget s_widget;
char *s_tag;
char *s_callbackstruct;
} DwtMenuCallbackStruct;
The reason member is set to a constant that represents the reason why this callback was invoked. For this callback, the reason member can be set to:
| DwtCRActivate | The user selected a menu entry. |
| DwtCRMap | The menu window is about to be mapped. |
| DwtCRUnmap | The menu window was just unmapped. |
| DwtCRHelpRequested | The user selected help. |
The event member is a pointer to the Xlib structure XEvent, which describes the event that generated this callback. This structure is a union of the individual structures declared for each event type. For information on XEvent and event processing, see the Guide to the Xlib Library: C Language Binding. The s_widget member is set to the ID of the activating subwidget. The s_tag member is set to the tag supplied by the application programmer when the subwidget callback function was specified. The s_callbackstruct member is set to the subwidget’s callback structure.
See Also
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding