SECWorkbookWnd Class

class SECWorkbookWnd: public SECMDIFrameWnd

The SECWorkbookWnd is a Windows multiple document interface (MDI) frame window that adds the capability to view the MDI child windows as worksheets in a workbook.

Defined in: SECWB.H

Comments

Tool tips are now present for workbook tab text that is partially or fully obscured. This is new with release 5.0 of Objective Toolkit.

SECWorkbookWnd inherits most of its functionality from SECMDIFrameWnd with the workbook viewing mode being an extension. This workbook view capability provides an alternative, tab-based user interface for managing multiple documents. An SECWorkbookWnd-based application can operate in either normal or workbook mode, and the user can switch between these modes at runtime. In normal mode, the application appears and functions exactly like an MDI application. In workbook mode, the MDI child windows are presented as a collection of worksheets with cascaded tabs for navigation (i.e., selecting a tab activates the associated MDI child window).

When the workbook mode is switched on, the MDICLIENT window is resized to provide room for tabs to be drawn. One tab is drawn for each MDI child window. In the description of the class’s operations given below, it is important to note that a worksheet and an MDI child window are one and the same, since  SECWorksheetWnd is derived from  SECMDIChildWnd.

NOTE: Workbook mode can be in effect without maximizing the MDI child windows.

To create a workbook-based application, derive the CMainFrame class (or your equivalent class) from SECWorkbookWnd instead of CMDIFrameWnd. In addition, add a "Workbook" item on the "View" menu, and map its command and update handlers to OnViewWorkbook and OnUpdateViewWorkbook, respectively.

For example, your CMainFrame class message map would have the following entries:

BEGIN_MESSAGE_MAP(CMainFrame, SECWorkbookWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_VIEW_WORKBOOK, OnViewWorkbook)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

Adding "workbook" handlers to your pulldown menus is optional. The user can just hardcode the workbook to be always on.

See the WORKBPAD sample in the \SAMPLES\TOOLKIT\STANDARD\MDI\WORKBPAD directory for a demonstration of this class.

See Also

SECWorksheetWnd

Class Members

Protected Members

Overrideables

virtual void  AddSheet(SECWorksheetWnd* pSheet)

Adds a new worksheet to the workbook

virtual void  RemoveSheet(SECWorksheetWnd* pSheet)

Removes the specified worksheet from the workbook

virtual const TCHAR*  GetTabLabel(SECWorksheetWnd* pSheet) const

Gets the label associated with the tab

virtual void  OnDrawTab(CDC* pDC, SECWorksheetWnd* pSheet)

Draws a blank tab at the position specified

virtual void  OnDrawTabIconAndLabel(CDC* pDC, SECWorksheetWnd* pSheet)

Renders the icon and tab label on top of the blank tab drawn by OnDrawTab()

Public Members

Operations

void  SetWorkbookMode(BOOL bEnabled = TRUE)

Toggles between Workbook and Normal modes

void  SetShowIcons(BOOL bShowIcons = TRUE)

Sets display of icons

virtual HICON  GetTabIcon(SECWorksheetWnd* pSheet) const

Returns the icon to be drawn on the tab

virtual BOOL  SetTabIcon(SECWorksheetWnd* pSheet,HICON hIcon,BOOL bRedraw=TRUE)

Sets an icon to be drawn on the tab

void SetFlatStyleMode(BOOL bFlatStyle = TRUE)

Sets display of icons

Queries

BOOL  LookupSheet(SECWorksheetWnd* pSheet, int& nIndex)

Looks up the specified worksheet in the workbook

SECWorksheetWnd*  GetWorksheet(int nSheet) const

Returns a pointer to the worksheet specified in the index

int  GetSheetCount() const

Returns a count of the total number of worksheets