Rhino C++ API
8.13
|
#include <RhinoSdkContextMenu.h>
Public Member Functions | |
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 LRESULT | MenuProc (UINT message, WPARAM wParam, LPARAM lParam) |
This will be used to extend this class without breaking the SDK and is currently not called. 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 Attributes | |
class CRhPopupMenu * | m_pHelper = nullptr |
Friends | |
class | CRhPopupMenu |
Description: Used to display a popup menu at a specified location. Wrapper for TrackPopupMenuEx()
CRhinoPopupMenu::CRhinoPopupMenu | ( | AFX_MODULE_STATE * | pModuleState, |
UINT | nResourceID = 0 , |
||
HINSTANCE | hInst = nullptr , |
||
int | iSubMenu = 0 |
||
) |
Description: Class constructor Parameters: 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
CRhinoPopupMenu::CRhinoPopupMenu | ( | AFX_MODULE_STATE * | pModuleState, |
LPCTSTR | lpsResourceID, | ||
HINSTANCE | hInst = nullptr , |
||
int | iSubMenu = 0 |
||
) |
Description: Class constructor Parameters: 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
|
virtual |
int CRhinoPopupMenu::AddItem | ( | const wchar_t * | lps, |
HBITMAP | hBitmap = nullptr , |
||
HBITMAP | hBitmapChecked = nullptr , |
||
HBITMAP | hBitmapUnChecked = nullptr |
||
) |
Description: Add a new string or bitmap item to the end of the popup menu. Parameters: lps [in] String to add hBitmap [in] Handle to the bitmap to be displayed or standard bitmap. See hbmpItem in the MENUITEMINFO structure definition in the MSDN help file for details. This bitmap will be copied so it is up to you to delete it when you are done. hBitmapChecked [in] Handle to the bitmap to display next to the item if it is selected. If this member is NULL, a default bitmap is used. hBitmapUnChecked [in] Handle to the bitmap to display next to the item if it is not selected. If this member is NULL, no bitmap is used. Returns: Returns value < 0 on error otherwise item reference index
int CRhinoPopupMenu::AddItem | ( | const wchar_t * | lps, |
HMENU | hMenu | ||
) |
Description: Add a sub menu to the context menu. This menu will be cloned and uniquie runtime menu IDs used. You will need to use RuntimePopupMenuItemID() to get convert original item IDs to runtime IDs. Parameters: lps [in] String to be displayed for the sub menu hMenu [in] Handle to a menu which will be cloned and appended to the menu Returns: Returns value < 0 on error otherwise item reference index
void CRhinoPopupMenu::AddSeparator | ( | ) |
Append a separator to the menu.
Description:
void CRhinoPopupMenu::CheckItem | ( | int | nItem, |
bool | bCheck = true |
||
) |
Description: Check or un-check a menu item Parameters: nItem [in] Item reference index returned by AddItem() bCheck [in] If true then the item will be checked otherwise it will be un-checked.
void CRhinoPopupMenu::EnableItem | ( | int | nItem, |
bool | bEnable = true |
||
) |
Description: Enable or disable item added to this menu Parameters: nItem [in] Item reference index returned by AddItem() bEnable [in] If true the menu item will be enabled otherwise it will be disabled and grayed out. By default all added items are enabled.
HMENU CRhinoPopupMenu::GetMenuHandle | ( | ) |
Menu handle for the context menu to be displayed.
Description:
int CRhinoPopupMenu::ItemCount | ( | ) | const |
Returns the number of items currently added to the menu, this includes separators and sub menus.
Description:
UINT CRhinoPopupMenu::ItemId | ( | int | nItem | ) |
int CRhinoPopupMenu::ItemReferenceIndexFromId | ( | UINT | nId | ) |
MSG* CRhinoPopupMenu::LastMessage | ( | ) |
Return NULL if left or right button picked is not true otherwise return pointer to message structure for message.
Description:
bool CRhinoPopupMenu::LeftButtonPicked | ( | ) |
Returns true if the menu was closed as a result of a left mouse button click.
Description:
|
virtual |
This will be used to extend this class without breaking the SDK and is currently not called.
Description:
Reimplemented in CRhinoContextMenu.
|
virtual |
Description: Called when WM_INITMENU message received for context menu. Parameters: hWnd [in] Window that received the message hMenu [in] Context menu
|
virtual |
Description: Override this method to get notified on WM_MENUSELECT messages Parameters: hWnd [in] Window the WM_MENUSELECT was sent to hMenu [in] Handle to the menu which generated the message index [in] Zero based index to the selected item
LPPOINT CRhinoPopupMenu::PointPicked | ( | ) |
Return NULL if LeftButtonPicked() and RightButtonPicked() are false otherwise returns point where mouse went down.
Description:
|
virtual |
0 = Not transparent, 1 to 100 = percentage of tranparency.
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.
ptBottom | 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 | Top point. Bottom left corner of the poupup. This is used if there is not enough space to display the menu below the window. |
CRect CRhinoPopupMenu::RectToAvoid | ( | ) | const |
Description: Rectangle to exclude when positioning the menu, in screen coordinates. This is an empty rectangle by default and gets ignored. See Also: TPMPARAMS Structure in MSDN help
bool CRhinoPopupMenu::RightButtonPicked | ( | ) |
Returns true if the menu was closed as a result of a right mouse button click.
Description:
UINT CRhinoPopupMenu::RuntimePopupMenuItemID | ( | HMENU | hMenuOriginal, |
UINT | nOriginalID | ||
) |
Description: Convert original sub menu ID to runtime ID which was used in this menu. This is useful when initializing the menu at runtime. Parameters: hMenuOriginal [in] Menu handle passed to AddItem() to add the sub menu nOriginalID [in] Original menu item ID Returns: Returns the runtime ID for the menu item or 0 if not found.
void CRhinoPopupMenu::SetRectToAvoid | ( | LPRECT | lpRect | ) |
Description: Rectangle to exclude when positioning the menu, in screen coordinates. Set this to NULL or an empty rectangle to
disable this feature. Parameters: lpRect [in] If non-null and not an empty rectangle it is passed to TrackPopupMenuEx() otherwise it is not See Also: TrackPopumMenuEx() or TPMPARAMS structure in MSDN help
void CRhinoPopupMenu::SetStatusBarHelpText | ( | int | nItem, |
const wchar_t * | lps | ||
) |
Description: Set status bar help text Parameters: nItem [in] Item reference index returned by AddItem() lps [in] Text to be displayed if status bar is synchronized
|
friend |
|
protected |