home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / INOTEBK.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  43KB  |  789 lines

  1. #ifndef _INOTEBK_
  2.   #define _INOTEBK_
  3. /*******************************************************************************
  4. * FILE NAME: inotebk.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IPageHandle - This class represents a page in a notebook control.        *
  9. *     INotebook - This class creates and manages the notebook control window.  *
  10. *     INotebook::Cursor - This class is a search cursor for notebook pages.    *
  11. *     INotebook::PageSettings - Contains information for a page in a notebook  *
  12. *                               or for a page to be added to a notebook.       *
  13. *                                                                              *
  14. * COPYRIGHT:                                                                   *
  15. *   Licensed Materials - Property of IBM                                       *
  16. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  17. *   All Rights Reserved                                                        *
  18. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  19. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  20. *                                                                              *
  21. *******************************************************************************/
  22. // Forward declarations for other classes:
  23. class IResourceId;
  24. class ITabBitmapMgr;
  25.  
  26. #ifndef _ICONTROL_
  27.   #include <icontrol.hpp>
  28. #endif
  29. #ifndef _IRECT_
  30.   #include <irect.hpp>
  31. #endif
  32. #ifndef _ISTRING_
  33.   #include <istring.hpp>
  34. #endif
  35.  
  36. /*----------------------------------------------------------------------------*/
  37. /* Align classes on four byte boundary.                                       */
  38. /*----------------------------------------------------------------------------*/
  39. #pragma pack(4)
  40.  
  41. /*----------------------------------------------------------------------------*/
  42. /* Turn off warning for compiler generated copy/assignment                    */
  43. /*----------------------------------------------------------------------------*/
  44. #pragma info(nocpy)
  45.  
  46. class IPageHandle : public IHandle {
  47. typedef IHandle
  48.   Inherited;
  49. /*******************************************************************************
  50. * The IPageHandle class represents a page in a notebook and instances are      *
  51. * only intended to be constructed by a notebook.  An IPageHandle is returned   *
  52. * by a notebook when a page is added to the notebook (the page handle          *
  53. * represents a new page) or when a page is queried (such as from a call to     *
  54. * the INotebook::first function).  You can use an IPageHandle object to        *
  55. * identify a page, just as you can with an INotebook::Cursor cursor object.    *
  56. *******************************************************************************/
  57. public:
  58. /*------------------------------- Constructor ----------------------------------
  59. | Objects of this class are constructed from a page identifier (a value of     |
  60. | type IHandle::Value), defaulting to 0.                                       |
  61. ------------------------------------------------------------------------------*/
  62.   IPageHandle ( Value pageId = 0 );
  63.  
  64. }; // class IPageHandle
  65.  
  66.  
  67. class INotebook : public IControl {
  68. typedef IControl
  69.   Inherited;
  70. /*******************************************************************************
  71. * The INotebook class is used to create and manage a notebook control.  Two    *
  72. * classes are scoped to this class.  The scoped PageSettings class is used to  *
  73. * define the characteristics of a page when adding it to a notebook.  The      *
  74. * scoped Cursor class is used to traverse the pages of the notebook.           *
  75. *******************************************************************************/
  76. public:
  77. /*--------------------- Style ---------------------------------------------
  78.   The following functions provide a means to set and query notebook styles:
  79.  
  80.     Style - Nested class that provides static members that define the set of
  81.             valid notebook styles.  These styles can be used in conjunction
  82.             with the styles defined by the nested classes IWindow::Style and
  83.             IControl::Style.  For example, you could define an instance of
  84.             the INotebook::Style class and initialize it like:
  85.               INotebook::Style
  86.                 style = INotebook::roundedTabs | IControl::tabStop;
  87.             An object of this type is provided when the notebook is created.
  88.             A customizable default is used if no styles are specified.  Once
  89.             the object is constructed, INotebook, IWindow, and IControl
  90.             member functions can be used to set or query the object's style.
  91.  
  92.             The declaration of the INotebook::Style nested class is
  93.             generated by the INESTEDBITFLAGCLASSDEF2 macro.
  94.  
  95.   The valid notebook styles are:
  96.     classDefaultStyle    - Original default style for this class, which is
  97.                            squareTabs | solidBinding | statusTextLeft |
  98.                            tabTextCenter | backPagesBottomRight |
  99.                            majorTabsRight | IWindow::visible.
  100.     spiralBinding        - A spiral binding is drawn on the notebook.
  101.     solidBinding         - A solid binding is drawn.  This is the default.
  102.     backPagesBottomRight - The back pages of the notebook are drawn behind
  103.                            the bottom right corner of the notebook.  This
  104.                            is the default.
  105.     backPagesBottomLeft  - The back pages of the notebook are drawn behind
  106.                            the bottom left corner of the notebook.
  107.     backPagesTopRight    - The back pages of the notebook are drawn behind
  108.                            the top right corner of the notebook.
  109.     backPagesTopLeft     - The back pages of the notebook are drawn behind
  110.                            the top left corner of the notebook.
  111.     majorTabsRight       - The major tabs of the notebook are drawn on the
  112.                            right side of the notebook. This is the default.
  113.     majorTabsLeft        - The major tabs of the notebook are drawn on the
  114.                            left side of the notebook.
  115.     majorTabsTop         - The major tabs of the notebook are drawn on the
  116.                            top side of the notebook.
  117.     majorTabsBottom      - The major tabs of the notebook are drawn on the
  118.                            bottom side of the notebook.
  119.     squareTabs           - Tabs are drawn with square corners.  This is the
  120.                            default.
  121.     roundedTabs          - Tabs are drawn with rounded corners.
  122.     polygonTabs          - Tabs are drawn with polygon corners.
  123.     statusTextLeft       - The text in the status line is left-justified.
  124.                            This is the default.
  125.     statusTextRight      - The text in the status line is right-justified.
  126.     statusTextCenter     - The text in the status line is centered.
  127.     tabTextCenter        - The text in the tabs is centered.  This is the
  128.                            default.
  129.     tabTextLeft          - The text in the tabs is left-justified.
  130.     tabTextRight         - The text in the tabs is right-justified.
  131.  
  132.   The following functions provide a means of getting and setting the default
  133.   style for this class:
  134.     defaultStyle    - Returns the current default style.  This is the same as
  135.                       classDefaultStyle unless setDefaultStyle has been
  136.                       called.
  137.     setDefaultStyle - Sets the default style for all subsequent notebooks.
  138. -------------------------------------------------------------------------*/
  139. INESTEDBITFLAGCLASSDEF2(Style, INotebook, IWindow, IControl);
  140.                                     // style class definition
  141. static const Style
  142.   classDefaultStyle,
  143.   spiralBinding,
  144.   solidBinding,
  145.   backPagesBottomRight,
  146.   backPagesBottomLeft,
  147.   backPagesTopRight,
  148.   backPagesTopLeft,
  149.   majorTabsRight,
  150.   majorTabsLeft,
  151.   majorTabsTop,
  152.   majorTabsBottom,
  153.   squareTabs,
  154.   roundedTabs,
  155.   polygonTabs,
  156.   statusTextLeft,
  157.   statusTextRight,
  158.   statusTextCenter,
  159.   tabTextLeft,
  160.   tabTextRight,
  161.   tabTextCenter;
  162.  
  163. static Style
  164.   defaultStyle    ( );
  165.  
  166. static void
  167.   setDefaultStyle ( const Style& style );
  168.  
  169. /*------------------------ Constructors ----------------------------------------
  170. | You can create an instance of this class in the following ways:              |
  171. |    - From a control ID, parent and owner windows, rectangle, and style.      |
  172. |      This creates the specified notebook control and an object for it.       |
  173. |    - From the ID of a notebook control on a dialog window.  This creates     |
  174. |      the object for the specified notebook control.                          |
  175. |    - From the window handle of an existing notebook control.  This creates   |
  176. |      the object for the specified notebook control.                          |
  177. ------------------------------------------------------------------------------*/
  178.   INotebook   ( unsigned long        windowId,
  179.                 IWindow*             parent,
  180.                 IWindow*             owner,
  181.                 const IRectangle&    initial = IRectangle(),
  182.                 const Style&         style = defaultStyle() );
  183.   INotebook   ( unsigned long        windowId,
  184.                 IWindow*             parentAndOwner );
  185.   INotebook   ( const IWindowHandle& handle );
  186.  
  187. virtual
  188.   INotebook :: ~INotebook ( );
  189.  
  190. /*------------------------- Enumerations ---------------------------------------
  191. | The following enumerations are defined:                                      |
  192. |   Orientation   - Enumeration defines the location of the back page's corner |
  193. |                   and the major tabs.  The values are:                       |
  194. |                     backpagesBottomTabsRight - Back pages on the bottom      |
  195. |                                                right corner and the major    |
  196. |                                                tabs on the right side of     |
  197. |                                                the notebook.                 |
  198. |                     backpagesTopTabsRight    - Back pages on the top right   |
  199. |                                                corner and the major tabs on  |
  200. |                                                the right side of the         |
  201. |                                                notebook.                     |
  202. |                     backpagesBottomTabsLeft  - Back pages on the bottom      |
  203. |                                                left corner and the major     |
  204. |                                                tabs on the left side of the  |
  205. |                                                notebook.                     |
  206. |                     backpagesTopTabsLeft     - Back pages on the top left    |
  207. |                                                corner and the major tabs on  |
  208. |                                                the left side of the          |
  209. |                                                notebook.                     |
  210. |                     backpagesRightTabsTop    - Back pages on the top right   |
  211. |                                                corner and the major tabs on  |
  212. |                                                the top side of the notebook. |
  213. |                     backpagesLeftTabsTop     - Back pages on the top left    |
  214. |                                                corner and the major tabs on  |
  215. |                                                the top side of the notebook. |
  216. |                     backpagesRightTabsBottom - Back pages on the bottom      |
  217. |                                                right corner and the major    |
  218. |                                                tabs on the bottom side of    |
  219. |                                                the notebook.                 |
  220. |                     backpagesLeftTabsBottom  - Back pages on the bottom      |
  221. |                                                left corner and the major     |
  222. |                                                tabs on the bottom side of    |
  223. |                                                the notebook.                 |
  224. |                                                                              |
  225. |   TabShape      - Enumeration that defines the shape of the notebook tabs.   |
  226. |                   The values are:                                            |
  227. |                     square  - Draws the tabs with square corners.            |
  228. |                     rounded - Draws the tabs with rounded corners.           |
  229. |                     polygon - Draws the tabs with polygon corners.           |
  230. |                                                                              |
  231. |   TextAlignment - Enumeration that defines the alignment for the text in     |
  232. |                   the status line and in the tabs.  The values are:          |
  233. |                     left   - Left-justifies the text.                        |
  234. |                     right  - Right-justifies the text.                       |
  235. |                     center - Centers the text.                               |
  236. |                                                                              |
  237. |   Binding       - Enumeration that defines the binding for the notebook.     |
  238. |                   The values are:                                            |
  239. |                     spiral - Draws a spiral binding for the notebook.        |
  240. |                     solid  - Draws a solid binding for the notebook.         |
  241. ------------------------------------------------------------------------------*/
  242. enum Orientation {
  243.   backpagesBottomTabsRight,
  244.   backpagesTopTabsRight,
  245.   backpagesBottomTabsLeft,
  246.   backpagesTopTabsLeft,
  247.   backpagesRightTabsTop,
  248.   backpagesLeftTabsTop,
  249.   backpagesRightTabsBottom,
  250.   backpagesLeftTabsBottom
  251. };
  252.  
  253. enum TabShape {
  254.   square,
  255.   rounded,
  256.   polygon
  257. };
  258.  
  259. enum TextAlignment {
  260.   left,
  261.   right,
  262.   center
  263. };
  264.  
  265. enum Binding {
  266.   spiral,
  267.   solid
  268. };
  269.  
  270. /*--------------------------- Style Functions ----------------------------------
  271. | The following functions provide a means of changing the notebook's styles:   |
  272. |   setBinding             - Sets the type of binding with which the           |
  273. |                            notebook will be drawn.                           |
  274. |   setOrientation         - Sets the type of orientation of the notebook,     |
  275. |                            which is the location of the major tabs and back  |
  276. |                            pages.                                            |
  277. |   setTabShape            - Sets the shape of the notebook's tabs.            |
  278. |   setStatusTextAlignment - Sets the alignment of the text in the notebook's  |
  279. |                            status line.                                      |
  280. |   setTabTextAlignment    - Sets the alignment of the text in the notebook's  |
  281. |                            tabs.                                             |
  282. |                                                                              |
  283. | The following functions provide a means of querying the notebook's styles:   |
  284. |   binding             - Returns the type of binding used for the notebook.   |
  285. |   orientation         - Returns the current orientation of the notebook,     |
  286. |                         which is the location of the major tabs and the      |
  287. |                         back pages.                                          |
  288. |   tabShape            - Returns the shape of the notebook's tabs.            |
  289. |   statusTextAlignment - Returns the alignment of the text in the notebook's  |
  290. |                         status line.                                         |
  291. |   tabTextAlignment    - Returns the alignment of the text in the notebook's  |
  292. |                         tabs.                                                |
  293. ------------------------------------------------------------------------------*/
  294. virtual INotebook
  295.  &setBinding              ( Binding       binding ),
  296.  &setOrientation          ( Orientation   orientation ),
  297.  &setTabShape             ( TabShape      tabShape ),
  298.  &setStatusTextAlignment  ( TextAlignment alignment ),
  299.  &setTabTextAlignment     ( TextAlignment alignment );
  300.  
  301. virtual Binding
  302.   binding                 ( ) const;
  303. virtual Orientation
  304.   orientation             ( ) const;
  305. virtual TabShape
  306.   tabShape                ( ) const;
  307. virtual TextAlignment
  308.   statusTextAlignment     ( ) const,
  309.   tabTextAlignment        ( ) const;
  310.  
  311. /*-------------------------- Size Functions ------------------------------------
  312. | The following functions provide a means of changing the size of notebook's   |
  313. | parts:                                                                       |
  314. |   setMajorTabSize   - Sets the size of the notebook's major tabs, in pixels. |
  315. |   setMinorTabSize   - Sets the size of the notebook's minor tabs, in pixels. |
  316. |   setPageButtonSize - Sets the size of the arrow buttons used to turn the    |
  317. |                       notebook's pages, in pixels.                           |
  318. ------------------------------------------------------------------------------*/
  319. virtual INotebook
  320.  &setMajorTabSize   ( const ISize& sizeMajorTab ),
  321.  &setMinorTabSize   ( const ISize& sizeMinorTab ),
  322.  &setPageButtonSize ( const ISize& sizePageButton );
  323.  
  324. /*---------------------- Refresh Tab Function ----------------------------------
  325. | The following function provides a means of operating on a notebook's tabs:   |
  326. |   refreshTabs - Causes all of the notebook's tabs to be repainted.           |
  327. ------------------------------------------------------------------------------*/
  328. virtual INotebook
  329.  &refreshTabs       ( );
  330.  
  331. /*----------------------- Color Enumerations -----------------------------------
  332. | The following color enumerations are defined:                                |
  333. |   ColorArea - Enumeration that defines areas of the notebook that can be     |
  334. |               colored.  The values are:                                      |
  335. |                 pageBackground           - The page's background area.       |
  336. |                 majorTabBackground       - Background of the major tabs.     |
  337. |                 majorTabForeground       - Foreground of the major tabs.     |
  338. |                 minorTabBackground       - Background of the minor tabs.     |
  339. |                 minorTabForeground       - Foreground of the minor tabs.     |
  340. |                 notebookWindowBackground - Background of the notebook's      |
  341. |                                            window.                           |
  342. |                 notebookOutline          - Outline of the notebook.          |
  343. |                 statusLineText           - Text on the notebook's status     |
  344. |                                            line.                             |
  345. |                 selectionCursor          - The notebook's selection cursor.  |
  346. ------------------------------------------------------------------------------*/
  347. enum ColorArea {
  348.   pageBackground,
  349.   majorTabBackground,
  350.   majorTabForeground,
  351.   minorTabBackground,
  352.   minorTabForeground,
  353.   notebookWindowBackground,
  354.   notebookOutline,
  355.   statusLineText,
  356.   selectionCursor
  357. };
  358.  
  359. /*------------------------- Color Functions ------------------------------------
  360. | The following functions provide a means for setting and querying the color of|
  361. | different parts of the notebook:                                             |
  362. |   setColor - Sets the color of a part of the notebook.                       |
  363. |   color    - Queries the color of a part of the notebook.                    |
  364. ------------------------------------------------------------------------------*/
  365. virtual INotebook
  366.  &setColor        ( ColorArea      area,
  367.                     const IColor&  color );
  368. virtual IColor
  369.   color           ( ColorArea      area ) const;
  370.  
  371.  
  372. class PageSettings : public IVBase {
  373. typedef IVBase
  374.   Inherited;
  375. /*******************************************************************************
  376. * The INotebook::PageSettings nested class is used to identify information     *
  377. * about a page in the notebook.  PageSettings objects are typically created    *
  378. * as a means of defining pages' characteristics when adding them to a          *
  379. * notebook.  A PageSettings object can also be created to reflect the current  *
  380. * state of a page of the notebook.  The PageSettings only identifies the       *
  381. * characteristics of a notebook page at one point in time.  It is not updated  *
  382. * when the actual notebook page changes.  Also, changes to the PageSettings    *
  383. * are not reflected in the actual notebook page after the page is added to     *
  384. * the notebook.                                                                *
  385. *******************************************************************************/
  386. friend class INotebook;
  387. public:
  388. /*--------------- Attribute -----------------------------------------------
  389.   The INotebook::PageSettings::Attribute nested class provides static members that
  390.   define the set of valid notebook page attributes.  For example, you could
  391.   define an instance of the INotebook::Page::Attribute class and initialize
  392.   it like:
  393.               INotebook::PageSettings::Attribute
  394.                 attribute = INotebook::PageSettings::majorTab;
  395.   An object of this type is provided when the notebook page is created.
  396.  
  397.   The declaration of the INotebook::PageSettings::Attribute nested class is generated
  398.   by the INESTEDBITFLAGCLASSDEF0 macro.
  399.  
  400.   The valid notebook page attributes are:
  401.     autoPageSize - The notebook handles the positioning and sizing of the
  402.                    page.
  403.     statusTextOn - Specifies that the page will have a status line.
  404.     majorTab     - Specifies that the page will be associated with a major
  405.                    tab.
  406.     minorTab     - Specifies that the page will be associated with a minor
  407.                    tab.
  408.     noAttribute  - Specifies that no attribute applies to the notebook page.
  409. -------------------------------------------------------------------------*/
  410. INESTEDBITFLAGCLASSDEF0(Attribute, INotebook::PageSettings);
  411. static const Attribute
  412.   autoPageSize,
  413.   statusTextOn,
  414.   majorTab,
  415.   minorTab,
  416.   noAttribute;
  417.  
  418. /*------------------- Constructors ---------------------------------------------
  419. | You can construct instances of this class in the following ways:             |
  420. |    - Using the default.  Attribute is defined to be noAttribute, and all     |
  421. |      the other page settings values are set to NULL or 0.                    |
  422. |    - Using one or more page attributes.  All the other page settings are     |
  423. |      set to NULL or 0.                                                       |
  424. |    - Using the tab text, status text, and one or more attributes.  In this   |
  425. |      case, it is assumed that there is no bit map for this tab.              |
  426. |    - Using the tab bit map, status text, and one or more attributes.  In     |
  427. |      this case, it is assumed that there is no text for this tab.            |
  428. ------------------------------------------------------------------------------*/
  429.   PageSettings  ( );
  430.   PageSettings  ( Attribute            attribute );
  431.   PageSettings  ( const char*          tabText,
  432.                   const char*          statusText = 0,
  433.                   Attribute            pageAttribute = noAttribute );
  434.   PageSettings  ( const IBitmapHandle& tabBitmap,
  435.                   const char*          statusText = 0,
  436.                   Attribute            pageAttribute = noAttribute );
  437. virtual
  438.   PageSettings :: ~ PageSettings ( );
  439.  
  440.   PageSettings :: PageSettings (const INotebook::PageSettings&);
  441.  
  442. /*------------------- Page Settings Functions ----------------------------------
  443. | The following functions set and query the data associated with a PageSettings|
  444. | object:                                                                      |
  445. |   setStatusText - Sets the text of the status line associated with this      |
  446. |                   page.                                                      |
  447. |   setTabText    - Sets the text of the tab associated with this page.        |
  448. |   setTabBitmap  - Sets the bit map of the tab associated with this page.     |
  449. |   setUserData   - Sets the application data in the page's reserved storage.  |
  450. |   statusText    - Returns the text of the status line associated with this   |
  451. |                   page.                                                      |
  452. |   tabText       - Returns the text of the tab associated with this page.     |
  453. |   tabBitmap     - Returns the bit map of the tab associated with this page.  |
  454. |   userData      - Returns the application data in the page's reserved        |
  455. |                   storage.                                                   |
  456. | Once a PageSettings object has been used to insert a page in the notebook,   |
  457. | using these functions on the PageSettings object will have no effect on the  |
  458. | actual notebook; the corresponding notebook functions should be used         |
  459. | instead.  However, these functions could be used to update the PageSettings  |
  460. | object for defining a new notebook page.                                     |
  461. ------------------------------------------------------------------------------*/
  462. virtual INotebook::PageSettings
  463.  &setStatusText     ( const char*          statusText ),
  464.  &setStatusText     ( const IResourceId&   resourceId ),
  465.  &setTabText        ( const char*          tabText ),
  466.  &setTabText        ( const IResourceId&   resourceId ),
  467.  &setTabBitmap      ( const IBitmapHandle& bitmap ),
  468.  &setTabBitmap      ( const IResourceId&   resourceId ),
  469.  &setUserData       ( unsigned long        userData );
  470.  
  471. virtual IString
  472.   statusText        ( ) const,
  473.   tabText           ( ) const;
  474.  
  475. virtual IBitmapHandle
  476.   tabBitmap         ( ) const;
  477.  
  478. virtual unsigned long
  479.   userData          ( ) const;
  480.  
  481. /*-------------------------- Attribute Functions -------------------------------
  482. | The following functions test a page for the presence of certain attributes:  |
  483. |   isAutoSize     - Queries whether the page's size is handled by the         |
  484. |                    notebook.                                                 |
  485. |   isStatusTextOn - Queries whether a status line is associated with the      |
  486. |                    page.                                                     |
  487. |   isMajorTab     - Queries whether a major tab is associated with the page.  |
  488. |   isMinorTab     - Queries whether a minor tab is associated with the page.  |
  489. ------------------------------------------------------------------------------*/
  490. Boolean
  491.   isAutoSize       ( ) const,
  492.   isStatusTextOn   ( ) const,
  493.   isMajorTab       ( ) const,
  494.   isMinorTab       ( ) const;
  495.  
  496. private:
  497. /*--------------------------------- Private ----------------------------------*/
  498. Attribute
  499.   pageStyle;
  500. IBitmapHandle
  501.   savedTabBitmap;
  502. unsigned long
  503.   savedUserData;
  504. IString
  505.   savedStatusText,
  506.   savedTabText;
  507.  
  508. }; // INotebook::PageSettings
  509.  
  510.  
  511. class Cursor : public IVBase {
  512. typedef IVBase
  513.   Inherited;
  514. /*******************************************************************************
  515. * The INotebook::Cursor nested class defines objects that can be used to       *
  516. * traverse the pages of a notebook.  In the same way that a Cursor can be      *
  517. * used to traverse the objects in a Collection, this Cursor can be used to go  *
  518. * through a notebook, one page at a time.  The notebook's Cursor deals with    *
  519. * IPageHandles, each of which can be thought of as a pointer to a specific     *
  520. * page in the notebook.                                                        *
  521. *******************************************************************************/
  522. public :
  523. /*------------------- Constructors ---------------------------------------------
  524. | You can construct instances of this class with the notebook whose pages      |
  525. | this Cursor instance is going to traverse.                                   |
  526. ------------------------------------------------------------------------------*/
  527.   Cursor  ( const INotebook& notebook );
  528.  
  529. virtual
  530.   ~Cursor ( );
  531.  
  532. /*------------------------ Cursor Movement -------------------------------------
  533. | The following functions provide a means of moving the cursor position        |
  534. | within the notebook with which it is associated:                             |
  535. |   setToFirst    - Sets the cursor to point to the first page of the          |
  536. |                   notebook.                                                  |
  537. |   setToNext     - Sets the cursor to point to the next page of the notebook. |
  538. |   setToPrevious - Sets the cursor to point to the previous page of the       |
  539. |                   notebook.                                                  |
  540. |   setToLast     - Sets the cursor to point to the last page of the notebook. |
  541. ------------------------------------------------------------------------------*/
  542. virtual Boolean
  543.   setToFirst    ( ),
  544.   setToNext     ( ),
  545.   setToPrevious ( ),
  546.   setToLast     ( );
  547.  
  548. /*------------------------ Page Retrieval --------------------------------------
  549. | The following functions are used to retrieve pages:                          |
  550. |   first      - Points to the first page in the notebook and returns an       |
  551. |                IPageHandle object that points to the first notebook page.    |
  552. |   next       - Points to the next page in the notebook and returns an        |
  553. |                IPageHandle object that points to the next notebook page.     |
  554. |   previous   - Points to the previous page in the notebook and returns an    |
  555. |                IPageHandle object that points to the previous notebook page. |
  556. |   last       - Points to the last page in the notebook and returns an        |
  557. |                IPageHandle object that points to the last notebook page.     |
  558. |   current    - Returns an IPageHandle object for the notebook page to which  |
  559. |                the cursor currently points.                                  |
  560. |   setCurrent - Uses a specified IPageHandle to set the cursor to a           |
  561. |                particular notebook page.                                     |
  562. ------------------------------------------------------------------------------*/
  563. virtual IPageHandle
  564.   first      ( ),
  565.   next       ( ),
  566.   previous   ( ),
  567.   last       ( ),
  568.   current    ( ) const;
  569. void
  570.   setCurrent ( const IPageHandle& current );
  571.  
  572. /*--------------- Cursor Validation --------------------------------------------
  573. | The following functions are used to validate the cursor:                     |
  574. |   isValid    - Queries whether the cursor points to a valid item.            |
  575. |   invalidate - Flags this cursor as invalid.                                 |
  576. -------------------------------------------------------------------------------*/
  577. virtual Boolean
  578.   isValid    ( ) const;
  579. virtual void
  580.   invalidate ( );
  581.  
  582. private :
  583. /*--------------------------------- Private ----------------------------------*/
  584. const INotebook
  585.  &nbCl;
  586. unsigned long
  587.   ulClCurrentPageId;
  588. unsigned long
  589.   ulClReferences;
  590. }; // INotebook::Cursor
  591.  
  592.  
  593. /*-------------------------------- Page Operations -----------------------------
  594. | The following functions handle the manipulation of pages within a notebook:  |
  595. | NOTE: When adding an IFrameWindow as a notebook page, you should create an   |
  596. |       IFrameWindow with its parent as the notebook.  This applies to the     |
  597. |       addFirstPage, addLastPage, addPageAfter, and addPageBefore functions.  |
  598. |   addFirstPage     - Adds a window as the first page in the notebook using   |
  599. |                      settings specified in a PageSettings object.  If the    |
  600. |                      window pointer is NULL, a page with the indicated       |
  601. |                      settings, but no window, is added to the notebook.      |
  602. |   addLastPage      - Adds a window as the last page in the notebook using    |
  603. |                      settings specified in a PageSettings object.  If the    |
  604. |                      window pointer is NULL, a page with the indicated       |
  605. |                      settings, but no window, is added to the notebook.      |
  606. |   addPageAfter     - Adds a window to the notebook following the page        |
  607. |                      referenced by a Cursor or an IPageHandle using          |
  608. |                      settings specified in a PageSettings object.  If the    |
  609. |                      window pointer is NULL, a page with the indicated       |
  610. |                      settings, but no window, is added to the notebook.      |
  611. |   addPageBefore    - Adds a window to the notebook before the page           |
  612. |                      referenced by a Cursor or an IPageHandle using          |
  613. |                      settings specified in a PageSettings object.  If the    |
  614. |                      window pointer is NULL, a page with the indicated       |
  615. |                      settings, but no window, is added to the notebook.      |
  616. |   removePage       - Removes a specified page from the notebook.             |
  617. |   removeAllPages   - Removes all the pages in the notebook.                  |
  618. |   removeTabSection - If the page specified is a major tab page, removes the  |
  619. |                      specified page and all subsequent pages up to the next  |
  620. |                      major tab page.  If the page specified is a minor tab   |
  621. |                      page, removes the specified page and all subsequent     |
  622. |                      pages up to the next page that has a tab.               |
  623. |   turnToPage       - Moves a specified page to the top of the notebook.      |
  624. |   topPage          - Returns an IPageHandle object that references the       |
  625. |                      current top page of the notebook.                       |
  626. |   firstPage        - Returns an IPageHandle object that references the       |
  627. |                      first page in the notebook.                             |
  628. |   lastPage         - Returns an IPageHandle object that references the last  |
  629. |                      page in the notebook.                                   |
  630. |   nextPage         - Returns an IPageHandle object that references the page  |
  631. |                      following the specified IPageHandle.                    |
  632. |   previousPage     - Returns an IPageHandle object that references the page  |
  633. |                      before the specified IPageHandle.                       |
  634. |   window           - Returns the window associated with the specified        |
  635. |                      notebook page.                                          |
  636. |   pageSettings     - Returns an instance of the page settings.               |
  637. |   setStatusText    - Sets the status text for a specified page of the        |
  638. |                      notebook.                                               |
  639. |   setTabText       - Sets the tab text for a specified page of the notebook. |
  640. |   setTabBitmap     - Sets the tab bit map for a specified page of the        |
  641. |                      notebook.                                               |
  642. |   setUserData      - Sets the user data for a specified page of the          |
  643. |                      notebook.                                               |
  644. |   setWindow        - Associates the specified page with the window.          |
  645. ------------------------------------------------------------------------------*/
  646. virtual IPageHandle
  647.   addFirstPage      ( const PageSettings& pageInfo,
  648.                       IWindow*            window = 0 ),
  649.   addLastPage       ( const PageSettings& pageInfo,
  650.                       IWindow*            window = 0 ),
  651.   addPageBefore     ( const PageSettings& pageInfoToAdd,
  652.                       const IPageHandle&  referencePage,
  653.                       IWindow*            window = 0 ),
  654.   addPageAfter      ( const PageSettings& pageToAdd,
  655.                       const IPageHandle&  referencePage,
  656.                       IWindow*            window = 0 ),
  657.   addPageBefore     ( const PageSettings& pageInfo,
  658.                       const Cursor&       cursor,
  659.                       IWindow*            window = 0 ),
  660.   addPageAfter      ( const PageSettings& pageInfo,
  661.                       const Cursor&       cursor,
  662.                       IWindow*            window = 0 );
  663. virtual INotebook
  664.  &removePage        ( const IPageHandle&  page ),
  665.  &removePage        ( const Cursor&       cursor ),
  666.  &removeAllPages    ( ),
  667.  &removeTabSection  ( const IPageHandle&  page ),
  668.  &removeTabSection  ( const Cursor&       cursor ),
  669.  &turnToPage        ( const IPageHandle&  page ),
  670.  &turnToPage        ( const Cursor&       cursor );
  671.  
  672. virtual IPageHandle
  673.   topPage           ( ) const,
  674.   firstPage         ( ) const,
  675.   lastPage          ( ) const,
  676.   nextPage          ( const IPageHandle&  referencePage ) const,
  677.   previousPage      ( const IPageHandle&  referencePage ) const;
  678.  
  679. virtual IWindow
  680.  *window            ( const Cursor&       cursor ) const,
  681.  *window            ( const IPageHandle&  page ) const;
  682.  
  683. PageSettings
  684.   pageSettings      ( const Cursor&       cursor ) const,
  685.   pageSettings      ( const IPageHandle&  page ) const;
  686.  
  687. virtual INotebook
  688.  &setStatusText     ( const IPageHandle&   referencePage,
  689.                       const char*          statusText ),
  690.  &setStatusText     ( const IPageHandle&   referencePage,
  691.                       const IResourceId&   resourceId ),
  692.  &setTabText        ( const IPageHandle&   referencePage,
  693.                       const char*          tabText ),
  694.  &setTabText        ( const IPageHandle&   referencePage,
  695.                       const IResourceId&   resourceId ),
  696.  &setTabBitmap      ( const IPageHandle&   referencePage,
  697.                       const IBitmapHandle& bitmap ),
  698.  &setTabBitmap      ( const IPageHandle&   referencePage,
  699.                       const IResourceId&   resourceId ),
  700.  &setUserData       ( const IPageHandle&   referencePage,
  701.                       unsigned long        userData ),
  702.  &setWindow         ( const Cursor&        cursor,
  703.                             IWindow*       window = 0 ),
  704.  &setWindow         ( const IPageHandle&   referencePage,
  705.                             IWindow*       window = 0 );
  706.  
  707.  
  708. /*-------------------------- Number Functions ----------------------------------
  709. | The following functions provide number and size information for the          |
  710. | notebook:                                                                    |
  711. |   pageSize        - Returns the page's size.  All notebook pages have the    |
  712. |                     same size.                                               |
  713. |   notebookSize    - Returns the size that the notebook needs to be in order  |
  714. |                     to contain the page.                                     |
  715. |   totalPages      - Returns the number of pages in the notebook.             |
  716. |   pagesToMinorTab - Returns the number of pages in the notebook between a    |
  717. |                     specified page and the next page that has a minor tab.   |
  718. |   pagesToMajorTab - Returns the number of pages in the notebook between a    |
  719. |                     specified page and the next page that has a major tab.   |
  720. |   pagesToEnd      - Returns the number of pages in the notebook from a       |
  721. |                     specified page to the end of the notebook.  This value   |
  722. |                     includes the specified page.                             |
  723. |   isEmpty         - Queries whether the notebook has any pages.              |
  724. ------------------------------------------------------------------------------*/
  725. virtual ISize
  726.   pageSize        ( ) const,
  727.   notebookSize    ( const IPageHandle& page ) const;
  728.  
  729. virtual unsigned long
  730.   totalPages      ( ) const,
  731.   pagesToMajorTab ( const IPageHandle& page ) const,
  732.   pagesToMajorTab ( const Cursor&      cursor ) const,
  733.   pagesToMinorTab ( const IPageHandle& page ) const,
  734.   pagesToMinorTab ( const Cursor&      cursor ) const,
  735.   pagesToEnd      ( const IPageHandle& page ) const,
  736.   pagesToEnd      ( const Cursor&      cursor ) const;
  737.  
  738. virtual Boolean
  739.   isEmpty         ( ) const;
  740.  
  741. protected:
  742. /*----------------------------- Layout Size ------------------------------------
  743. | calcMinimumSize - Returns the minimum recommended size for this notebook.    |
  744. |                   This size is large enough to contain the largest page      |
  745. |                   window that is currently in the notebook.                  |
  746. ------------------------------------------------------------------------------*/
  747. virtual ISize
  748.   calcMinimumSize ( ) const;
  749.  
  750. private:
  751. /*--------------------------------- Private ----------------------------------*/
  752. static Style
  753.   currentDefaultStyle;
  754.  
  755. unsigned long
  756.   queryPage      ( void* mp1, void* mp2 ) const,
  757.   insertPage     ( void* mp1, void* mp2 );
  758. Boolean
  759.   deletePage     ( void* mp1, void* mp2 );
  760. short
  761.   queryPageCount ( void* mp1, void* mp2 ) const;
  762. IPageHandle
  763.   insertPageInfo ( const PageSettings& pageInfo,
  764.                    const IPageHandle&  referencePage,
  765.                    IWindow*            window,
  766.                    unsigned long       fPosition );
  767. ITabBitmapMgr
  768.   *bmClTabBitmapMgr;
  769. unsigned long
  770.   ulClValidate;
  771.  
  772. friend class INotebook::Cursor;
  773. }; // INotebook
  774.  
  775. INESTEDBITFLAGCLASSFUNCS(Style, INotebook);
  776.  
  777. /*----------------------------------------------------------------------------*/
  778. /* Resume compiler default packing and warning messages.                      */
  779. /*----------------------------------------------------------------------------*/
  780. #pragma pack()
  781. #pragma info(restore)
  782.  
  783. /*--------------------------------- Inlines ----------------------------------*/
  784. #ifndef I_NO_INLINES
  785.   #include <inotebk.inl>
  786. #endif
  787.  
  788. #endif /* _INOTEBK_ */
  789.