Rhino C++ API  8.5
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CRhinoContextMenu Class Reference

#include <RhinoSdkContextMenu.h>

Inheritance diagram for CRhinoContextMenu:
CRhinoPopupMenu

Public Member Functions

 CRhinoContextMenu (UUID uuidContextID, AFX_MODULE_STATE *pModuleState, LPCTSTR lpsResourceID, HINSTANCE hInst=nullptr, int iSubMenu=0)
 
 CRhinoContextMenu (UUID uuidContextID, AFX_MODULE_STATE *pModuleState, UINT nResourceID=0, HINSTANCE hInst=nullptr, int iSubMenu=0)
 
virtual ~CRhinoContextMenu ()
 
UUID ContextMenuUUID () const
 Return the context menu UUID passed to the constructor. More...
 
LRESULT MenuProc (UINT message, WPARAM wParam, LPARAM lParam) override
 This will be used to extend this class without breaking the SDK and is currently not called. More...
 
virtual int PopUpContextMenu (CRhinoContextMenuContext &context, HWND hWndParent, CPoint ptBottom, CPoint ptTop, int iTransparent=0)
 
virtual void PostAddContextMenuExtensions (CRhinoContextMenuContext &context)
 
virtual void PreAddContextMenuExtensions (CRhinoContextMenuContext &context)
 
- Public Member Functions inherited from CRhinoPopupMenu
 CRhinoPopupMenu (AFX_MODULE_STATE *pModuleState, LPCTSTR lpsResourceID, HINSTANCE hInst=nullptr, int iSubMenu=0)
 
 CRhinoPopupMenu (AFX_MODULE_STATE *pModuleState, UINT nResourceID=0, HINSTANCE hInst=nullptr, int iSubMenu=0)
 
virtual ~CRhinoPopupMenu ()
 
int AddItem (const wchar_t *lps, HBITMAP hBitmap=nullptr, HBITMAP hBitmapChecked=nullptr, HBITMAP hBitmapUnChecked=nullptr)
 
int AddItem (const wchar_t *lps, HMENU hMenu)
 
void AddSeparator ()
 Append a separator to the menu. More...
 
void CheckItem (int nItem, bool bCheck=true)
 
void EnableItem (int nItem, bool bEnable=true)
 
HMENU GetMenuHandle ()
 Menu handle for the context menu to be displayed. More...
 
int ItemCount () const
 Returns the number of items currently added to the menu, this includes separators and sub menus. More...
 
UINT ItemId (int nItem)
 
int ItemReferenceIndexFromId (UINT nId)
 
MSG * LastMessage ()
 Return NULL if left or right button picked is not true otherwise return pointer to message structure for message. More...
 
bool LeftButtonPicked ()
 Returns true if the menu was closed as a result of a left mouse button click. More...
 
virtual void OnInitMenu (HWND hWnd, HMENU hMenu)
 
virtual void OnMenuSelect (HWND hWnd, HMENU hMenu, int index)
 
LPPOINT PointPicked ()
 Return NULL if LeftButtonPicked() and RightButtonPicked() are false otherwise returns point where mouse went down. More...
 
virtual int PopUpEx (HWND hWndParent, CPoint ptBottom, CPoint ptTop, int iTransparent=0)
 0 = Not transparent, 1 to 100 = percentage of tranparency. More...
 
CRect RectToAvoid () const
 
bool RightButtonPicked ()
 Returns true if the menu was closed as a result of a right mouse button click. More...
 
UINT RuntimePopupMenuItemID (HMENU hMenuOriginal, UINT nOriginalID)
 
void SetRectToAvoid (LPRECT lpRect)
 
void SetStatusBarHelpText (int nItem, const wchar_t *lps)
 

Protected Member Functions

int AddPlugInExtensions ()
 

Protected Attributes

CRhinoContextMenuContextm_pContext
 
UUID m_uuidContextMenu
 
- Protected Attributes inherited from CRhinoPopupMenu
class CRhPopupMenum_pHelper = nullptr
 

Friends

class CRhPopupMenu
 

Constructor & Destructor Documentation

◆ CRhinoContextMenu() [1/2]

CRhinoContextMenu::CRhinoContextMenu ( UUID  uuidContextID,
AFX_MODULE_STATE *  pModuleState,
UINT  nResourceID = 0,
HINSTANCE  hInst = nullptr,
int  iSubMenu = 0 
)

Description: Class constructor Parameters: uuidContextID [in] UUID that identifies this context menu pModuleState [in] Module state for the plug-in that owns the context menu nResourceID [in] Resource ID for menu to be loaded, if this is 0 then no menu will be loaded hInst [in] Only used if nResourceID is greater than 0, if it is then the menu is loaded using this resource handle iSubMenu [in] Sub menu from loaded menu to be displayed Returns: Return true if you want the context menu specified by ecmt to add a separator then call ExtendContextMenu() allowing this object to add items to the context menu. See Also: See CRhinoPopup for details

◆ CRhinoContextMenu() [2/2]

CRhinoContextMenu::CRhinoContextMenu ( UUID  uuidContextID,
AFX_MODULE_STATE *  pModuleState,
LPCTSTR  lpsResourceID,
HINSTANCE  hInst = nullptr,
int  iSubMenu = 0 
)

Description: Class constructor Parameters: uuidContextID [in] UUID that identifies this context menu pModuleState [in] Module state for the plug-in that owns the context menu lpsResourceID [in] Resource ID for menu to be loaded, if this is a NULL string then no menu will be loaded hInst [in] Only used if lpsResourceID is greater than 0, if it is then the menu is loaded using this resource handle iSubMenu [in] Sub menu from loaded menu to be displayed See Also: See CRhinoPopup for details

◆ ~CRhinoContextMenu()

virtual CRhinoContextMenu::~CRhinoContextMenu ( )
virtual

Member Function Documentation

◆ AddPlugInExtensions()

int CRhinoContextMenu::AddPlugInExtensions ( )
protected

Description: Call this method to have plug-ins to extend the menu Returns: Number of plug-in provided items added to the menu

◆ ContextMenuUUID()

UUID CRhinoContextMenu::ContextMenuUUID ( ) const

Return the context menu UUID passed to the constructor.

Description:

◆ MenuProc()

LRESULT CRhinoContextMenu::MenuProc ( UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
overridevirtual

This will be used to extend this class without breaking the SDK and is currently not called.

Description:

Reimplemented from CRhinoPopupMenu.

◆ PopUpContextMenu()

virtual int CRhinoContextMenu::PopUpContextMenu ( CRhinoContextMenuContext context,
HWND  hWndParent,
CPoint  ptBottom,
CPoint  ptTop,
int  iTransparent = 0 
)
virtual

Description: Display and track the popup menu. Parameters: hWndParent [in] Handle to the window which owns the menu and the coordinate system for the display points ptBottom [in] Bottom point. Top left corner of the popup. This is used by default if there is enough screen space to display the popup menu on the bottom ptTop [in] Top point. Bottom left corner of the poupup. This is used if there is not enough space to display the menu below the window. iTransparent [in] 0 = Not transparent, 1 to 100 = percentage of tranparency Returns: Returns the index for the selected item which was added by calling AddItem or -1 if canceled. If using a loaded menu then WM_COMMAND messages are sent to hWndParent and 0 is returned. See Also: See CRhinoPopup::PopupEx() for details

◆ PostAddContextMenuExtensions()

virtual void CRhinoContextMenu::PostAddContextMenuExtensions ( CRhinoContextMenuContext context)
virtual

Description: Override this method to add items directly following the context extensions Parameters: context [in] CRhinoContextMenuContext passed to PopUpContextMenu

◆ PreAddContextMenuExtensions()

virtual void CRhinoContextMenu::PreAddContextMenuExtensions ( CRhinoContextMenuContext context)
virtual

Description: Override this method to insert items just prior to extending the menu Parameters: context [in] CRhinoContextMenuContext passed to PopUpContextMenu

Friends And Related Function Documentation

◆ CRhPopupMenu

friend class CRhPopupMenu
friend

Member Data Documentation

◆ m_pContext

CRhinoContextMenuContext* CRhinoContextMenu::m_pContext
protected

◆ m_uuidContextMenu

UUID CRhinoContextMenu::m_uuidContextMenu
protected