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

  1. #ifndef _IAPPWIN_
  2.   #define _IAPPWIN_
  3. /*******************************************************************************
  4. * FILE NAME: iappwin.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IApplicationWindow - Abstract base class for application window.         *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  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. *$Log:   R:/IBMCLASS/IBASEAPP/VCS/IAPPWIN.HPV  $                                                                         *
  18. // 
  19. //    Rev 1.23   26 Oct 1992 10:48:38   nunn
  20. // Kevin's changes for 10/26
  21.    
  22.       Rev 1.1   25 Oct 1992 00:00:01   kleong
  23.    Miscellaneous improvements.
  24. *******************************************************************************/
  25. #ifndef _IWINDOW_
  26.   #include <iwindow.hpp>
  27. #endif
  28.  
  29. // Forward declarations for other classes:
  30. class IApplicationWindow;
  31. class IResourceId;
  32. class IEvent;
  33.  
  34. class IApplicationWindow : public IWindow {
  35. /*******************************************************************************
  36. * The IApplicationWindow class is an abstract base class for application       *
  37.   window class, such as a frame and dialog window. It provide common
  38.   functions applicable to a frame and dialog window.
  39. *******************************************************************************/
  40. typedef IWindow Inherited;
  41. public:
  42.  
  43. /*-------------------------------- ACCESSORS -----------------------------------
  44. | These functions provide means of getting and setting the accessible          |
  45. | attributes of instances of this class:                                       |
  46. |   beginFlash       - Starts the window flashing to bring the user's          |
  47. |                      attention to the window.                                |
  48. |   close            - Closes the window                                       |
  49. |   disableEscClose  - Disables closing the window when ESC key is pressed     |
  50. |   endFlash         - Stops the window flashing                               |
  51. |   enableEscClose   - Enables closing the window when ESC key is pressed      |
  52. |   icon             - Returns the pointer handle of the window icon           |
  53. |   maximize         - Maximizes the window                                    |
  54. |   maximizeRect     - Returns the window rectangle coordinates to which it is |
  55. |                      maximized                                               |
  56. |   minimize         - Minimizes the window                                    |
  57. |   minimizeRect     - Returns the window rectangle coordinates to which it is |
  58. |                      minimized                                               |
  59. |   nextShellRect    - Returns the system recommended window rectangle         |
  60. |                      coordinates of the next main window                     |
  61. |   restore          - Restores a maximized or minimized window                |
  62. |   restoreRect      - Returns the window rectangle coordinates to which the   |
  63. |                      window is restored                                      |
  64. |   setIcon          - Sets the window icon                                    |
  65. |   setRestoreRect   - Changes the rectangle corrdinates to which the window   |
  66. |                      is restored                                             |
  67. ------------------------------------------------------------------------------*/
  68. IApplicationWindow
  69.   &beginFlash(),
  70.   &disableEscClose(),
  71.   &enableEscClose(Boolean enableEsc = true),
  72.   &endFlash(),
  73.   &minimize(),
  74.   &maximize(),
  75.   &restore(),
  76.   &setIcon(const IPointerHandle& icon),
  77.   &setIcon(const IResourceId& iconResId),
  78.   &setIcon(unsigned long iconResId),
  79.   &setRestoreRect(const IRectangle& newRect);
  80.  
  81. IPointerHandle 
  82.   icon() const;
  83.  
  84. void 
  85.   close();
  86.  
  87. IWindowHandle 
  88.   lastFocusControl() const; 
  89.  
  90. IRectangle
  91.   minimizeRect() const,
  92.   maximizeRect() const,
  93.   nextShellRect() const,
  94.   restoreRect() const; 
  95.  
  96. /*-------------------------------- TESTING   -----------------------------------
  97. | These functions provide means of testing the attributes of instances of      |
  98. | this class:                                                                  |
  99. |   isFlash     - Queries if the window is flashing
  100. |   isMaximize  - Queries if the window is maximized
  101.     isMinimize  - Queries if the window is minimized
  102. ------------------------------------------------------------------------------*/
  103. Boolean
  104.   isFlash() const,
  105.   isMaximize() const,
  106.   isMinimize() const;
  107.  
  108. /*----------------------------- WINDOW LIST  -----------------------------------
  109. | These functions provide means of setting and removing the window list entry  |
  110. | for this window:                                                             |
  111. |   setWindowListEntry    - Adds the window title to the system window list    |
  112. |                           Note that frame window window list entry can be    |
  113. |                           set using window style                             |
  114. |   removeWindowListEntry - Removes the window title from the system window    |
  115. |                           list                                               |
  116. ------------------------------------------------------------------------------*/
  117. IApplicationWindow
  118.   &setWindowListEntry(Boolean enable = true),
  119.   &removeWindowListEntry();
  120.  
  121. /*-------------------------------- OVERRIDES -----------------------------------
  122. | This class overrides the following inherited functions:                      |
  123. |   disable - Disables the window and its children                             |
  124. |   enable  - Enables the window and its children                              |
  125. ------------------------------------------------------------------------------*/
  126. virtual void 
  127.   enable(Boolean enableWin = true) {enableWindow(enableWin);}
  128. virtual void 
  129.   disable() {enableWindow(false);}
  130.  
  131. protected:
  132. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  133. | There are one way to construct instances of this class:                      |
  134. |   1. default                                                                 |
  135. |     this initialize the object                                               |
  136. ------------------------------------------------------------------------------*/
  137.   IApplicationWindow();
  138. virtual 
  139.   ~IApplicationWindow();
  140.  
  141. /*----------------------- EVENT HANDLING ---------------------------------------
  142. | There functions provide means to handle events of instances of this class:   |
  143. |   handleEvent        - Overrides to dispatch event handling function         |
  144. |                        specific to an application window, as listed below.   |
  145. |   handleClose        - Function dispatched when to when is above to close.   |
  146. |                        Application should return false to prevent the window |
  147. |                        for closing.                                          |
  148. |   handleActivate     - Function dispatched when the window is activated.     |
  149. |   handleDeactivate   - Function dispatched when the window is deactivated.   |
  150. |   handleSave         - Function dispatched to allow the application to save  |
  151. |                        application data when the window is closing.          |
  152. ------------------------------------------------------------------------------*/
  153. virtual Boolean 
  154.   handleWindowEvent(IEvent& event);
  155. virtual Boolean 
  156.   handleWindowClose() {return true;}
  157. virtual void 
  158.   handleActivate() {;}
  159. virtual void 
  160.   handleDeactivate() {;}
  161. virtual void 
  162.   handleSave() {;}
  163.  
  164. private:
  165. /*--------------------------------- PRIVATE ----------------------------------*/
  166. IApplicationWindow(const IApplicationWindow&);
  167. IApplicationWindow 
  168.   &operator=(const IApplicationWindow&);
  169.  
  170. void 
  171.   manageQuit(),
  172.   enableWindow(Boolean b);
  173.  
  174. unsigned long 
  175.   flAppWinFlag;
  176. };
  177.  
  178. #endif  /* _IAPPWIN_ */
  179.