#include <xsi_menuitem.h>
The MenuItem object represents an individual item on a custom menu.
Here are some of the features:
A menu item can be defined as a standard menu item on which you can attach a command or callback function
You can also create a menu item as a separator or as a sub menu. See the Menu object documentation for more details about adding menu items to a custom menu.
Public Member Functions |
|
MenuItem () | |
~MenuItem () | |
MenuItem (const CRef &in_ref) | |
MenuItem (const MenuItem &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
MenuItem & | operator= (const MenuItem &in_obj) |
MenuItem & | operator= (const CRef &in_ref) |
CStatus | PutCallback (const CString &in_strCallback) |
CString | GetCallback () const |
CStatus | PutCommand (const CString &in_strCommand) |
siMenuItemStyle | GetStyle () const |
CStatus | PutFilter (const CString &in_strFilter) |
CRef | GetFilter () const |
bool | IsEnabled () |
CStatus | PutEnabled (bool in_bFlag) |
bool | IsChecked () const |
CStatus | PutChecked (bool in_bFlag) |
MenuItem | ( | ) |
Default constructor.
~MenuItem | ( | ) |
Default destructor.
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
siClassID GetClassID | ( | ) | const [virtual] |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
Sets the callback function for this menu item. The callback function is called when the item is selected and is executed by XSI as a single undo event. You can always undo/redo the action of a menu item callback function provided your function calls undoable commands or object model methods. The callback function must have the following signature:
CStatus MyFunction( const XSI::CRef& in_context )
The menu item that points to a callback has the following caption:
item_name [origin]
where item_name
is the name of the menu item and
origin
the origin of the callback ([u] for user, [w]
for workgroup).
in_strCallback | Callback function name. |
CString GetCallback | ( | ) | const |
Returns the callback function for this menu item.
Sets the command for this menu item. You can attach any native or custom commands you want to a menu item. If your menu is attached to a contextual menu and one of your command's arguments takes the selected objects by default, then the current selected object(s) is passed into your command. The target object under the cursor is also passed in as part of the selected objects. However if no objects are selected then only the target is passed in.
When a command is attached to a menu item, the caption is set as follows:
item_name [origin] hotkey
where item_name
is the name of the menu item,
origin
the origin of the command ([u] for user, [w]
for workgroup) and hotkey
the hotkey associated with
the command.
The menu item will be greyed out if the command is disabled.
in_strCommand | Command name. |
siMenuItemStyle GetStyle | ( | ) | const |
Sets the filter for this menu item. XSI uses the filter for validating the menu item or an entire menu against the target or selected objects before it gets displayed.
If the filter criteria are not satisfied then the menu item is greyed out. Menus are removed if attached to a contextual menu.
in_strFilter | Filter name. |
Reimplemented in Menu.
CRef GetFilter | ( | ) | const |
bool IsEnabled | ( | ) |
Returns true if the menu item is enabled.
CStatus PutEnabled | ( | bool | in_bFlag | ) |
Enables or disables a menu item. Menu objects can also be enabled or disabled which means all menu items defined in a menu are affected. This property is typically used for updating a menu item based on a specific context. Enabled by default.
in_bFlag | True enables the menu item, false disables it. |
bool IsChecked | ( | ) | const |
Returns true if the menu item is checked.
CStatus PutChecked | ( | bool | in_bFlag | ) |
Checks or unchecks a menu item. Unchecked by default.
in_bFlag | True checks the menu item, false unchecks it. |