Objective Toolkit : Chapter 6 Customizable Toolbars : The Customizable Toolbar Classes
The Customizable Toolbar Classes
The hierarchies of the customizable toolbar classes are as follows:
Figure 71 – Customizable Toolbar Class Hierarchies
SECCustomToolBar
SECCustomToolBar lets you create a custom toolbar to which you can assign a specialized set of buttons. You can add or remove buttons from your toolbar via the Customize dialog. You can also drag-and-drop toolbar buttons by pressing the <ALT> and dragging them. In addition, you can categorize a button by applying a style to it. For example, you could reserve one set of buttons for common File operations and another set for a user-defined task.
In the Toolbar dialog, you can choose from large or small buttons, enable or disable tool-tips, and select the standard appearance or the new cool look. Once a button is selected, you can drag it to any toolbar. You can also drag-and-drop buttons among toolbars.
When you are dragging a toolbar, you can press the <CTRL> key to prevent docking. This allows you to float the toolbar anywhere on the desktop. If you dock a toolbar, it acquires a gripper that makes it easy to move. You can show or hide a toolbar to indicate active or inactive states.
Because SECCustomToolBar inherits from SECControlBar, it includes support for sizing while docked, automatic stretching when resized, and a default context menu with facilities for adding and removing menu items. Although you can use SECCustomToolBar as a replacement for CToolBar, it works best when used in conjunction with SECToolBarManager.
SECToolBarManager
The SECToolBarManager class manages customizable toolbars and the state of an application’s main frame during customize mode, as invoked by SECToolBarsDlg, SECToolBarsPage, and SECToolBarCmdPage. This mode allows the user to create custom toolbars with buttons that are specific to a certain task.
In particular, SECToolBarManager performs the following functions:
Administrates all SECCustomToolBar objects.
Creates/Destroys toolbars.
Loads and maintains toolbar bitmap(s).
Provides utility access to all toolbars.
Provides a framework for the persistent state from the SECControlBarManager base class (introduced in “SECControlBarManager”).
Because customizable toolbars are derived from SECControlBar, you cannot attach an SECCustomToolbar to an existing CToolBar/SECToolBar. Instead, you must utilize the toolbar manager (SECToolBarManager) to create and maintain the bars.
SECToolBarsBase
SECToolBarsBase provides the common code base for SECToolBarsDlg and SECToolBarsPage, which provide a user interface for listing and manipulating all of the toolbars. In the toolbar dialog, the user can choose from large or small buttons, enable or disable tooltips, and select a look for the application. SECToolBarsBase is a protected class. Because its constructor is hidden, this class cannot be instantiated directly.
SECToolBarsDlg
SECToolBarsDlg displays a list of toolbars and allows the user to manipulate these toolbars. SECToolBarsDlg implements the Customize dialog, which you can use to create a customized toolbar with buttons designed to perform particular tasks. On the toolbar dialog, you can choose from large or small buttons, enable or disable tooltips, and select a look for the toolbars.
SECNewToolBar
SECNewToolBar constructs the New Toolbar dialog. This dialog is invoked from within the Customize dialog, which you can use to create a toolbar comprised of buttons designed to perform a particular task. Typically, SECToolBarsDlg and SECToolBarsPage use SECNewToolBar to lay the foundation for the Customize and New Toolbar dialogs. This class also prompts you to enter the title of the new toolbar.
SECToolBarsPage
SECToolBarsPage constructs a toolbar property page for the Customize dialog implemented by SECToolBarsDlg. This dialog displays a list of toolbars that you can manipulate. In the Toolbar dialog, you choose from large or small buttons, enable or disable tooltips, and select a look for your toolbars.
SECToolBarCmdPage
The SECToolBarCmdPage class presents you with all the available toolbar buttons. You can drag these buttons onto an existing toolbar or create a new toolbar from them. You can only use SECToolBarCmdPage in an SECToolBarSheet. Do not try to use it directly in a CPropertySheet. Use the DefineBtnGroup() function to define at least one button group. SECToolBarCmdPage must be used in conjunction with a toolbar manager.
SECToolBarSheet
The SECToolBarSheet class constructs a property sheet that you can use with the toolbar button templates created by the SECToolBarCmdPage and SECToolBarsPage. SECToolBarSheet supports the Customize dialog, which you can use to create a toolbar comprised of buttons designed to perform a particular task. This dialog displays a list of toolbars that can be manipulated. In the Toolbar dialog, you choose from large or small buttons, enable or disable tooltips, and select a look for your toolbars.