LMenuBar is a PowerPlant class that is used for managing the menu bar.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
For detailed information on how to use this class, refer to The PowerPlant Book.
Source files:
Purpose:
The constructor creates the menu bar.
Access:
Prototype:
LMenuBar( ResIDT inMBARid );Parameters:
This constructor has the following parameter:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LMenuBar();
Purpose:
Return whether the keystoke could be a key equivalent for a menu command. Overrid this to implement keyboard equivalents that use modifier keys other than just the Command key.
Access:
Prototype:
virtual Boolean CouldBeKeyCommand(Parameters:
const EventRecord &inKeyEvent ) const;
This method has the following parameter:
Return:
This function returns true if the command key is down.
Purpose:
Return the Menu object for the specified MENU resource ID Returns nil if there is no such Menu object
Access:
Prototype:
LMenu *FetchMenu( ResIDT inMENUid ) const;Parameters:
This method has the following parameter:
Return:
Purpose:
Retrieve the Command number corresponding to a Menu (ID, item) pair.
Access:
Prototype:
CommandT FindCommand( ResIDT inMENUid,Parameters:
SInt16 inItem ) const;
This method has the following parameters:
Return:
Purpose:
Return the Command number corresponding to a keystroke. Call this function when CouldBeKeyCommand() is true. You should override this to implement keyboard equivalents that use modifier keys other than just the Command key.
Access:
Prototype:
virtual CommandT FindKeyCommand(Parameters:
const EventRecord &inKeyEvent,
SInt32 &outMenuChoice ) const;
Return:
The command number. Returns cmd_Nothing if the keystroke is not a menu equivalent
Remarks:
This function calls the Toolbox routine MenuKey to find the associated menu item, if any. Override this function (as well as CouldBeKeyCommand) to implement key equivalents that use other modifier keys, such as Option, Shift, or Control.
Purpose:
Passes back the MENU id, MenuHandle, and item number corresponding to a Command number.
If the Command is not associated with any item in the MenuBar,
outMENUid is 0, outMenuHandle is nil, and outItem is 0.
Access:
Prototype:
void FindMenuItem(Parameters:
CommandT inCommand,
ResIDT &outMENUid,
MenuHandle &outMenuHandle,
SInt16 &outItem);
This method has the following parameter:
Return:
Remarks:
Purpose:
Access:
Prototype:
Boolean FindNextCommand(Parameters:
SInt16 &ioIndex,
MenuHandle &ioMenuHandle,
LMenu* &ioMenu,
CommandT &outCommand );
This method has the following parameters:
Return:
Return true if the command is found, else return false.
Purpose:
Find the next menu in the menu bar.
Access:
Prototype:
Boolean FindNextMenu( LMenu* &ioMenu ) const;Parameters:
This method has the following parameter:
Return:
Return true if a menu was found, else return false.
Purpose:
Access:
Prototype:
static LMenuBar* GetCurrentMenuBar();Parameters:
Return:
Purpose:
Install a Menu object in the MenuBar
Access:
Prototype:
void InstallMenu(Parameters:
LMenu *inMenuToInstall,
ResIDT ioMenuHandle );
This method has the following parameters:
Return:
Purpose:
Handle menu selection with the Mouse and return the command number for the item chosen. Override this method to implement alternative menu selection behavior.
Access:
Prototype:
virtual CommandT MenuCommandSelection(Parameters:
const EventRecord &inMouseEvent,
SInt32 &outMenuChoice ) const;
This method has the following parameters:
Return:
Purpose:
Remove a Menu object from the menu bar.
Access:
Prototype:
void RemoveMenu( LMenu *inMenuToRemove );Parameters:
This method has the following parameters:
Return:
Purpose:
Storage for the menu bar pointer.
Access:
Prototype:
static LMenuBar *sMenuBar;
Purpose:
Access:
Prototype:
LMenu *mMenuListHead;