home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / ipagecur.hp_ / IPAGECUR.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  6.2 KB  |  119 lines

  1. #ifndef _IPAGECURSOR_
  2.   #define _IPAGECURSOR_
  3. /*******************************************************************************
  4. * FILE NAME: ipagecur.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     Ipagecur - This class is used to iterate through all of the pages of a   *
  9. *                notebook.                                                     *
  10. *                                                                              *
  11. * COPYRIGHT:                                                                   *
  12. *   Licensed Materials - Property of IBM                                       *
  13. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  14. *   All Rights Reserved                                                        *
  15. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. * $Log:   R:/IBMCLASS/IBASECTL/VCS/IPAGECUR.HPV  $
  19. //
  20. //   Rev 1.3   25 Oct 1992 17:05:50   nunn
  21. //changed library name to ICLUI
  22. //
  23. //   Rev 1.2   25 Oct 1992 10:56:14   boezeman
  24. //Add documentation and converted file to skeleton.hpp format.
  25.  
  26.       Rev 1.1   05 Jun 1992 19:02:08   Ken Fichthorn
  27.    First version of the class
  28. *******************************************************************************/
  29. // Forward declarations for other classes:
  30. class INoteBook;
  31. class IPage;
  32. class IPageCursor;
  33. #include <ipage.hpp>
  34. #include <inotebk.hpp>
  35.  
  36. class IPageCursor {
  37. /*******************************************************************************
  38. * This class is used to iterate through all of the pages of a notebook.        *
  39. * In addition, it provides methods to count from the current page to the next  *
  40. * major tab, the next minor tab page, or to the end of the notebook.           *
  41. *                                                                              *
  42. * EXAMPLE:                                                                     *
  43. * INoteBook *pnbkMyBook;                                                       *
  44. * IPage *ppageFirstPage;                                                       *
  45. * IPage *ppageSecondPage;                                                      *
  46. * IPage *ppage;                                                                *
  47. * pnbkMyBook = new INoteBook(ID_MYBOOK, this,                                  *
  48. *                            IRectangle(IPoint(50,15),                         *
  49. *                            ISize(425,225)));                                 *
  50. * ppageFirstPage = new IPage( pnbkMyBook,                                      *
  51. *                       BKA_MAJOR | IC_DEFAULTPAGESTYLE);                      *
  52. * ppageSecondPage = new IPage( pnbkMyBook,                                     *
  53. *                       BKA_MAJOR | IC_DEFAULTPAGESTYLE);                      *
  54. *                                                                              *
  55. * ppgcurCursor = new IPageCursor( pnbkMyBook);                                 *
  56. * ppgcurCursor->setCurrent( ppageFirstPage);                                   *
  57. * ppage = ppgcurCursor->next();                                                *
  58. *******************************************************************************/
  59. public:
  60. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  61. | There is 1 way to construct instances of this class:                         |
  62. |   1. default                                                                 |
  63. ------------------------------------------------------------------------------*/
  64.   IPageCursor( INoteBook* pnbkBook);
  65.   ~IPageCursor();
  66.  
  67. /*----------------------------- SET/QUERY CURSOR OPERATIONS --------------------
  68. | setCurrent   -  Makes the cursor point at the specified page of the notebook.|
  69. | current      -  Returns the page that the cursor is pointing to.             |
  70. ------------------------------------------------------------------------------*/
  71. void
  72.   setCurrent( IPage* ppgCurrent);
  73. IPage*
  74.   current()    {return ppgClCurrent;};
  75.  
  76. /*----------------------------- ITERATION OPERATIONS ---------------------------
  77. | first  - Moves the cursor to the first page of the notebook and also returns |
  78. |          a pointer to that page.                                             |
  79. | next   - Moves the cursor forward one page to the next page of the notebook  |
  80. |          and also returns a pointer to that page.                            |
  81. | prior  - Moves the cursor backward one page to the previous page of the      |
  82. |          notebook and also returns a pointer to that page.                   |
  83. | last   - Moves the cursor to the last page of the notebook and also returns  |
  84. |          a pointer to that page.                                             |
  85. ------------------------------------------------------------------------------*/
  86. IPage*
  87.   first();
  88. IPage*
  89.   next();
  90. IPage*
  91.   prior();
  92. IPage*
  93.   last();
  94.  
  95. /*----------------------------- PAGE COUNTING OPERATIONS -----------------------
  96. | count            - Returns the total number of pages in the notebook.        |
  97. | countToNextMajor - Returns the total number of pages, including the current  |
  98. |                    page, to the next major tab page in the notebook.         |
  99. | countToNextMinor - Returns the total number of pages, including the current  |
  100. |                    page, to the next minor tab page in the notebook.         |
  101. | countToEnd       - Returns the total number of pages, including the current  |
  102. |                    page, to the last page in the notebook.                   |
  103. ------------------------------------------------------------------------------*/
  104. long
  105.   count() const,
  106.   countToNextMajor() const,
  107.   countToNextMinor() const,
  108.   countToEnd() const;
  109.  
  110. private:
  111. /*--------------------------------- PRIVATE ----------------------------------*/
  112. INoteBook *
  113.   pnbkClNotebook;
  114. IPage *
  115.   ppgClCurrent;
  116. };
  117.  
  118. #endif
  119.