Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

DwtPushButton(3Dwt)

Name

DwtPushButton, DwtPushButtonCreate − Creates a push button widget. 

Syntax

Widget DwtPushButton(parent_widget, name, x, y,
                     label, callback, help_callback)
     Widget parent_widget;
     char *name;
     Position x, y;
     DwtCompString label;
     DwtCallbackPtr callback, help_callback;

Widget DwtPushButtonCreate (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 push button label.  This argument sets the DwtNlabel attribute associated with DwtLabelCreate. 

callbackSpecifies the callback function or functions called back when a push button is activated.  This argument sets the DwtNactivateCallback, DwtNarmCallback, and DwtNdisarmCallback attributes associated with DwtPushButtonCreate. 

help_callbackSpecifies the callback function or functions called when a help request is made.  This argument sets the DwtNhelpCallback common widget attribute. 

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 DwtPushButton and DwtPushButtonCreate functions create an instance of the push button widget and return its associated widget ID.  When calling DwtPushButton, you set the push button widget attributes presented in the formal parameter list.  For DwtPushButtonCreate, however, you specify a list of attribute name/value pairs that represent all the possible push button widget attributes. 

The push button is a primitive widget that displays a rectangular border around a label.  The label defines the immediate action of the button (for example, Ok or Cancel in a dialog box). 

The sizing is affected by spacing, font (affects indicator), and label.  See the description for DwtLabel and DwtLabelCreate. 

The push button widget follows the same rules for geometry management as its superclass the label widget, which you create by calling DwtLabel or DwtLabelCreate.  Like the label widget, the push button widget does not support children; therefore, it always refuses geometry requests. 

The push button widget follows the same rules for resizing as its superclass the label widget, which you create by calling DwtLabel or DwtLabelCreate.  Like the label widget, the push button widget does nothing on a resize by its parents. 

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 The width of the label or pixmap plus DwtNmarginWidth times two
DwtNheight Dimension The height of the label or pixmap plus DwtNmarginHeight times two
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
DwtNhelpCallback DwtCallbackPtr NULL
Label Attributes

DwtNlabelType unsigned char DwtCString
DwtNlabel DwtCompString Widget name
DwtNmarginWidth Dimension Two pixels for text
Zero pixels for pixmap
DwtNmarginHeight Dimension Two pixels for text
Zero pixels for pixmap
DwtNalignment unsigned char DwtAlignmentCenter
DwtNpixmap Pixmap NULL
DwtNmarginLeft Dimension Zero
DwtNmarginRight Dimension Zero
DwtNmarginTop Dimension Zero
DwtNmarginBottom Dimension Zero
DwtNconformToText Boolean True, if the widget is created with a width and height of zero
False, if the widget is created with a non-zero width and height

Widget-Specific Attributes

Attribute Name Data Type Default
DwtNbordHighlight Boolean False
DwtNfillHighlight Boolean False
DwtNshadow Boolean True
DwtNactivateCallback DwtCallbackPtr NULL
DwtNarmCallback DwtCallbackPtr NULL
DwtNdisarmCallback DwtCallbackPtr NULL
DwtNacceleratorText DwtCompString NULL
DwtNbuttonAccelerator char * NULL
DwtNinsensitivePixmap Pixmap NULL

DwtNbordHighlight
Specifies a boolean value that, when True, highlights the border. 

DwtNfillHighlight
Specifies a boolean value that, when True, fills the highlighted button. 

DwtNshadowSpecifies whether the shadow of the push button is displayed. 

DwtNactivateCallback
Specifies the callback function or functions called when the push button is activated. The button is activated when the user presses and releases MB1 while the pointer is inside the push button widget. Activating the push button also disarms the push button. For this callback, the reason is DwtCRActivate. 

DwtNarmCallback
Specifies the callback function or functions called when the push button is armed. The push button is armed when the user presses and releases MB1 while the pointer is inside the push button widget. For this callback, the reason is DwtCRArm. 

DwtNdisarmCallback
Specifies the callback function or functions called when the push button is disarmed. The button is disarmed in two ways. After the user activates the button (presses and releases MB1 while the pointer is inside the push button widget), the button is disarmed. When the user presses MB1 while the pointer is inside the push button widget but moves the pointer outside the push button before releasing MB1, the button is disarmed. For this callback, the reason is DwtCRDisarm. 

DwtNacceleratorText
Specifies the compound-string text displayed for the accelerator.

DwtNbuttonAccelerator
Sets an accelerator on a push button widget. This is the same as the DwtNtranslations core attribute except that only the left side of the table is to be passed as a character string, not compiled.  The application is responsible for calling XtInstallAllAccelerators to install the accelerator where the application needs it. 

DwtNinsensitivePixmap
Specifies the pixmap used when the push button is set to insensitive. This attribute applies only if the push button label is specified as a pixmap.

Return Value

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;
} DwtAnyCallbackStruct;

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 activated the push button by pressing MB1 while the pointer was inside the push button widget. 
DwtCRArm The user armed the push button by pressing MB1 while the pointer was inside the push button widget. 
DwtCRDisarm The user disarmed the push button in one of two ways.  The user pressed MB1 while the pointer was inside the push button widget, but did not release it until after moving the pointer outside the push button widget.  Or, the user activated the push button, which also disarms it. 
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. 

See Also

Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding

Subroutines

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