Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

DwtOptionMenu(3Dwt)

Name

DwtOptionMenu, DwtOptionMenuCreate − Creates an option menu widget to display and handle an application option list of attributes or modes of the menu topic.  It allows just one option selected from the list in the menu. 

Syntax

Widget DwtOptionMenu(parent_widget, name, x, y,
                     label, sub_menu_id,
                     entry_callback, help_callback)
     Widget parent_widget;
     char *name;
     Position x, y;
     DwtCompString label;
     Widget sub_menu_id;
     DwtCallbackPtr entry_callback, help_callback;

Widget DwtOptionMenuCreate (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. 

xSpecifies the placement, in pixels, of the left side of the widget window relative to the inner upper left corner of the parent window.  This argument sets the DwtNx core widget attribute. 

ySpecifies, in pixels, the placement of the upper left corner of the widget window relative to the inner upper left corner of the parent window.  This argument sets the DwtNy core widget attribute. 

labelSpecifies the text in the menu label.  This argument sets the DwtNlabel attribute associated with DwtMenuCreate. 

sub_menu_id
Specifies the widget ID of the pull-down menu associated with the option menu during the creation phase.

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 DwtOptionMenu and DwtOptionMenuCreate functions create an instance of the option menu widget and return its associated widget ID.  When calling DwtOptionMenu, you set the option menu widget attributes presented in the formal parameter list.  For DwtOptionMenuCreate, however, you specify a list of attribute name/value pairs that represent all the possible option menu widget attributes.  The option menu widget is a composite widget containing other subwidgets (toggle button widgets).  It displays and handles an application option list of attributes or modes of the menu topic.  Basically, the option menu consists of a label identifying the menu and an active area to the right.  This composite widget contains other subwidgets (toggle button widgets) in the active area.  It displays the current option selected, and, on request, generates a pop-up menu with specific options available.  In addition, it ensures that a user can select only one choice at any given time. 

If DwtNentryCallback is non-NULL, then all the toggle button callbacks will execute the entry_callback function, rather than the procedure specified in the toggle.  Otherwise, if DwtNentryCallback is NULL, then the individual callbacks work as usual. 

Option menus also position the pop-up part of the menu so that the menu history widget covers the selection part of the option menu.  Option menus also copy the label of the menu history widget into the selection part. 

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 Set as large as necessary to hold all child widgets
DwtNheight Dimension Set as large as necessary to hold all child widgets
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
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 The default XUI Toolkit font
Used only by gadget children
DwtNhelpCallback DwtCallbackPtr NULL
Menu Attributes

DwtNspacing Dimension Zero pixels
DwtNmarginHeight Dimension 3 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

Attribute Name Data Type Default
DwtNlabel DwtCompString Widget name
DwtNsubMenuId Widget Zero

DwtNlabelSpecifies the label that will be placed to the left of the current value. 

DwtNsubMenuIdSpecifies the widget ID of the pull-down menu associated with the option menu during the creation phase. 

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. 
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

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026