home *** CD-ROM | disk | FTP | other *** search
- #ifndef _INOTEBOOK_
- #define _INOTEBOOK_
- /*******************************************************************************
- * FILE NAME: inotebk.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * Inotebk - This class creates and manages the notebook control window. *
- * *
- * NOTES: *
- * 1. This class is used in conjunction with IPage. *
- * 2. Methods that have a 0 default for an IPage *
- * pointer will use the top page as the default. *
- * 3. When a pages is removed from a notebook, the IPage *
- * object still exists... However, the following data *
- * (normally maintained by the notebook) is lost: *
- * - status text (or length) *
- * - tab text (or length) *
- * - tab bitmap *
- * Therefore, removing a page from a notebook, and adding *
- * it back again currently requires that the user reset the *
- * bitmap, status and tab text. *
- * *
- * DESIGN NOTES: *
- * *
- * 1. We should probably add the capability to use the same *
- * PM window for multiple PageWindows. Currently, to do *
- * this, the user would have to re-implement the method *
- * handleIt(IControlEvent) for the notification message *
- * BKM_PAGESELECTED. Whenever receiving this message, he *
- * can create the PM window for the new top page, if *
- * necessary. *
- * *
- * 2. May want to add capability for user to use the same PM *
- * window on multiple pages of the notebook. Then, on *
- * every BKM_PAGESELECTED they would have to paint the *
- * window with the appropriate data for the new top page. *
- * *
- * 3. Might want to add a method "movePage()" to change the *
- * placement of a page in the notebook. *
- * *
- * COPYRIGHT: *
- * Licensed Materials - Property of IBM *
- * (C) Copyright IBM Corporation 1992, 1993 *
- * All Rights Reserved *
- * US Government Users Restricted Rights - Use, duplication, or disclosure *
- * restricted by GSA ADP Schedule Contract with IBM Corp. *
- * *
- * $Log: R:/IBMCLASS/IBASECTL/VCS/INOTEBK.HPV $
- //
- // Rev 1.3 25 Oct 1992 17:05:40 nunn
- //changed library name to ICLUI
- //
- // Rev 1.2 25 Oct 1992 10:55:32 boezeman
- //Add documentation and converted file to skeleton.hpp format.
-
- Rev 1.3 26 Feb 1992 21:17:36 Ken Fichthorn
- Fix order of constructor parms
-
- Rev 1.2 30 Oct 1991 20:55:52 Ken Fichthorn
- Palo Alto design changes.
-
- Rev 1.1 11 Aug 1991 19:02:08 Mike K. Chan
- Original entry.
- *******************************************************************************/
- // Forward declarations for other classes:
- class INoteBook;
- class IPage;
- #include "icontrol.hpp"
- #include "irect.hpp"
-
- /* These constants are used in method "setNoteBookColor" */
- /* They specify the region of the notebook whose color is to be changed. */
- /* They were necessary because the constants defined by PM were in */
- /* conflict. */
- /* */
- const unsigned long IC_NB_STATUSTEXT = (100L + 2L);
- const unsigned long IC_NB_BACKGROUND = (100L + 4L);
- const unsigned long IC_NB_SELECTIONCURSOR = (100L + 6L);
- const unsigned long IC_NB_BORDER = (100L + 14L);
- const unsigned long IC_NB_PAGEBACKGROUND = 0x0001;
- const unsigned long IC_NB_MAJORBACKGROUND = 0x0003;
- const unsigned long IC_NB_MINORBACKGROUND = 0x0005;
- const unsigned long IC_NB_MAJORTEXT = 0x0007;
- const unsigned long IC_NB_MINORTEXT = 0x0009;
-
-
- class INoteBook : public IControl {
- /*******************************************************************************
- * This class creates and manages the notebook control window. *
- * *
- * To use this class, create an instance of this class as follows: *
- * #include <inotebk.hpp> *
- * INoteBook *pnbkMyBook; *
- * pnbkMyBook = new INoteBook( this, ID_MYBOOK, *
- * IRectangle(IPoint(50,15), *
- * ISize(425,225))); *
- * pnbkMyBook->setMajorTabSize( ISize(50,23) ); *
- * pnbkMyBook->setMinorTabSize( ISize(90,45) ); *
- * ppgMyPage = new IPage( pnbkMyBook, *
- * BKA_MAJOR | IC_DEFAULTPAGESTYLE); *
- * ppgMyPage->setTabText( (char *)"My Tab Text" ); *
- * sprintf(msgstr, (char *)"Status text for page %d", lCount); *
- * ppgMyPage->setStatusText( msgstr ); *
- * ppgMyPage->create(FID_CLIENT, rectZero); *
- * *
- * EXAMPLE: *
- * <sample code> *
- *******************************************************************************/
- typedef IControl
- Inherited;
- friend class IPage;
-
- public:
- INESTEDBITFLAGCLASSDEF2(Style, INoteBook, IWindow, IControl);
- // style class definition
- static const Style
- spiralBind,
- solidBind,
- backPagesBottomRight,
- backPagesBottomLeft,
- backPagesTopRight,
- backPagesTopLeft,
- majorTabRight,
- majorTabLeft,
- majorTabTop,
- majorTabBottom,
- squareTabs,
- roundedTabs,
- polygonTabs,
- statusTextLeft,
- statusTextRight,
- statusTextCenter,
- tabTextLeft,
- tabTextRight,
- tabTextCenter;
- static const Style&
- defaultStyle;
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are 3 ways to construct instances of this class: |
- | 1. default |
- | 2. From a Dialog Template |
- | 3. From a Window |
- ------------------------------------------------------------------------------*/
- INoteBook(unsigned long ulId,
- const IWindow* pwndParent,
- const IWindow* pwndOwner,
- const IRectangle& rectInit,
- Style nbs = defaultStyle);
- INoteBook(unsigned long ulId,
- const IWindow* pwndParent);
-
- INoteBook(IWindowHandle wh);
- virtual
- ~INoteBook();
-
- /*-------------------------------- PAGES OPERATIONS ----------------------------
- | removePage - returns the three state control default style setting |
- | removeAllPages - sets the three state control default style |
- | removeTabSection- sets the three state control default style |
- ------------------------------------------------------------------------------*/
- void
- removePage( IPage* ppgPage = 0),
- removeAllPages(),
- removeTabSection( IPage* ppgTabPage = 0);
-
- /*-------------------------------- SIZE OPERATIONS -----------------------------
- | setMajorTabSize - Sets the size (in pixels) of the notebook's major tabs. |
- | setMinorTabSize - Sets the size (in pixels) of the notebook's minor tabs. |
- | setPageButtonSize-Sets the size (in pixels) of the arrow buttons used to |
- | turn the pages of the notebook. |
- ------------------------------------------------------------------------------*/
- void
- setMajorTabSize(const ISize& sizeMajorTab),
- setMinorTabSize(const ISize& sizeMinorTab),
- setPageButtonSize(const ISize& sizePageButton);
-
- /*-------------------------------- COLOR OPERATION -----------------------------
- | setNoteBookColor- Sets the color of the various regions of the notebook control|
- ------------------------------------------------------------------------------*/
- void
- setNoteBookColor(unsigned long ulColor, unsigned long ulColorRegion);
-
- /*-------------------------------- PAGE OPERATIONS -----------------------------
- | pageSize - Returns the maximum size for a page's window to fit in the page |
- | area of the notebook control. |
- | page - Returns the page object with the specified page id. |
- | turnToPage - Sets the specified page to be displayed as the top page. |
- | topPage - Returns the page object of the top page. |
- ------------------------------------------------------------------------------*/
- ISize
- pageSize() const; // get size of notebook page window
- IPage*
- topPage() const;
- IPage*
- page( unsigned long ulPageId) const;
- void
- turnToPage( IPage* const ppgPage);
-
- /*-------------------------------- MISCELLANEOUS OPERATIONS --------------------
- | repaintTabs - Causes all of the tabs in the notebook to be repainted. |
- | isNoteBookEmpty - Queries if the notebook is empty(contains no pages). |
- ------------------------------------------------------------------------------*/
- void
- repaintTabs();
- Boolean
- isNoteBookEmpty() const;
-
- /*-------------------------------- ACCESSING OPERATIONS ------------------------
- | firstPage - Returns a pointer to the first page in the notebook. |
- | lastPage - Returns a pointer to the last page in the notebook. |
- | nextPage - Returns a pointer to the page that follows the specified |
- | page in the notebook. |
- | previousPage - Returns a pointer to the page that preceeds the specified |
- | page in the notebook. |
- ------------------------------------------------------------------------------*/
- IPage*
- firstPage( unsigned long ulPageType = 0) const;
- IPage*
- lastPage( unsigned long ulPageType = 0) const;
- IPage*
- nextPage( const IPage* ppgLocatorPage = 0,
- unsigned long ulPageType = 0) const;
- IPage*
- previousPage( const IPage* ppgLocatorPage = 0,
- unsigned long ulPageType = 0) const;
-
- /*-------------------------------- PAGE NUMBER OPERATIONS ----------------------
- | pageCountToNextMajor - Returns the number of pages from the specified page |
- | to the next major tab page. |
- | pageCountToNextMinor - Returns the number of pages from the specified page |
- | to the next minor tab page. |
- | pageCountToEnd - Returns the number of pages from the specified page |
- | to the last page of the notebook. |
- | pageCount - Returns the total number of pages in the notebook. |
- | majorTabCount - Returns the total number of major tab pages in the |
- | notebook. |
- | minorTabCount - Returns the total number of minor tab pages in the |
- | major section specified. |
- ------------------------------------------------------------------------------*/
- long
- pageCountToNextMajor( const IPage* ppgPage = 0) const,
- pageCountToNextMinor( const IPage* ppgPage = 0) const,
- pageCountToEnd( const IPage* ppgPage = 0) const,
- pageCount() const, // Total number of pages in notebook
- majorTabCount() const,
- minorTabCount( const IPage* const ppgMajorTab = 0) const;
-
- protected:
- static Style
- classDefaultStyle;
-
- private :
- /*--------------------------------- PRIVATE ----------------------------------*/
- /*****************************************************************/
- /* Methods for inserting a page into the notebook at the front, */
- /* the end, or before/after a specified "locator page". */
- /*****************************************************************/
- void
- addPageLast( IPage* const ppgNewPage),
- addPageFirst( IPage* const ppgNewPage),
- addPageBefore( IPage* const ppgNewPage,
- const IPage* const ppgLocatePage = 0),
- addPageAfter( IPage* const ppgNewPage,
- const IPage* const ppgLocatePage = 0),
- addPage( IPage* const ppgNewPage,
- unsigned long ulOrder,
- const IPage* const ppgLocatePage);
-
- /*****************************************************************/
- /* Method containing code common to both the constructors. */
- /*****************************************************************/
- void
- constructStuff();
-
- };
-
- INESTEDBITFLAGCLASSFUNCS(Style, INoteBook);
-
- #endif