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

  1. /******************************************************************************
  2. * .FILE:         lgoodies.hpp                                                 *
  3. *                                                                             *
  4. * .DESCRIPTION:  Lancelot Sample Program:              Class Definition       *
  5. *                                                                             *
  6. * .CLASSES:      LAskUser                                                     *
  7. *                LAskUserCommandHandler                                       *
  8. *                                                                             *
  9. * .COPYRIGHT:                                                                 *
  10. *    Licensed Material - Program-Property of IBM                              *
  11. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  12. *                                                                             *
  13. * .DISCLAIMER:                                                                *
  14. *   The following [enclosed] code is sample code created by IBM               *
  15. *   Corporation.  This sample code is not part of any standard IBM product    *
  16. *   and is provided to you solely for the purpose of assisting you in the     *
  17. *   development of your applications.  The code is provided 'AS IS',          *
  18. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  19. *   arising out of your use of the sample code, even if they have been        *
  20. *   advised of the possibility of such damages.                               *
  21. *                                                                             *
  22. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  23. *                                                                             *
  24. ******************************************************************************/
  25. #ifndef _LGOODIES_
  26.   #define _LGOODIES_
  27.  
  28. #include <iframe.hpp>
  29. #include <ititle.hpp>
  30. #include <imcelcv.hpp>
  31. #include <isetcv.hpp>
  32. #include <istattxt.hpp>
  33. #include <ientryfd.hpp>
  34. #include <ipushbut.hpp>
  35. #include <icmdhdr.hpp>
  36. #include <istring.hpp>
  37.  
  38. class LAskUser;
  39.  
  40. /******************************************************************************
  41. * Class LAskUserCommandHandler - Command handler for LAskUser window          *
  42. ******************************************************************************/
  43. class LAskUserCommandHandler : public ICommandHandler
  44. {
  45.    public:
  46. /*------------------------ Constructors/Destructor ----------------------------
  47. | Construct the object in only one way:                                       |
  48. | 1) Owner window                                                             |
  49. -----------------------------------------------------------------------------*/
  50.       LAskUserCommandHandler( LAskUser* owner );
  51.  
  52.      ~LAskUserCommandHandler();
  53.  
  54.  
  55.    protected:
  56. /*----------------------------- Event Processing ------------------------------
  57. | Handle and process events:                                                  |
  58. |   command             - Process command events.                             |
  59. -----------------------------------------------------------------------------*/
  60.       Boolean
  61.          command( ICommandEvent& event );
  62.  
  63.    private:
  64.       LAskUser
  65.         *theOwner;
  66. };
  67.  
  68.  
  69. /******************************************************************************
  70. * Class LAskUser - Standard looking dialog but with an entryfield for user    *
  71. *   input.                                                                    *
  72. ******************************************************************************/
  73. class LAskUser : public IFrameWindow
  74. {
  75.    public:
  76. /*------------------------ Constructors/Destructor ----------------------------
  77. | Construct the object in only one way:                                       |
  78. | 1) ResourceId, parent, owner, text1, text2, text3, text4.                   |
  79. -----------------------------------------------------------------------------*/
  80.       LAskUser( unsigned long id, IWindow* parent, IWindow* owner,
  81.                 const IString& askText,
  82.                 const IString& askText2 = "",
  83.                 const IString& askText3 = "",
  84.                 const IString& askText4 = "" );
  85.  
  86.      ~LAskUser();
  87.  
  88. /*------------------------------- Accessors -----------------------------------
  89. | These functions provide a means of getting and setting the accessible        |
  90. | attributes of instances of this class:                                       |
  91. |   pressedOk           - Returns true if the OK button was pressed by the     |
  92. |                         user.                                                |
  93. |   setOk               - Manually set the pressed OK flag.                    |
  94. |   text                - Returns the user entered text from the entryfield.   |
  95. -----------------------------------------------------------------------------*/
  96.       inline Boolean
  97.          pressedOk() { return ok; };
  98.  
  99.       LAskUser
  100.         &setOk( Boolean pressedOk = false ) { ok = pressedOk; return *this; };
  101.  
  102.       inline IString
  103.          text() { return entry.text(); };
  104.  
  105.  
  106.    private:
  107.       ITitle
  108.          title;
  109.  
  110.       IMultiCellCanvas
  111.          canvas;
  112.  
  113.       ISetCanvas
  114.          bCanvas;
  115.  
  116.       IStaticText
  117.          staticText1,
  118.          staticText2,
  119.          staticText3,
  120.          staticText4;
  121.  
  122.       IEntryField
  123.          entry;
  124.  
  125.       IPushButton
  126.          okButton,
  127.          cancelButton;
  128.  
  129.       LAskUserCommandHandler
  130.          cmdHdr;
  131.  
  132.       Boolean
  133.          ok;
  134. };
  135.  
  136.  
  137. /******************************************************************************
  138. * Class LFrameWindow - Frame window goody functions.                          *
  139. ******************************************************************************/
  140. class LFrameWindow : public IBase
  141. {
  142.    public:
  143. /*------------------------ Constructors/Destructor ----------------------------
  144. | Construct the object in only one way:                                       |
  145. | 1) No parameters.                                                           |
  146. -----------------------------------------------------------------------------*/
  147.       LFrameWindow();
  148.  
  149.      ~LFrameWindow();
  150.  
  151. /*------------------------------- Accessors -----------------------------------
  152. | These functions provide a means of getting and setting the accessible        |
  153. | attributes of instances of this class:                                       |
  154. |   bestFit             - If the frame window is clipped off the screen,       |
  155. |                         return a new position that avoids clipping.          |
  156. -----------------------------------------------------------------------------*/
  157.       static IPoint
  158.          bestFit( IFrameWindow* frameWin );
  159. };
  160. #endif
  161.