## class XGMenuBar

> Declared in <XMenu.h>

> This is the menu bar object. This is the abstraction of the menu bar inside of my application. This is attached to the window or is global, and cannot be swapped out with another one like me.

Construction/Destruction

> XGMenuBar::XGMenuBar
> XGMenuBar::XGMenuBar
> XGMenuBar::XGMenuBar
> XGMenuBar::~XGMenuBar

Top Level Access

> XGMenuBar::GetAccelerator
> XGMenuBar::GetLength
> XGMenuBar::GetMenu
> XGMenuBar::LoadFromResource
> XGMenuBar::MenuCommand
> XGMenuBar::MenuCommand
> XGMenuBar::MenuDispatch
> XGMenuBar::MenuKey
> XGMenuBar::MenuKey
> XGMenuBar::MenuSelect
> XGMenuBar::SetAccelerator
> XGMenuBar::TranslateAccelerator
> XGMenuBar::UpdateMenuBar

Construction/Destruction

XGMenuBar::XGMenuBar

> Usage: XGMenuBar::XGMenuBar()

> Construction a menu bar. On the Macintosh this is a global resource that is actually initialized elsewhere; this only initializes itself for use with the global menubar.

XGMenuBar::XGMenuBar

> Usage: XGMenuBar::XGMenuBar(HWND w,bool mdiFlag)

> Construction a menu bar. On Windows, my class tracks the menu bar contained in a single window object.

> Note: It's assumed the menu bar has not already been initialized in the window passed to me.

XGMenuBar::XGMenuBar

> Usage: XGMenuBar::XGMenuBar(Window w)

> Construction of a menu bar. On X, I handle drawing everything myself. Here, I only maintain a backwards pointer to the window for fast processing

XGMenuBar::~XGMenuBar

> Usage: XGMenuBar::~XGMenuBar()

> I'm going away. In all cases I assume that my going away requires little more than disposing of the memory I already allocated. The memory held by the OS for the menu bar itself is disposed elsewhere.

Top Level Access

XGMenuBar::GetAccelerator

> Usage: char XGMenuBar::GetAccelerator(short cmd)const

> Get the accelerator key (menu key shortcut) for this command. On Microsoft Windows this is a global, but on the Macintosh this is stored in the menu handle itself.

XGMenuBar::GetLength

> Usage: long GetLength()const

> Gets the number of menus in this menu bar.

XGMenuBar::GetMenu

> Usage: XGMenu*GetMenu(long i)const

> Gets the specified menu. The index is zero based

XGMenuBar::LoadFromResource

> Usage: bool XGMenuBar::LoadFromResource(short resid)

> This loads the menu bar from the specified resource. This then sets up the current menu bar with the specified menu. This will not act if the menu bar has already been loaded with the specified resource.

> You must call UpdateMenuBar() after loading this thing.

XGMenuBar::MenuCommand

> Usage: bool XGMenuBar::MenuCommand(XGFocus*f,long l)

> The Macintosh version of this processes the Macintosh menu item.

XGMenuBar::MenuCommand

> Usage: bool XGMenuBar::MenuCommand(XGFocus*f,WPARAM cmd)

> The Windows version of this. This processes a window command when one is sent to my focus.

XGMenuBar::MenuDispatch

> Usage: bool XGMenuBar::MenuDispatch(XGFocus*f,short cmd)

> Process the specified command on X.

XGMenuBar::MenuKey

> Usage: bool XGMenuBar::MenuKey(XGFocus*f,char what)

> (X) This is called when a key was pressed with the command button down. This calls the appropriate OS routine to figure out what menu was selected, and dispatches to the item selected.

XGMenuBar::MenuKey

> Usage: bool XGMenuBar::MenuKey(XGFocus*f,char what)

> The Macintosh verison of this.

> This is called when a key was pressed with the command button down. This calls the appropriate OS routine to figure out what menu was selected, and dispatches to the item selected.

XGMenuBar::MenuSelect

> Usage: bool XGMenuBar::MenuSelect(XGFocus*f,short x,short y)

> The Macintosh version of this.

> This is called when the menu has been clicked on. This calls the appropriate OS routines and dispatches to the menu clicked on

XGMenuBar::SetAccelerator

> Usage: void XGMenuBar::SetAccelerator(short cmd,char accel)

> Set the accelerator key

XGMenuBar::TranslateAccelerator

> Usage: int XGMenuBar::TranslateAccelerator(HWND w,LPMSG msg)

> (Windows) Translate the accelerator on the accelrator table I'm maintaining

XGMenuBar::UpdateMenuBar

> Usage: void XGMenuBar::UpdateMenuBar(XGFocus*focus)

> This updates the menu bar, sending commands to the specified focus.