SECCustomToolBar Class
class SECCustomToolBar: public SECControlBar
Use SECCustomToolBar to create customizable toolbars from scratch to enhance your application.
Defined in: tbarcust.h
Comments
Each toolbar can be assigned a set of buttons in a style geared toward a particular task. For example, one set of buttons could be for common File operations; another set might represent a user-defined task. From Customize dialogs, the user can add or delete buttons and set their style from default or custom categories. Through the toolbar dialog, the user can choose between large or small buttons, tooltips enabled or disabled, and conventional appearance or the new cool look. Once the button has been selected, it can be dragged to any toolbar. It is also possible to drag and drop buttons between toolbars.
Although SECCustomToolBar can be used as a replacement for CToolBar, it works best when used in conjunction with SECToolBarManager.
To correctly use customizable toolbars, the base class of the frame window in which the toolbars are created must be derived from SECFrameWnd or an SECFrameWnd derivative.
While dragging a toolbar, the Ctrl key can be pressed to prevent docking. Thus, the toolbar can float anywhere on the desktop; however, if docked, it acquires a gripper that makes it easy to move. The visibility of a toolbar can be toggled on and off to indicate active or inactive states.
Because this class 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.
(NOTE: No CControlBars are allowed when using Objective Toolkit’s docking window enhancements, as they lack the member variables required to perform the sizing calculations.)
See the sample TOOLBAR in the \SAMPLES\TOOLKIT\STANDARD\DOCKING\TOOLBAR directory for a demonstration of this class.
See Also
SECControlBar SECToolBarManager SECToolBarSheet SECToolBarCmdPage
SECToolBarsDlg SECDialogBar SECToolBarsPage SECToolBar SECStdBtn
Class Members
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, UINT nID,DWORD dwStyle, DWORD dwExStyle, const RECT& rect, CWnd* pParentWnd = NULL,CCreateContext* pContext = NULL)
Creates the child window for the customizable toolbar and attaches it to an SECCustomToolBar object.
virtual BOOL CreateEx(DWORD dwExStyle, CWnd* pParentWnd, DWORD dwStyle = WS_VISIBLE | WS_CHILD | CBRS_TOP, UINT nID = AFX_IDW_TOOLBAR, LPCTSTR lpszTitle = NULL)
Creates a customizable toolbar with extended style attributes.
virtual void SetBarInfoEx(SECControlBarInfo* pInfo, CFrameWnd* pFrameWnd)
Saves the toolbar configuration
void SetButtonStyle(int nIndex, UINT nStyle)
Sets the style of a button.
UINT GetButtonStyle(int nIndex) const
Gets the style of a button.
virtual BOOL RemoveButton(int nIndex, BOOL bNoUpdate = FALSE)
Removes a button from the toolbar
virtual void AddButton(int nIndex, int nID, BOOL bSeparator = FALSE,BOOL bNoUpdate = FALSE)
Adds a button to the toolbar.
inline int GetBtnCount() const
Returns number of buttons on toolbar.
inline BOOL InConfigMode() const
Returns TRUE if toolbar is in customize mode.
inline BOOL InAltDragMode() const
Returns TRUE when dragging with ALT key down (when not in customize mode).
int CommandToIndex(UINT nID) const
Returns the command ID for a given button index.
UINT GetItemID(int nIndex) const
Returns the command ID for a given button index.
int GetCurBtn() const
Returns the index of the currently active button.
virtual int IDToBmpIndex(UINT nID, HBITMAP* lphBmp)
Converts a command ID to an index in the bitmap button.
BOOL LoadToolBar(LPCTSTR lpszResourceName)
Loads a toolbar bitmap resource.
BOOL LoadBitmap(UINT nIDResource, const UINT* lpIDArray, int nIDCount)
tLoads a toolbar bitmap resource.
virtual BOOL SetButtons(const UINT* lpIDArray, int nIDCount)
Sets the buttons on the current toolbar.
void GetItemRect(int nIndex, LPRECT lpRect) const
Returns the rect of the given button index.
void InformBtns(UINT nID, UINT nCode, void* pData, BOOL bPass = FALSE)
Passes notification through to all buttons of nID.
virtual void BalanceWrap(int nRow, Wrapped* pWrap)
Balances the wrapping of the toolbar.
virtual BOOL GetDragMode() const
Returns TRUE if the default drag mode is add.
virtual BOOL AcceptDrop() const
Returns TRUE if the toolbar accepts dropped buttons.