EZwgl (4.6 Menu Buttons)

## 4.6 Menu Buttons

Menu buttons are very similar to normal buttons except that they serve as hooks to pull-down menus. When user press mouse button 1 over a menu button it posts its associated menu under the menu button. Then the user can slide the mouse down over the menu with button still pressed and release over a desired item. When the button is released over a menu item, the menu is unposted and if the menu item has any callbacks, they are invoked first. In the mean time, the selected menu entry and its return identifier are recorded in both the most recently posted menu (parent of the selected item) and the responsible menu button. If the menu has callbacks, they are invoked next. If the menu button has callbacks, they are invoked the last. This feature makes it convenient to manage menu callbacks. For the complex cases, one can associate a callback to each menu item. For simple cases, one may just register one callback to a menu button.

### Widget Info

Symbolic widget type | EZ_WIDGET_MENU_BUTTON
Default class name | "MenuButton"
Default instance name | "menuButton"

### Widget Interface Routines

`int EZ_SetWidgetLabelString(EZ_Widget *widget, char *str);`

set the textual label.

`void EZ_SetWidgetLabelPixmap(EZ_Widget *widget, EZ_Bitmap *pixmap);`

set the pixmap label.

`char *EZ_GetWidgetLabelString(EZ_Widget *widget);`

return the textual label.

`void EZ_SetMenuButtonMenu(EZ_Widget *widget, EZ_Widget *menu);`

associate a menu to a menu button.

`EZ_Widget *EZ_GetMenuButtonMenu(EZ_Widget *widget);`

retrieve the menu associated to a menu button.

`int EZ_GetWidgetReturnedData(EZ_Widget *widget);`

retrieve the returned data from the last selected menu item or -1.

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"MenuButton"`
EZ_NAME | name | `"menuButton"`

EZ_X | x |
EZ_Y | y |
EZ_WIDTH | width |
EZ_HEIGHT | height |

EZ_LOCATION | location |
EZ_SIZE | size |
EZ_GEOMETRY | geometry |

EZ_WIDTH_HINT | widthHint |
EZ_HEIGHT_HINT | heightHint |
EZ_SIZE_HINT | sizeHint |

EZ_BORDER_WIDTH | borderWidth | `2`
EZ_BORDER_TYPE | borderType | `none`
EZ_FOCUS_PAD | focusPad | `2`

EZ_PADX | padx | `8`
EZ_PADY | pady | `6`
EZ_IPADX | iPadx | `8`
EZ_IPADY | iPady | `6`

EZ_EXPAND | expand | `false`
EZ_PROPAGATE | propagate | `true`
EZ_TRANSIENT | transient | `false`

EZ_ORIENTATION | orientation | `horizontal`
EZ_FILL_MODE | fillMode | `fillNone`
EZ_SIDE | side | `center`

EZ_FONT_ID | fontID | `3`
EZ_FONT_NAME | fontName | `"*Bold*"`
EZ_LABEL_STRING | labelString | `null`
EZ_LABEL_POSITION | labelPosition | `center`
EZ_JUSTIFICATION | justification | `left`
EZ_TEXT_LINE_LENGTH | textLineLength | `30`

EZ_UNDERLINE | underline | `-1`
EZ_CURSOR | cursor | `"XC_left_ptr"`
EZ_BUBBLE_STRING | bubbleString | `null`

EZ_CALLBACK | N/A | `null null`
EZ_DESTROY_CALLBACK | N/A | `null null`
EZ_EVENT_HANDLER | N/A | `null null`

EZ_PIXMAP_FILE | pixmapFile | `null`
EZ_IMAGE_FILE | imageFile | `null`
EZ_BITMAP_DATA | N/A | `null`
EZ_PIXMAP_DATA | N/A | `null`
EZ_X_PIXMAP | N/A | `none`
EZ_LABELPIXMAP | N/A | `null`
EZ_RAW_RGB_DATA | N/A | `null`
EZ_SHAPED_WINDOW | shapedWindow | `false`
EZ_SHAPE_FILE | shapeFile | `NULL`
EZ_SHAPE_PIXMAP | N/A | `NULL`

EZ_FOREGROUND | foreground | `"black"`
EZ_BACKGROUND | background | `"gray74`
EZ_BG_IMAGE_FILE | bgImageFile | `null`
EZ_BG_PIXMAP | N/A | `none`
EZ_HIGHLIGHT_FOREGROUND | highlightForeground |
EZ_HIGHLIGHT_BACKGROUND | highlightBackground |

EZ_CLIENT_PTR_DATA | N/A | `null`
EZ_CLIENT_INT_DATA | clientIntData | `0`

EZ_DND_DRAG_CURSOR | dndDragCursor | `none`
EZ_DND_BUBBLE_STRING | dndBubbleString | `null`

EZ_BACKING_STORE | backingStore | `false`
EZ_SHORTCUT_KEY | shortcutKey | `null`

EZ_GRID_CELL_GEOMETRY | gridCellGeometry |
EZ_GRID_CELL_PLACEMENT | gridCellPlacement |

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`