PtMenuButton

A button used to display a menu

Class hierarchy:

PtWidgetPtBasicPtContainerPtCompoundPtMenuButton

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtMenuButton button in PhAB

Public header:

<photon/PtMenuButton.h>

Description:

The PtMenuButton class displays text or images with optional accelerator key text. Menu buttons are used to present menus from within menu bars or other menus.


PtMenuButton


A PtMenuButton widget.

If you want an accelerator key, set the Pt_ARG_ACCEL_KEY resource that's inherited from PtLabel. For example:

narg = 0;
PtSetArg (&args [narg++], Pt_ARG_TEXT_STRING, "File", 0);
PtSetArg (&args [narg++], Pt_ARG_ACCEL_KEY, "F", 0);
PtCreateWidget (PtMenuButton, database.menu, narg, args);

New resources:

Resource C type Pt type Default
Pt_ARG_ACCEL_FONT char * String "TextFont09b"
Pt_ARG_ACCEL_TEXT char * String ""
Pt_ARG_BUTTON_TYPE unsigned short Scalar Pt_MENU_TEXT
Pt_ARG_MODIFIER_KEYS unsigned long Flag 0

Note: These resources are actually defined in <photon/PtMenuLabel.h> for the PtMenuLabel widget, which you'll never instantiate on its own.

Pt_ARG_ACCEL_FONT

C type Pt type Default
char * String "TextFont09b"

The font used to render the hotkey accelerator text.

Pt_ARG_ACCEL_TEXT

C type Pt type Default
char * String ""

The text that identifies the hotkey that's bound to this widget.

Pt_ARG_BUTTON_TYPE

C type Pt type Default
unsigned short Scalar Pt_MENU_TEXT

The type of menu button; one of the following:

Pt_MENU_TEXT
Display the accelerator text, if it's defined.
Pt_MENU_RIGHT
Display the submenu to the right of the button.
Pt_MENU_DOWN
Display the submenu below the button.
Pt_MENU_UP
Display the submenu above the button.

Pt_ARG_MODIFIER_KEYS

C type Pt type Default
unsigned long Flag 0

The modifier key(s) to be displayed in the menu button, expressed as a bitwise OR of one or more of the Pk_KM_* flags defined in <photon/PkKeyDef.h>.

Inherited resources:

If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ACCEL_KEY PtLabel
Pt_ARG_ANCHOR_FLAGS PtWidget Not used by this class.
Pt_ARG_ANCHOR_OFFSETS PtWidget Not used by this class.
Pt_ARG_AREA PtWidget
Pt_ARG_BALLOON_COLOR PtLabel
Pt_ARG_BALLOON_FILL_COLOR PtLabel
Pt_ARG_BALLOON_POSITION PtLabel
Pt_ARG_BALLOON_TEXT PtLabel
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BASIC_FLAGS PtBasic Pt_FLAT_FILL
Pt_ARG_BEVEL_WIDTH PtWidget 0
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BEVEL_COLOR PtBasic
Pt_ARG_BEVEL_CONTRAST PtBasic
Pt_ARG_COLOR PtBasic
Pt_ARG_CONTAINER_FLAGS PtContainer
Pt_ARG_CONTRAST PtBasic
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_OVERRIDE PtContainer
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DARK_BEVEL_COLOR PtBasic
Pt_ARG_DARK_FILL_COLOR PtBasic
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget &= ~Pt_CONSUME_EVENTS
Pt_ARG_EXTENT PtWidget
Pt_ARG_FILL_COLOR PtBasic
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget Pt_SELECTABLE|
Pt_MENU_BUTTON|
Pt_GETS_FOCUS|
Pt_MENUABLE|
Pt_ALL_BUTTONS
Pt_ARG_GRID_LAYOUT_DATA PtWidget
Pt_ARG_HEIGHT PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_HORIZONTAL_ALIGNMENT PtLabel
Pt_ARG_INLINE_COLOR PtBasic
Pt_ARG_LABEL_BALLOON PtLabel
Pt_ARG_LABEL_FLAGS PtLabel
Pt_ARG_LABEL_IMAGE PtLabel
Pt_ARG_LABEL_TYPE PtLabel
Pt_ARG_LAYOUT_DATA PtWidget
Pt_ARG_LIGHT_BEVEL_COLOR PtBasic
Pt_ARG_LIGHT_FILL_COLOR PtBasic
Pt_ARG_LINE_SPACING PtLabel
Pt_ARG_MARGIN_BOTTOM PtLabel
Pt_ARG_MARGIN_HEIGHT PtBasic
Pt_ARG_MARGIN_LEFT PtLabel
Pt_ARG_MARGIN_RIGHT PtLabel
Pt_ARG_MARGIN_TOP PtLabel
Pt_ARG_MARGIN_WIDTH PtBasic
Pt_ARG_MAXIMUM_DIM PtWidget
Pt_ARG_MINIMUM_DIM PtWidget
Pt_ARG_OUTLINE_COLOR PtBasic
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget Pt_RESIZE_XY_AS_REQUIRED
Pt_ARG_ROW_LAYOUT_DATA PtWidget
Pt_ARG_SECONDARY_H_ALIGN PtLabel
Pt_ARG_SECONDARY_V_ALIGN PtLabel
Pt_ARG_STYLE PtBasic
Pt_ARG_TEXT_FONT PtLabel
Pt_ARG_TEXT_IMAGE_SPACING PtLabel
Pt_ARG_TEXT_STRING PtLabel
Pt_ARG_TITLE PtContainer
Pt_ARG_TITLE_FONT PtContainer
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_UNDERLINE_TYPE PtLabel
Pt_ARG_UNDERLINE1 PtLabel
Pt_ARG_UNDERLINE2 PtLabel
Pt_ARG_USER_DATA PtWidget
Pt_ARG_VERTICAL_ALIGNMENT PtLabel
Pt_ARG_WIDTH PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BALLOONS PtContainer
Pt_CB_BLOCKED PtWidget
Pt_CB_CHILD_ADDED_REMOVED PtContainer
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_DND PtWidget
Pt_CB_FILTER PtWidget
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_OUTBOUND PtWidget
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_RESIZE PtContainer
Pt_CB_UNREALIZED PtWidget