home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / LANCELOT / LGOODIES.HPP < prev    next >
C/C++ Source or Header  |  1995-04-07  |  6KB  |  154 lines

  1. /******************************************************************************
  2. * FILE NAME: lgoodies.hpp                                                     *
  3. *                                                                             *
  4. * DESCRIPTION: Assortment of goody classes                                    *
  5. *                                                                             *
  6. * Classes:                                                                    *
  7. *   LAskUser                                                                  *
  8. *   LAskUserCommandHandler                                                    *
  9. *                                                                             *
  10. * COPYRIGHT:                                                                  *
  11. *   Licensed Materials - Property of IBM                                      *
  12. *   (C) Copyright IBM Corporation 1992, 1995                                  *
  13. *   All Rights Reserved                                                       *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure   *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                    *
  16. *                                                                             *
  17. ******************************************************************************/
  18. #ifndef _LGOODIES_
  19.   #define _LGOODIES_
  20.  
  21. #include <iframe.hpp>
  22. #include <ititle.hpp>
  23. #include <imcelcv.hpp>
  24. #include <isetcv.hpp>
  25. #include <istattxt.hpp>
  26. #include <ientryfd.hpp>
  27. #include <ipushbut.hpp>
  28. #include <icmdhdr.hpp>
  29. #include <istring.hpp>
  30.  
  31. class LAskUser;
  32.  
  33. /******************************************************************************
  34. * Class LAskUserCommandHandler - Command handler for LAskUser window          *
  35. ******************************************************************************/
  36. class LAskUserCommandHandler : public ICommandHandler
  37. {
  38.    public:
  39. /*------------------------ Constructors/Destructor ----------------------------
  40. | Construct the object in only one way:                                       |
  41. | 1) Owner window                                                             |
  42. -----------------------------------------------------------------------------*/
  43.       LAskUserCommandHandler( LAskUser* owner );
  44.  
  45.      ~LAskUserCommandHandler();
  46.  
  47.  
  48.    protected:
  49. /*----------------------------- Event Processing ------------------------------
  50. | Handle and process events:                                                  |
  51. |   command             - Process command events.                             |
  52. -----------------------------------------------------------------------------*/
  53.       Boolean
  54.          command( ICommandEvent& event );
  55.  
  56.    private:
  57.       LAskUser
  58.         *theOwner;
  59. };
  60.  
  61.  
  62. /******************************************************************************
  63. * Class LAskUser - Standard looking dialog but with an entryfield for user    *
  64. *   input.                                                                    *
  65. ******************************************************************************/
  66. class LAskUser : public IFrameWindow
  67. {
  68.    public:
  69. /*------------------------ Constructors/Destructor ----------------------------
  70. | Construct the object in only one way:                                       |
  71. | 1) ResourceId, parent, owner, text1, text2, text3, text4.                   |
  72. -----------------------------------------------------------------------------*/
  73.       LAskUser( unsigned long id, IWindow* parent, IWindow* owner,
  74.                 const IString& askText,
  75.                 const IString& askText2 = "",
  76.                 const IString& askText3 = "",
  77.                 const IString& askText4 = "" );
  78.  
  79.      ~LAskUser();
  80.  
  81. /*------------------------------- Accessors -----------------------------------
  82. | These functions provide a means of getting and setting the accessible        |
  83. | attributes of instances of this class:                                       |
  84. |   pressedOk           - Returns true if the OK button was pressed by the     |
  85. |                         user.                                                |
  86. |   setOk               - Manually set the pressed OK flag.                    |
  87. |   text                - Returns the user entered text from the entryfield.   |
  88. -----------------------------------------------------------------------------*/
  89.       inline Boolean
  90.          pressedOk() { return ok; };
  91.  
  92.       LAskUser
  93.         &setOk( Boolean pressedOk = false ) { ok = pressedOk; return *this; };
  94.  
  95.       inline IString
  96.          text() { return entry.text(); };
  97.  
  98.  
  99.    private:
  100.       ITitle
  101.          title;
  102.  
  103.       IMultiCellCanvas
  104.          canvas;
  105.  
  106.       ISetCanvas
  107.          bCanvas;
  108.  
  109.       IStaticText
  110.          staticText1,
  111.          staticText2,
  112.          staticText3,
  113.          staticText4;
  114.  
  115.       IEntryField
  116.          entry;
  117.  
  118.       IPushButton
  119.          okButton,
  120.          cancelButton;
  121.  
  122.       LAskUserCommandHandler
  123.          cmdHdr;
  124.  
  125.       Boolean
  126.          ok;
  127. };
  128.  
  129.  
  130. /******************************************************************************
  131. * Class LFrameWindow - Frame window goody functions.                          *
  132. ******************************************************************************/
  133. class LFrameWindow : public IBase
  134. {
  135.    public:
  136. /*------------------------ Constructors/Destructor ----------------------------
  137. | Construct the object in only one way:                                       |
  138. | 1) No parameters.                                                           |
  139. -----------------------------------------------------------------------------*/
  140.       LFrameWindow();
  141.  
  142.      ~LFrameWindow();
  143.  
  144. /*------------------------------- Accessors -----------------------------------
  145. | These functions provide a means of getting and setting the accessible        |
  146. | attributes of instances of this class:                                       |
  147. |   bestFit             - If the frame window is clipped off the screen,       |
  148. |                         return a new position that avoids clipping.          |
  149. -----------------------------------------------------------------------------*/
  150.       static IPoint
  151.          bestFit( IFrameWindow* frameWin );
  152. };
  153. #endif
  154.