home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / lancelot / lpagectl.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  7.1 KB  |  241 lines

  1. /******************************************************************************
  2. * .FILE:         lpagectl.hpp                                                 *
  3. *                                                                             *
  4. * .DESCRIPTION:  Lancelot Sample Program:              Class Definition       *
  5. *                                                                             *
  6. * .CLASSES:      PageButtons                                                  *
  7. *                PageCnrButtons                                               *
  8. *                PageScrollButtons                                            *
  9. *                QueryRange                                                   *
  10. *                AGraphicPushButton                                           *
  11. *                PageCnrSelHandler                                            *
  12. *                LPictureVerifyHandler                                        *
  13. *                                                                             *
  14. * .COPYRIGHT:                                                                 *
  15. *    Licensed Material - Program-Property of IBM                              *
  16. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  17. *                                                                             *
  18. * .DISCLAIMER:                                                                *
  19. *   The following [enclosed] code is sample code created by IBM               *
  20. *   Corporation.  This sample code is not part of any standard IBM product    *
  21. *   and is provided to you solely for the purpose of assisting you in the     *
  22. *   development of your applications.  The code is provided 'AS IS',          *
  23. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  24. *   arising out of your use of the sample code, even if they have been        *
  25. *   advised of the possibility of such damages.                               *
  26. *                                                                             *
  27. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  28. *                                                                             *
  29. ******************************************************************************/
  30. #ifndef _LPAGECTL_
  31. #define _LPAGECTL_
  32.  
  33. #include <isetcv.hpp>
  34. #include <igraphbt.hpp>
  35. #include <icheckbx.hpp>
  36. #include <icombobx.hpp>
  37. #include <istring.hpp>
  38. #include <istattxt.hpp>
  39. #include <imsgbox.hpp>
  40. #include <imcelcv.hpp>
  41. #include <iselhdr.hpp>
  42.  
  43. #ifdef IC_MOTIF
  44. #include <ipicvhdr.hpp>
  45. #include <istring.hpp>
  46. #endif
  47.  
  48. class AccountPage;
  49. class SkillPage;
  50. class ProjectPage;
  51. class TasksPage;
  52.  
  53. class AGraphicPushButton : public IGraphicPushButton
  54. {
  55. public:
  56.   AGraphicPushButton( unsigned long windowId,
  57.                        IWindow* parent,
  58.                        IWindow* owner,
  59.                        unsigned long iconid);
  60.  
  61.   ~AGraphicPushButton();
  62. };
  63.  
  64. #ifndef IC_MOTIF
  65. class PageButtonsSelectHandler : public ISelectHandler
  66. {
  67. public:
  68.  
  69.     PageButtonsSelectHandler( IMultiCellCanvas* parent );
  70.     ~PageButtonsSelectHandler();
  71.     Boolean
  72.       selected( IControlEvent& event );
  73.  
  74. private:
  75.     IMultiCellCanvas
  76.      *theParentMulticell;
  77. };
  78. #endif
  79.  
  80. class PageCnrButtons : public ISetCanvas
  81. {
  82. public:
  83.  
  84.     PageCnrButtons( unsigned long windowId
  85.                    ,IWindow* parent
  86.                    ,IWindow* owner
  87.                    ,Boolean noChangeButton= false );
  88.  
  89.     ~PageCnrButtons();
  90.  
  91. private:
  92.  
  93. IGraphicPushButton
  94.   *addButton,
  95.   *removeButton,
  96.   *changeButton;
  97.  
  98. };
  99.  
  100. class PageButtons : public ISetCanvas
  101. {
  102. public:
  103.  
  104.     PageButtons( unsigned long windowId
  105.                 ,IMultiCellCanvas* parent
  106.                 ,IMultiCellCanvas* owner
  107.                 ,Boolean noQueryButton = false );
  108.  
  109.     ~PageButtons();
  110.  
  111. private:
  112.  
  113. AGraphicPushButton
  114.   *queryButton,
  115.   *saveButton,
  116.   *undoButton,
  117.   *helpButton;
  118.  
  119. #ifndef IC_MOTIF
  120. ICheckBox
  121.   *gridCheckBox;
  122. PageButtonsSelectHandler
  123.   selectHandler;
  124. #endif
  125. };
  126.  
  127. class PageScrollButtons : public ISetCanvas
  128. {
  129. public:
  130.  
  131.   PageScrollButtons( unsigned long windowId
  132.                     ,IWindow* parent
  133.                     ,IWindow* owner );
  134.  
  135.   ~PageScrollButtons();
  136.  
  137. PageScrollButtons&
  138.     setDisplayText( const char* theStr );
  139.  
  140. private:
  141.  
  142. IStaticText
  143.     weekEndingText;
  144.  
  145. IString
  146.     dateText;
  147.  
  148. AGraphicPushButton
  149.     prevButton,
  150.     nextButton;
  151.  
  152. IString
  153.     displayText;
  154.  
  155. };
  156.  
  157. /******************************************************************************
  158. * Class PageCnrSelHandler - Page container select handler.                    *
  159. ******************************************************************************/
  160. class PageCnrSelHandler : public ISelectHandler
  161. {
  162.    public:
  163. /*------------------------ Constructors/Destructor ----------------------------
  164. | Construct the object given a page.                                          |
  165. -----------------------------------------------------------------------------*/
  166.       PageCnrSelHandler( AccountPage* page );
  167.       PageCnrSelHandler( SkillPage* page );
  168.       PageCnrSelHandler( ProjectPage* page );
  169.       PageCnrSelHandler( TasksPage* page );
  170.      ~PageCnrSelHandler();
  171.  
  172.    protected:
  173.  
  174. /*----------------------------- Event Processing ------------------------------
  175. | Handle and process events:                                                  |
  176. |   selected            - Process select events.                              |
  177. -----------------------------------------------------------------------------*/
  178.       Boolean
  179.          selected( IControlEvent& event );
  180.  
  181.    private:
  182.  
  183.       enum
  184.          PageType { accountPage, skillPage, projectPage, taskPage };
  185.  
  186.       IMultiCellCanvas
  187.         *pPage;
  188.  
  189.       PageType
  190.         pageType;
  191. };
  192.  
  193.  
  194. class QueryRange : public IComboBox
  195. {
  196. public:
  197.  
  198.     QueryRange( unsigned long windowId
  199.                ,IWindow* parent
  200.                ,IWindow* owner
  201.                ,unsigned long id);
  202.  
  203.     ~QueryRange();
  204.  
  205. inline IString
  206.     getRange() { return text();} ;
  207.  
  208. inline QueryRange&
  209.     setRange(const IString& r ) { setText(r); return *this;} ;
  210.  
  211. };
  212.  
  213. #ifdef IC_MOTIF
  214. class LPictureVerifyHandler : public IPictureVerifyHandler
  215. {
  216. public:
  217. // ---------------------- PUBLIC -------------------------------------
  218.   LPictureVerifyHandler( IWindow* owner,
  219.                          IString pictureString);
  220.   IWindow* owner();
  221.  
  222. protected:
  223.  
  224.   Boolean invalidChange           ( IEditVerifyEvent& event );
  225.  
  226. private:
  227. //--------------------------- PRIVATE ----------------------------------------
  228.   IWindow* pOwner;
  229. };
  230.  
  231. const IString TEST_ALPHA             = IString("*a");
  232. const IString TEST_LETTER            = IString("1a");
  233. const IString TEST_ALPHANUMERIC      = IString("*&");
  234. const IString TEST_DATE              = IString("1-2n '/' 1-2n '/' 2n");
  235. const IString TEST_PHONE             = IString( "3n '-' 3n '-' 4n");
  236. const IString TEST_FULL_NAME         = IString("*a 1w *a" );
  237. const IString TEST_CURRENCY          = IString("*n 0-1p 0-2n");
  238.  
  239. #endif
  240. #endif
  241.