home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / ISWP.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  8KB  |  169 lines

  1. #ifndef _ISWP_
  2. #define _ISWP_
  3. /*******************************************************************************
  4. * FILE NAME: iswp.hpp                                                          *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     ISWP      - Wrapper for PM SWP (set window position) structure.          *
  9. *     ISWPArray - Array of ISWP stuctures.                                     *
  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               *
  16. *   disclosure                                                                 *
  17. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  18. *                                                                              *
  19. *******************************************************************************/
  20. #ifndef _IBASE_
  21.   #include <ibase.hpp>
  22. #endif
  23.  
  24. #ifndef _IHANDLE_
  25.   #include <ihandle.hpp>
  26. #endif
  27.  
  28. /*----------------------------------------------------------------------------*/
  29. /* Align classes on four byte boundary.                                       */
  30. /*----------------------------------------------------------------------------*/
  31. #pragma pack(4)
  32.  
  33. class IPoint;
  34. class ISize;
  35.  
  36. class ISWP : public IBase {
  37. typedef IBase
  38.   Inherited;
  39. /*******************************************************************************
  40. * The ISWP class is a wrapper for the Presentation Manager Toolkit window      *
  41. * position structure.  This class provides member functions to access and set  *
  42. * the various elements of this structure.                                      *
  43. *                                                                              *
  44. * The structure contains the following elements:                               *
  45. *   flags    - A set of window size/move flags.  The flags are defined by the  *
  46. *              Toolkit SWP_* constants.                                        *
  47. *   position - A window position represented by an IPoint.                     *
  48. *   size     - A window size represented by an ISize.                          *
  49. *   behind   - The window handle that identifies the window behind which to    *
  50. *              place the window associated with this structure.                *
  51. *   hwnd     - The window handle of the window associated with this structure. *
  52. *                                                                              *
  53. * This class provides member functions to get and set the position and size.   *
  54. * It provides accessors to get the hwnd as an IWindowHandle and to return      *
  55. * the flags as an unsigned long.                                               *
  56. *******************************************************************************/
  57. public:
  58. /*-------------------------------- Accessors -----------------------------------
  59. |  The following functions are used to get and set the accessible attributes   |
  60. |  of instances of this class:                                                 |
  61. |    windowHandle - Returns the handle of the associated window.               |
  62. |    position     - Returns the window position stored in this object.         |
  63. |    setPosition  - Sets the window position.                                  |
  64. |    size         - Returns the window size stored in this object.             |
  65. |    setSize      - Sets the window size.                                      |
  66. |    flags        - Returns the flags stored in this object.                   |
  67. ------------------------------------------------------------------------------*/
  68. IWindowHandle
  69.   windowHandle ( ) const;
  70.  
  71. IPoint
  72.   position ( ) const;
  73.  
  74. ISWP
  75.  &setPosition ( const IPoint &aPoint );
  76.  
  77. ISize
  78.   size ( ) const;
  79.  
  80. ISWP
  81.  &setSize ( const ISize &aSize );
  82.  
  83. unsigned long
  84.  &flags ( );
  85.  
  86. /*----------------------------------- Data -------------------------------------
  87. | The data members must exactly match the layout of the Presentation Manager   |
  88. | SWP structure.                                                               |
  89. |   fl          - Flags.                                                       |
  90. |   cy          - Width.                                                       |
  91. |   cx          - Height.                                                      |
  92. |   x           - The X-coordinate position.                                   |
  93. |   y           - The Y-coordinate position.                                   |
  94. |   behind      - Handle for the "behind" window.                              |
  95. |   hwnd        - Handle for this window.                                      |
  96. |   ulReserved1 - Reserved.                                                    |
  97. |   ulReserved2 - Reserved.                                                    |
  98. ------------------------------------------------------------------------------*/
  99. unsigned long
  100.   fl;
  101. long
  102.   cy,
  103.   cx,
  104.   y,
  105.   x;
  106. IWindowHandle
  107.   behind,
  108.   hwnd;
  109. unsigned long
  110.   ulReserved1,
  111.   ulReserved2;
  112. };
  113.  
  114. class ISWPArray : public IBase {
  115. typedef IBase
  116.   Inherited;
  117. /*******************************************************************************
  118. * The ISWPArray class serves as a wrapper for an array of Presentation         *
  119. * Manager Toolkit SWP structures.  This class treats those structures as ISWP  *
  120. * objects.                                                                     *
  121. *                                                                              *
  122. * It provides functions to access a given element of the array and to locate   *
  123. * the element that corresponds to a given window ID.                           *
  124. *******************************************************************************/
  125. public:
  126. /*------------------------------- Constructor ----------------------------------
  127. | You can construct an object of this class from a pointer to an ISWP object   |
  128. | (presumed to be the first element of the array) and a dimension (the number  |
  129. | of elements of the array).  Typically, the ISWP* argument is created by      |
  130. | casting a Presentation Manager PSWP pointer.                                 |
  131. ------------------------------------------------------------------------------*/
  132.   ISWPArray ( ISWP *array, unsigned dimension );
  133.  
  134. /*-------------------------------- Accessors -----------------------------------
  135. | These functions provide a means of getting the accessible attributes of      |
  136. | instances of this class:                                                     |
  137. |   size        - Returns the dimension of the array.                          |
  138. |   operator [] - Returns a reference to the nth element of the array.         |
  139. |   indexOf     - Returns a reference to the element that corresponds to a     |
  140. |                 window with the argument window ID value.                    |
  141. ------------------------------------------------------------------------------*/
  142. unsigned
  143.   size ( ) const;
  144.  
  145. ISWP
  146.  &operator [] ( unsigned index );
  147.  
  148. unsigned
  149.   indexOf ( unsigned long id ) const;
  150.  
  151. private: /*------------------------ PRIVATE ----------------------------------*/
  152. ISWP
  153.  *p;
  154. unsigned
  155.   dim;
  156. };
  157.  
  158. /*----------------------------------------------------------------------------*/
  159. /* Resume compiler default packing.                                           */
  160. /*----------------------------------------------------------------------------*/
  161. #pragma pack()
  162.  
  163. /*--------------------------------- INLINES ----------------------------------*/
  164. #ifndef I_NO_INLINES
  165.   #include <iswp.inl>
  166. #endif
  167.  
  168. #endif // _ISWP_
  169.