Rhino C++ API  8.6
Public Member Functions | Public Attributes | Protected Attributes | List of all members
CRuiOnUpdateMenuItems Class Referenceabstract

#include <RhinoSdkUiXML.h>

Public Member Functions

 CRuiOnUpdateMenuItems ()
 
virtual ~CRuiOnUpdateMenuItems ()
 
const CRuiOnUpdateMenuItemFindUpdateItem (UUID idFile, UUID idMenu, UUID idItem)
 
virtual void OnUpdateMenuItem (CRuiUpdateUi &cmdui)=0
 
bool RegisterMenuItem (const wchar_t *idFile, const wchar_t *idMenu, const wchar_t *idItem)
 
bool RegisterMenuItem (UUID idFile, UUID idMenu, UUID idItem)
 

Public Attributes

class CRhDockBarExtension * m__update_ui_extension
 

Protected Attributes

ON_SimpleArray< CRuiOnUpdateMenuItemm_MenuItems
 

Detailed Description

==========================================================================================

Description: This class is used to create menu item update handlers for menus created when a Rhino RUI file is loaded. To use a plug-in must derive a new class from this one and override the pure virtual OnUpdateMenuItem method. Following is an example implementation:

///< {AE63E876-3D28-4a97-823F-7436732F36E0} static const UUID idFile = { 0xae63e876, 0x3d28, 0x4a97, { 0x82, 0x3f, 0x74, 0x36, 0x73, 0x2f, 0x36, 0xe0 } }; ///< {5059282D-3954-44f2-8F43-124B9121242A} static const UUID idMainMenu = { 0x5059282d, 0x3954, 0x44f2, { 0x8f, 0x43, 0x12, 0x4b, 0x91, 0x21, 0x24, 0x2a } }; {BA80E8F8-EC51-44a4-BE1D-021AC366B8BF} static const UUID idLine = { 0xba80e8f8, 0xec51, 0x44a4, { 0xbe, 0x1d, 0x2, 0x1a, 0xc3, 0x66, 0xb8, 0xbf } }; ///< {6F531BF1-402E-4d64-B457-6E627FCCFF63} static const UUID idBox = { 0x6f531bf1, 0x402e, 0x4d64, { 0xb4, 0x57, 0x6e, 0x62, 0x7f, 0xcc, 0xff, 0x63 } }; class CMyRuiOnUpdateMenuItems : public CRuiOnUpdateMenuItems { public: CMyRuiOnUpdateMenuItems() { this->RegisterMenuItem(idFile, idMainMenu, idLine); this->RegisterMenuItem(L"AE63E876-3D28-4a97-823F-7436732F36E0", L"0F6EAA81-AE18-48fe-8CA1-585CCDC84957", L"6F531BF1-402E-4d64-B457-6E627FCCFF63"); } void OnUpdateMenuItem(UUID idFile, UUID idMenu, UUID idItem, CRuiUpdateUi& cmdui) { if (idLine == idItem) cmdui.SetCheck(true); else if (idBox == idItem) cmdui.SetCheck(true); } };

See Also: MSDN Help for WM_INITMENUPOPUP

Constructor & Destructor Documentation

◆ CRuiOnUpdateMenuItems()

CRuiOnUpdateMenuItems::CRuiOnUpdateMenuItems ( )

Description: Constructor

◆ ~CRuiOnUpdateMenuItems()

virtual CRuiOnUpdateMenuItems::~CRuiOnUpdateMenuItems ( )
virtual

Description: Destructor

Member Function Documentation

◆ FindUpdateItem()

const CRuiOnUpdateMenuItem* CRuiOnUpdateMenuItems::FindUpdateItem ( UUID  idFile,
UUID  idMenu,
UUID  idItem 
)

Description: Method to determine if a specific menu item has been registered

Parameters: idFile [in] The UUID of the file that contains the menu item idMenu [in] The UUID of the menu that contains the menu item, this may be a sub men ID idItem [in] The UUID of the menu item to update

Returns; Returns a pointer to the CRuiOnUpdateMenuItem if registered otherwise NULL

See Also: bool RegisterMenuItem(UUID idFile, UUID idMenu, UUID idItem); bool RegisterMenuItem(const wchar_t* idFile, const wchar_t* idMenu, const wchar_t* idItem);

◆ OnUpdateMenuItem()

virtual void CRuiOnUpdateMenuItems::OnUpdateMenuItem ( CRuiUpdateUi cmdui)
pure virtual

Step 2: You MUST OVERRIDE this method!!

Description: This method is called when Rhino receives the actually WM_INITPOPUPMENU message and forward to the first occurrence of RegisterMenuItem()

Parameters: idFile [in] The UUID of the file that contains the menu item idMenu [in] The UUID of the menu that contains the menu item, this may be a sub men ID idItem [in] The UUID of the menu item to update

See Also: bool RegisterMenuItem(UUID idFile, UUID idMenu, UUID idItem); bool RegisterMenuItem(const wchar_t* idFile, const wchar_t* idMenu, const wchar_t* idItem);

◆ RegisterMenuItem() [1/2]

bool CRuiOnUpdateMenuItems::RegisterMenuItem ( const wchar_t *  idFile,
const wchar_t *  idMenu,
const wchar_t *  idItem 
)

Description: Register a <RUI File> <RUI Menu> <RUI Menu Item> to receive update notification

Parameters: idFile [in] The UUID of the file that contains the menu item idMenu [in] The UUID of the menu that contains the menu item, this may be a sub men ID idItem [in] The UUID of the menu item to update

Returns; Returns true if successfully registered or false if there was an error

See Also: bool RegisterMenuItem(UUID idFile, UUID idMenu, UUID idItem);

◆ RegisterMenuItem() [2/2]

bool CRuiOnUpdateMenuItems::RegisterMenuItem ( UUID  idFile,
UUID  idMenu,
UUID  idItem 
)

Step 1: Register menu item IDs to receive update notification

Description: Register a <RUI File> <RUI Menu> <RUI Menu Item> to receive update notification

Parameters: idFile [in] The UUID of the file that contains the menu item idMenu [in] The UUID of the menu that contains the menu item, this may be a sub men ID idItem [in] The UUID of the menu item to update

Returns; Returns true if successfully registered or false if there was an error

See Also: bool RegisterMenuItem(const wchar_t* idFile, const wchar_t* idMenu, const wchar_t* idItem);

Member Data Documentation

◆ m__update_ui_extension

class CRhDockBarExtension* CRuiOnUpdateMenuItems::m__update_ui_extension

For internal use only! Reserved for future use.

◆ m_MenuItems

ON_SimpleArray<CRuiOnUpdateMenuItem> CRuiOnUpdateMenuItems::m_MenuItems
protected