## 4.24 Menubar

A menubar is a window to hold a set of menubutton like items (no window labels). When button 1 is pressed over an item, it posts the popup menu assigned to the item. 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 the most recently posted menu (parent of the selected item). If the menu has callbacks, they are invoked next.

A menubar may have an optional docking handle.

### Widget Info

Symbolic widget type | EZ_WIDGET_MENU_BAR
Default class name | "MenuBar"
Default instance name | "menuBar"

### Widget Interface Routines

    EZ_Widget *EZ_MenuBarAddItemAndMenu(EZ_Widget *mbar, char *label,
                                        int uline, EZ_Widget *menu);

append an item to a menubar.

`EZ_MenuBarSetItemMenu(EZ_Widget *mbar, char *label, EZ_Widget *menu);`

associate a menu to an item on a menubar.

    void EZ_MenuBarInsertItemAndMenu(EZ_Widget *mbar, char *label, int ul,
                         EZ_Widget *menu,  char *refItem, int where);

insert an item near the specified reference item.

`void EZ_MenuBarDeleteItem(EZ_Widget *mbar, char *label);`

remove an item from a menubar.

`void EZ_MenuBarDeleteItemAndMenu(EZ_Widget *mbar, char *label);`

delete an item and destroy its associated menu.

`EZ_Widget *EZ_MenuBarFindItem( EZ_Widget *mbar, char *name);`

find and return the specified item.

    EZ_Widget *EZ_MenuBarFindItemAndMenu( EZ_Widget *mbar, char *name,
                                          EZ_Widget **menuReturn);

find and return the return an item. Return its associated menu also.

`EZ_Widget *EZ_MenuBarFindItemAtXY( EZ_Widget *mbar, int x, int y);`

return the item displayed at the specified location.

    EZ_Widget *EZ_MenuBarFindItemAndMenuAtXY(EZ_Widget *mbar, int x, int y,
                                             EZ_Widget **menuRet);

return the item and its associated menu displayed at the specified location.

`int EZ_OnFrameDragHandle(EZ_Widget *mbar int x, int y);`

return 1 if point (x,y) is on the drag handle.

`void EZ_HighlightFrameDragHandle(EZ_Widget *mbar int onoff);`

turn the highlight on the drag handle on or off.

`int EZ_DetachFrame(EZ_Widget *mbar int x, int y);`

detach a menubar from its parent.

`int EZ_DockFrame(EZ_Widget *mbar int force);`

try dock a detached menubar.

`int EZ_XYIsInCorner(int x,int y,int w,int h);`

returns 1 if point (x,y) is on the corner of a detached menubar.

`int EZ_FrameIsDetached(EZ_Widget *widget);`

returns 1 if frame/menubar is detached.

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"MenuBar"`
EZ_NAME | name | `"menuBar"`

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

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

EZ_BORDER_WIDTH | borderWidth | `2`
EZ_BORDER_TYPE | borderType | `raised`
EZ_FOCUS_PAD | focusPad | `0`

EZ_PADX | padx | `8`
EZ_PADY | pady | `2`
EZ_IPADX | iPadx | `8`
EZ_IPADY | iPady | `0`

EZ_EXPAND | expand | `true`
EZ_PROPAGATE | propagate | `true`

EZ_ORIENTATION | orientation | `horizontalLeft`
EZ_FILL_MODE | fillMode | `fillHorizontally`
EZ_SIDE | side | `center`

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_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_DRAG_HANDLE | dragHandle | `none`
EZ_DOCKABLE | dockable | `false`
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`

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