class SECMenuButton: public SECBitmapButon
The SECMenuButton class provides a simple button which when clicked displays a popup menu. This popup menu can be displayed either to the right or below the button (See Direction). SECMenuButton attaches to existing CButton controls and will pop up a given menu whenever the button is clicked.
Defined in: SECBTNS.h
1. Attach SECMenuButton to an existing CButton using the AttachButton
member function.
2. Specify the handle of the popup menu.
3. Specify where to place the popup menu (below or to the right of the button).
You can dynamically create an SECMenuButton using the Create function. Note that the menu handle must exist for the life of the SECMenuButton object.
See the COLOR sample in the \\OT\\SAMPLES\\STANDARD\\CONTROLS\\COLRWELL directory for a demonstration of this class.
enum Direction
Direction constants
FOUNDATION_API SECMenuButton()
Creates a menu button object.
FOUNDATION_API virtual BOOL AttachButton(int nCtlID, CWnd* pParentWnd, HMENU hMenu, Direction direction=DT_Down, int iFlags=0)
Attaches the menu button object to an existing button.
FOUNDATION_API virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const CRect& rect, CWnd* pParentWnd, int nID, HMENU hMenu, Direction direction=DT_Down, int iFlags=0)
Dynamically creates a menu button control.
FOUNDATION_API void SetDirection(Direction direction)
Sets the direction of the arrow on the button.
FOUNDATION_API Direction GetDirection() const
Gets the direction of the arrow on the button.
FOUNDATION_API void SetMenu(HMENU hMenu)
Sets the popup menu.
FOUNDATION_API virtual void OnBnClicked()
Called when the button is clicked (to create popup menu)
FOUNDATION_API virtual SECBitmapButton::Alignment Initialise(LPCTSTR lpszCaption, HMENU hMenu, Direction direction, UINT& nIDBmp)
Performs object initialisation.
FOUNDATION_API virtual void DrawItem(LPDRAWITEMSTRUCT lpDS)
Draws the button.
CMenu m_menu
The popup menu.
Direction m_direction
Direction of arrow (down or right).
BOOL m_bAllowDraw
When FALSE, the button is not drawn.