The Toolbar Button Classes
Objective Toolkit includes a variety of classes that allow you to add different types of buttons to customizable toolbars. The following figure is of some of these button types.
Figure 72 – Example Customizable Toolbar Button Types
The button classes do not derive from CWnd or CObject. SECStdBtn is the base class for all customizable toolbar buttons. The reason the buttons are not CWnd-derived is to restrict the use of Windows resources. Multiple concurrently running applications with multiple customizable toolbars per application and multiple buttons per toolbar require considerable system resources. Our mechanism allows you to add CWnd-derived controls that can be added to the toolbars on an as-needed basis. See “SECWndBtn”and “Creating New Button Types”for more information.
Figure 73 – Hierarchies of the Toolbar Button Classes
The SECStdBtn encapsulates a single toolbar button. The SECCustomToolBar class uses it. SECStdBtn includes various operations for drawing buttons on a toolbar.
Typically, the SECStdBtn member functions are called from the Customize dialog. For more information, see “SECToolBarsDlg”. You can use this dialog to create a toolbar comprised of buttons designed to perform a particular task. If the default styles offered in the Customize dialog do not match your requirements, you can invoke the New Toolbar.
The New Toolbar dialog allows the user to create a new toolbar with a unique set of buttons.Use STD_BUTTON in your button map to create buttons of this type.
This class encapsulates a bitmap toolbar button that does not execute a command. Instead, it displays a drop-down menu that behaves like a context menu. This menu must be part of your application’s menu resources. If you create a separate menu resource for the button to use and you want to support bitmap menus, include this menu in your call to SECToolBarManager::SetMenuInfo().
Use the STD_MENU_BUTTON macro in your button map to create buttons of this type.
The SECTwoPartBtn class constructs a button that splits its functionality into two parts. The two parts of the button are independent. The Undo/Redo buttons in Visual Studio and MS Word are examples of two part buttons. The left side is a button. The right side part can perform actions such as displaying a drop-down list.
When the toolbar containing the button is vertically docked, only the left side of the button is displayed.
Use the TWOPART_BUTTON in your button map to create buttons of this type.
SECTBTextBtn is a specialized class that allows you to display text in toolbar buttons when large buttons are displayed.
Use the TEXT_BUTTON or TEXT_BUTTON_EX macro in your button map to create buttons of this type.
The SECWndBtn class bridges the logic between a CWnd control and SECStdBtn. By multiply inheriting from a CWnd control and SECWndBtn, you can create new CWnd-derived button types. For more information, refer to “Creating New Button Types.”
The SECComboBtn class constructs a button that can function like a combo box that combines a list box and an edit control. It derives multiply from CComboBox and SECWndBtn. This inheritance gives it the functionality of a CComboBox and allows it to be embedded within an SECCustomToolBar.
When embedded in a vertically docked toolbar, the combo box is replaced with a simple button.
Use the COMBO_BUTTON macro in your button map to create buttons of this type.