The toolbar manager for the customizable toolbar also allows you to register a button map. A button map lets you map specific button command IDs to non-standard toolbar buttons such as text buttons, combo box buttons, and two part buttons. You don't need to include a button map if you only need traditional bitmap-only buttons.
The button map supports the following features:
Allows customization of buttons on a per-command basis (recall button instances can be cloned).
Sets the button style.
Sets the button class.
Sets button class specific parameters.
Is linked in via the toolbar manager.
The button map is placed in the implementation file of your frame class, similar to the way a window message map is added.
The following lines of code are an example of a button map.
BEGIN_BUTTON_MAP(btnMap) STD_BUTTON(ID_CHECKED, TBBS_CHECKBOX) STD_BUTTON(ID_DISABLE, TBBS_CHECKBOX) STD_BUTTON(ID_INDETERMINATE, TBBS_INDETERMINATE) TWOPART_BUTTON(ID_UNDO, ID_DROPARROW, TBBS_CHECKBOX, 0) TWOPART_BUTTON(ID_REDO, ID_DROPARROW, 0, ID_REDO) COMBO_BUTTON(ID_FIND, IDC_COMBO_FIND, 0, CBS_DROPDOWN, 150, 40, 150) END_BUTTON_MAP() |
Once you define a button map, it is given to the toolbar manager. For more information, see Section 6.9.7.
The STD_BUTTON macro extends the standard customizable toolbar bitmap only button by introducing a style parameter. The syntax is as follows:
STD_BUTTON(ButtonID, Style) |
Macro parameter | Description |
ButtonID | Command ID for the button. |
Style | Window style (WS_*) |
The STD_MENU_BUTTON macro extends the standard customizable toolbar by creating a bitmap toolbar button that drops down a menu instead of executing a command.
STD_MENU_BUTTON(ButtonID, style, MenuResID, SubMenuIdx, TPMAlign) |
Macro Parameter | Description |
ButtonID | The command ID for the button. This command is not actually executed when the button is pressed. |
style | The button's window style. This parameter is usually zero. |
MenuResID | The resource ID for the menu resource for the drop-down menu. |
SubMenuIdx | Zero-based index for the popup menu's location in the menu resource—usually zero if creating a separate menu resource. |
TPMAlign | Alignment of the menu when dropped with respect to the toolbar button. Can be either TPM_LEFTALIGN, TPM_CENTERALIGN, or TPM_RIGHTALIGN. |
The TEXT_BUTTON macro implements a customizable toolbar button with text. The macro syntax is shown below.
TEXT_BUTTON(ButtonID, textResourceID) |
Macro parameter | Description |
ButtonID | Command ID for the button. |
TextResourceID | Resource ID of the text string (or 0 to load based on the button ID). |
The TEXT_BUTTON_EX macro is similar to TEXT_BUTTON (it implements a customizable toolbar button with text) except it also introduces a style parameter. The syntax is as follows:
TEXT_BUTTON_EX(ButtonID, TextResourceID, Style) |
Macro parameter | Description |
ButtonID | Command ID for the button. |
TextResourceID | Resource ID for the text string (or 0 to load based on the button ID). |
Style | Window style (WS_*) |
The TWOPART_BUTTON macro implements a customizable toolbar button that is divided into two bitmaps. It can issue two separate command IDs (for example, an Undo-Redo button). The syntax for this macro is as follows:
TWOPART_BUTTON(ButtonID, ButtonID2, Style, DispatchID) |
Macro parameter | Description |
ButtonID | Obtains the bitmap resource and command ID for the left side of the button. |
ButtonID2 | Obtains the bitmap resource for the right side of the button. |
Style | Window style (WS_*). |
DispatchID | The command ID for the right side of the button. |
The COMBO_BUTTON macro implements a customizable toolbar button from which you can drop down a combo box. The syntax is as follows:
COMBO_BUTTON(ButtonID, ComboID, Style, ComboStyle, ComboDefWidth, ComboMinWidth, ComboHeight) |
Macro parameter | Description |
ButtonID | Command ID for the button. |
ComboID | Command ID for the combo button. |
Style | Window style (WS_*). |
ComboStyle | Combo style (CBS_*). Not all combo styles are supported. |
ComboDefWidth | Default width of combo button. |
ComboMinWidth | Minimum width of combo button. |
ComboHeight | Height of combo button. |
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.