Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_Menu_Imp Class Reference

Linux / Gtk implementation of the CP_Menu class.

Inheritance diagram for CP_Menu_Imp:

CP_NoCopy CP_NoCopy CP_NoCopy CP_Menu List of all members.

Public Member Functions

 CP_Menu_Imp ()
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle)
 CP_Menu_Imp (const CP_String &inMenuTitle)
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle, OSMenu inOSMenu)
virtual ~CP_Menu_Imp () throw ()
virtual CP_CommandNo GetCommandNo (SInt16 inMenuItemIndex)
OSMenu GetOSMenu ()
OSMenu GetMenuItems ()
SInt16 GetID ()
UInt16 GetMenuItemCount ()
CP_String GetItemText (SInt16 inMenuItemIndex)
void AppendItem (const CP_String &inMenuItem, CP_CommandNo inCommand=CP_CMD_NoCommand)
void AppendSeparator ()
void DeleteItem (UInt16 inItemIndex)
CP_MenuItems_ArrayGetMenuItemsArray ()
void AppendItem (const CP_String &inItemText, CP_CommandNo inCommand)
void DeleteItem (UInt16 inItemIndex)
void UpdateCommandStatus (CP_M_CommandHandler *inCommandHandler)
Constructor / Destructor
 CP_Menu_Imp ()
 Constructor.
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle)
 CP_Menu_Imp (const CP_String &inMenuTitle)
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle, OSMenu inOSMenu)
 CP_Menu_Imp (OSMenu inOSMenu)
virtual ~CP_Menu_Imp () throw ()
 Destructor.
Constructor / Destructor
 CP_Menu_Imp ()
 Constructor.
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle)
 CP_Menu_Imp (const CP_String &inMenuTitle)
 CP_Menu_Imp (SInt16 inMenuID, const CP_String &inMenuTitle, OSMenu inOSMenu)
virtual ~CP_Menu_Imp () throw ()
 Destructor.

Protected Member Functions

void LoadOSMenu (SInt16 inMenuID, bool inPopup)

Protected Attributes

SInt16 fMenuID
OSMenu fOSMenu
CP_CommandsNo_ArrayfCommands
OSMenu fMenuItems
CP_MenuItems_ArrayfMenuItemStructs_Linux
CP_MenuImp_List fSubMenus
CP_CommandsNo_ArrayfCommands
CP_String fMenuTitle

Private Member Functions

void BuildCommandTable ()
void AddMenuItem_private (CP_S_MenuItem_Linux *inMenuItem)
CP_S_MenuItem_LinuxGetMenuItem_Private (SInt16 inIndex) const
void LoadMenu_LinuxStruct (CP_S_MenuItems_Linux *inMenuItems, const CP_String &inMenuTitle)
Utility
void RemoveQuitItem ()
void RemovePreferenceItem ()
Initialization
void BuildCommandTable ()

Static Private Member Functions

static void Selection_callback (GtkWidget *inWidget, gpointer inData)
static gboolean Clicked_callback (GtkWidget *inWidget, GdkEvent *inEvent, CP_Menu_Imp *inMenu)

Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_Menu_Imp::CP_Menu_Imp  ) 
 

Constructor.

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle
 

Constructor. Constructs the menu from a menu id and a menu title.

Parameters:
inMenuID Resource id of the menu.
inMenuTitleq String containing the title of the menu.

CP_Menu_Imp::CP_Menu_Imp const CP_String inMenuTitle  ) 
 

Constructor. Constructs the menu from a menu id and a menu title.

Parameters:
inMenuID Resource id of the menu.
inMenuTitleq String containing the title of the menu.

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle,
OSMenu  inOSMenu
 

Constructor. Constructs the menu from a menu id and a menu title.

Parameters:
inMenuID Resource id of the menu.
inMenuTitleq String containing the title of the menu.

CP_Menu_Imp::~CP_Menu_Imp  )  throw () [virtual]
 

Destructor.

CP_Menu_Imp::CP_Menu_Imp  ) 
 

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle
 

CP_Menu_Imp::CP_Menu_Imp const CP_String inMenuTitle  ) 
 

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle,
OSMenu  inOSMenu
 

CP_Menu_Imp::CP_Menu_Imp OSMenu  inOSMenu  ) 
 

Constructor. Constructs the menu from an existing OSMenu

Parameters:
inOSMenu The platforms OS menu to use for this class.
Exceptions:
none 

virtual CP_Menu_Imp::~CP_Menu_Imp  )  throw () [virtual]
 

CP_Menu_Imp::CP_Menu_Imp  ) 
 

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle
 

CP_Menu_Imp::CP_Menu_Imp const CP_String inMenuTitle  ) 
 

CP_Menu_Imp::CP_Menu_Imp SInt16  inMenuID,
const CP_String inMenuTitle,
OSMenu  inOSMenu
 

virtual CP_Menu_Imp::~CP_Menu_Imp  )  throw () [virtual]
 


Member Function Documentation

CP_CommandNo CP_Menu_Imp::GetCommandNo SInt16  inMenuItemIndex  )  [virtual]
 

Return the CP_COMMAND for the passed in inMenuItem. If the inMenuItem does not correspond to an item in this menu, CP_CMD_NoCommand is returned.

OSMenu CP_Menu_Imp::GetOSMenu  ) 
 

Return the MacOS platform menu reference.

Returns:
OSMenu MacOS menu reference.

OSMenu CP_Menu_Imp::GetMenuItems  ) 
 

SInt16 CP_Menu_Imp::GetID  ) 
 

Return the ID of this menu.

Exceptions:
none 
Returns:
SInt16 ID of this menu.

SInt16 CP_Menu_Imp::GetMenuItemCount  ) 
 

Returns the number of menu items in this menu. If this is an Apple menu, then 1 is returned for the count.

Returns:
SInt16 Number of menu items.

CP_String CP_Menu_Imp::GetItemText SInt16  inMenuItemIndex  ) 
 

void CP_Menu_Imp::AppendItem const CP_String inItemText,
CP_CommandNo  inCommand = CP_CMD_NoCommand
 

Appends the passed in item to this menu.

Parameters:
inItemText The text of the item being appended.
inCommand The command of the item being appended.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::AppendSeparator  ) 
 

void CP_Menu_Imp::DeleteItem UInt16  inItemIndex  ) 
 

Delets the menu item with the passed in inItemIndex which is 1 based, and should be between 1 and the number of items in this menu.

Parameters:
inItemIndex The 1 based index of the item to delete.
Returns:
void

CP_MenuItems_Array* CP_Menu_Imp::GetMenuItemsArray  ) 
 

void CP_Menu_Imp::SetTitle const CP_String inTitle  ) 
 

Sets the menu title from the passed in string.

Parameters:
inTitle The title of the menu.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::LoadOSMenu SInt16  inMenuID,
bool  inPopup
[protected]
 

Loads the MacOS menu reference with the passed in resource id. If no menu can be found a CP_ThrowIfResFail exception is thrown.

Under MacOSX if this is a menu with the id of kCP_FileMenuID a check will be made if there is a Quit item at the end of the menu, and if so it and its separator line (if any) will be removed from this menu.

Under MacOSX the edit menu is also checked for a preference item, and it will be removed like the above file menus quit item.

Parameters:
inMenuID Resource id of the menu to load.
inPopup Flag to indicate if this is a popup menu.
Returns:
void

void CP_Menu_Imp::Selection_callback GtkWidget *  inWidget,
gpointer  inData
[static, private]
 

Callback routine when a menu item is selected. This will call the current target to handle the CP_COMMAND for the selected item.

Parameters:
inWidget - not used.
inDate - contains a CP_S_MenuItem_Linux structure for the choosen menu item.

gboolean CP_Menu_Imp::Clicked_callback GtkWidget *  inWidget,
GdkEvent *  inEvent,
CP_Menu_Imp inMenu
[static, private]
 

Callback routine when a menu item is selected. This will call the current target to handle the CP_COMMAND for the selected item.

Parameters:
inWidget - not used.
inDate - contains a CP_S_MenuItem_Linux structure for the choosen menu item.

void CP_Menu_Imp::BuildCommandTable  )  [private]
 

Build the table of commands that correspond to each item in this menu. This table is stored as a kMenuCommandTableResourceType resource with the same resource id of this menu.

Returns:
void

void CP_Menu_Imp::AddMenuItem_private CP_S_MenuItem_Linux inMenuItem  )  [private]
 

CP_S_MenuItem_Linux * CP_Menu_Imp::GetMenuItem_Private SInt16  inIndex  )  const [private]
 

void CP_Menu_Imp::LoadMenu_LinuxStruct CP_S_MenuItems_Linux inMenuItems,
const CP_String inMenuTitle
[private]
 

Load the menu items from the passed in CP_S_MenuItems_Linux structure for the Linux definition of a menu.

Parameters:
inMenuItems - structure containing the menu items for our menu.
inMenuTitle - a CP_String containing the title of this menu.

virtual CP_CommandNo CP_Menu_Imp::GetCommandNo SInt16  inMenuItemIndex  )  [virtual]
 

OSMenu CP_Menu_Imp::GetOSMenu  ) 
 

Return the MacOS platform menu reference.

Exceptions:
none 
Returns:
OSMenu MacOS menu reference.

SInt16 CP_Menu_Imp::GetMenuItemCount  ) 
 

CP_String CP_Menu_Imp::GetTitle  )  const
 

Returns the menu title as a CP_String.

Exceptions:
none 
Returns:
CP_String const The menu title.

SInt16 CP_Menu_Imp::GetID  ) 
 

Return the ID of this menu.

Exceptions:
none 
Returns:
SInt16 ID of this menu.

CP_CommandNo CP_Menu_Imp::GetCommand SInt16  inItemIndex  ) 
 

SInt16 CP_Menu_Imp::GetCommandItemIndex const CP_CommandNo  inCommand  ) 
 

CP_String CP_Menu_Imp::GetItemText SInt16  inItemIndex  ) 
 

void CP_Menu_Imp::AppendItem const CP_String inItemText,
CP_CommandNo  inCommand
 

void CP_Menu_Imp::DeleteItem UInt16  inItemIndex  ) 
 

void CP_Menu_Imp::SetTitle const CP_String inTitle  ) 
 

void CP_Menu_Imp::SetItemMark CP_CommandNo  inCommand,
SInt16  inItemMark,
bool  inHasMark
 

Sets/remove the menu items mark to the passed in inItemMark.

Parameters:
inCommand The CP_CommandNo of the item being set.
inItemMark The character to use as the menu item mark.
inHasMark Flag to indicate if we are setting or removing the mark.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::SetItemMark SInt16  inIndex,
SInt16  inItemMark,
bool  inHasMark
 

Sets/remove the menu items mark to the passed in inItemMark.

Parameters:
inIndex Index of the menu item being set.
inItemMark The character to use as the menu item mark.
inHasMark Flag to indicate if we are setting or removing the mark.
Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::LoadOSMenu SInt16  inMenuID,
bool  inPopup = false
[protected]
 

void CP_Menu_Imp::RemoveQuitItem  )  [private]
 

Under MacOSX if this is a menu with the id of kCP_FileMenuID a check will be made if there is a Quit item at the end of the menu, and if so it and its separator line (if any) will be removed from this menu.

Exceptions:
OSErr 
Returns:
void

void CP_Menu_Imp::RemovePreferenceItem  )  [private]
 

Under MacOSX if this is a menu with the id of kCP_EditMenuID a check will be made if there is a Preference item at the end of the menu, and if so it and its separator line (if any) will be removed from this menu.

Exceptions:
OSErr 
Returns:
void

OSMenu CP_Menu_Imp::GetOSMenu  ) 
 

Return the Windows platform menu reference.

Returns:
OSMenu Windows menu reference.

SInt16 CP_Menu_Imp::GetMenuItemCount  ) 
 

CP_String CP_Menu_Imp::GetTitle  )  const
 

SInt16 CP_Menu_Imp::GetID  ) 
 

Return the ID of this menu.

Exceptions:
none 
Returns:
SInt16 ID of this menu.

CP_CommandNo CP_Menu_Imp::GetCommand SInt16  inItemIndex  ) 
 

SInt16 CP_Menu_Imp::GetCommandItemIndex const CP_CommandNo  inCommand  ) 
 

CP_String CP_Menu_Imp::GetItemText SInt16  inItemIndex  ) 
 

void CP_Menu_Imp::AppendItem const CP_String inItemText,
CP_CommandNo  inCommand
 

void CP_Menu_Imp::DeleteItem UInt16  inItemIndex  ) 
 

void CP_Menu_Imp::UpdateCommandStatus CP_M_CommandHandler inCommandHandler  ) 
 

Update the status of all of the commands in this menu.

Exceptions:
none 
Returns:
void

void CP_Menu_Imp::SetTitle const CP_String inTitle  ) 
 

void CP_Menu_Imp::LoadOSMenu SInt16  inMenuID,
bool  inPopup = false
[protected]
 

void CP_Menu_Imp::LoadAsPopup SInt16  inMenuID  )  [protected]
 

void CP_Menu_Imp::BuildCommandTable  )  [private]
 


Member Data Documentation

SInt16 CP_Menu_Imp::fMenuID [protected]
 

OSMenu CP_Menu_Imp::fOSMenu [protected]
 

Menu id of this menu.

CP_CommandsNo_Array* CP_Menu_Imp::fCommands [protected]
 

MacOS menu reference.

OSMenu CP_Menu_Imp::fMenuItems [protected]
 

Table of commands for each menu item.

CP_MenuItems_Array* CP_Menu_Imp::fMenuItemStructs_Linux [protected]
 

List of structures we maintain about each item in the menu, used to map between CPLAT information for a menu, and the GtkWidget

CP_MenuImp_List CP_Menu_Imp::fSubMenus [protected]
 

MacOS menu reference.

CP_CommandsNo_Array* CP_Menu_Imp::fCommands [protected]
 

Windows menu reference.

CP_String CP_Menu_Imp::fMenuTitle [protected]
 

Table of commands for each menu item.


The documentation for this class was generated from the following files:
Generated on Sat Sep 17 20:01:52 2005 for CPLAT by  doxygen 1.4.0