Class ActionCallback
See Also: Class BaseInterfaceServer, Class ActionTable, Class ActionItem, Class ActionContext, Class IActionManager, Class DynamicMenu, Class DynamicMenuCallback, Class Interface.
class ActionCallback : public BaseInterfaceServer
Description:
This class is available in release 4.0 and later only.
An important part of implementing an ActionTable is creating a sub-class of this class. This is an abstract class with a virtual method called ExecuteAction(int id). Developers need to sub-class this class and pass an instance of it to the system when they activate an ActionTable. Then when the system wants to execute an action the ExecuteAction() method is called.
All methods of this class are implemented by the plug-in.
Data Members:
private:
ActionTable *mpTable;
Points to the table that uses this ActionCallback.
Methods:
public:
Prototype:
virtual BOOL ExecuteAction(int id) = 0;
Remarks:
This method is called to actually execute the action.
Parameters:
int id
The ID of the item to execute.
Return Value:
This returns a BOOL that indicates if the action was actually executed. If the item is disabled, or if the table that owns it is not activated, then it won’t execute, and returns FALSE. If it does execute then TRUE is returned.
Default Implementation:
{ return FALSE; }
Prototype:
virtual IMenu* GetDynamicMenu(int id, HWND hwnd, IPoint2& m);
Remarks:
This method is called when an action item says it is a dynamic menu. This returns a pointer to the menu itself.
Parameters:
int id
The item ID which is passed to the DynamicMenuCallback::MenuItemSelected()
HWND hwnd
If the menu is requested by a right-click quad menu, then hwnd is the window where the click occurred. If the item is used from a menu bar, then hwnd will be NULL.
IPoint2& m
If the menu is requested by a right-click quad menu, then this will be the point in the window where the user clicked.
Default Implementation:
{ return NULL; }
Prototype:
ActionTable* GetTable();
Remarks:
Returns a pointer to the ActionTable the callback uses.
Default Implementation:
{ return mpTable; }
Prototype:
void SetTable(ActionTable* pTable);
Remarks:
Sets the ActionTable the callback uses.
Parameters:
ActionTable* pTable
Points to the ActionTable the callback uses.
Default Implementation:
{ mpTable = pTable; }