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

  1. #ifndef _IFRAMEXT_
  2. #define _IFRAMEXT_
  3. /*******************************************************************************
  4. * FILE NAME: iframext.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the declaration(s) of the class(es):                    *
  8. *     IFrameExtension  - Frame "extension" stucture                            *
  9. *     IFrameExtensions - Wrapper for a sequence of IFrameExtension objects     *
  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 _IFRAME_
  25.   #include <iframe.hpp>
  26. #endif
  27.  
  28. #ifndef _IRECT_
  29.   #include <irect.hpp>
  30. #endif
  31.  
  32. class ISWP;
  33. class IPresSpaceHandle;
  34.  
  35. #pragma info(none)
  36.  
  37. #include <iseq.h>
  38.  
  39. /*----------------------------------------------------------------------------*/
  40. /* Align classes on four byte boundary.                                       */
  41. /*----------------------------------------------------------------------------*/
  42. #pragma pack(4)
  43.  
  44. class IFrameExtension : public IBase {
  45. typedef IBase
  46.   Inherited;
  47. /*******************************************************************************
  48. * The IFrameExtension class's instances are maintained by IFrameWindows to     *
  49. * record information about each frame extension.                               *
  50. *                                                                              *
  51. * The extensions and setExtensions functions of the IFrameWindow class deal    *
  52. * with collections of such frame extensions.  Each collection is actually an   *
  53. * instance of class IFrameExtensions, which is essentially just a synonym for  *
  54. * ISequence<IFrameExtension*>.                                                 *
  55. *                                                                              *
  56. * Frame extensions have the following attributes:                              *
  57. *   type     - There are two basic types:  extensions that have a fixed width  *
  58. *              or height, and those whose width or height is a fraction of the *
  59. *              frame control they occupy (see the location attribute below).   *
  60. *   size     - This size is either a specific width or height (for fixed-size  *
  61. *              extensions) or a fraction (for relative-sized extensions).      *
  62. *   location - This attribute specifies the portion of the frame the           *
  63. *              extension occupies.  IFrameWindow::Location enumerates the      *
  64. *              possible values.                                                *
  65. *   control  - This attribute is a pointer to the control window that          *
  66. *              occupies the extension.                                         *
  67. *******************************************************************************/
  68. public:
  69. /*------------------------- Constructors ---------------------------------------
  70. | The constructors for this class accept the same set of arguments as          |
  71. | IFrameWindow::addExtension.                                                  |
  72. ------------------------------------------------------------------------------*/
  73.   IFrameExtension ( IWindow                     *window,
  74.                     IFrameWindow::Location       location,
  75.                     unsigned long                widthOrHeight,
  76.                     IFrameWindow::SeparatorType  separator );
  77.   IFrameExtension ( IWindow                     *window,
  78.                     IFrameWindow::Location       location,
  79.                     double                       percentage,
  80.                     IFrameWindow::SeparatorType  separator );
  81.  
  82. /*-------------------------------- Accessors -----------------------------------
  83. |The following functions provide means of getting and setting                  |
  84. |the accessible attributes of instances of this class:                         |
  85. | Type           - Enumeration of possible extension "types".  Values are:     |
  86. |                    fixed    - Extension has a fixed width or height.         |
  87. |                    relative - Extension has a relative width or height,      |
  88. |                               based on how much of the frame control it      |
  89. |                               occupies.                                      |
  90. | type           - Returns the extension type.                                 |
  91. | location       - Returns the frame extension location.                       |
  92. | separatorWidth - Returns the width of the separator line between this        |
  93. |                  extension and the control to which it is attached (or the   |
  94. |                  extension to which it is adjacent).                         |
  95. | setSize        - Resets the size of the extension.                           |
  96. | relativeSize   - Returns the relative width or height as a percentage        |
  97. |                  (0.0 if the extension is of type fixed).                    |
  98. | fixedSize      - Returns the fixed width or height in window coordinates     |
  99. |                  (0 if the extension is of type relative).                   |
  100. | control        - Pointer to the IControl window that occupies this           |
  101. |                  extension.                                                  |
  102. | attachedToId   - Returns the ID of the frame control to which this           |
  103. |                  extension is attached.                                      |
  104. ------------------------------------------------------------------------------*/
  105. enum Type
  106.   {
  107.   fixed,
  108.   relative
  109.   };
  110.  
  111. Type
  112.   type ( ) const;
  113.  
  114. IFrameWindow::Location
  115.   location ( ) const;
  116.  
  117. virtual IFrameExtension
  118.  &setSize ( int    widthOrHeight ),
  119.  &setSize ( double widthOrHeight );
  120.  
  121. virtual unsigned
  122.   separatorWidth ( ) const;
  123.  
  124. virtual double
  125.   relativeSize ( ) const;
  126.  
  127. virtual unsigned long
  128.   fixedSize ( ) const;
  129.  
  130. IWindow
  131.  *control ( ) const;
  132.  
  133. virtual unsigned long
  134.   attachedToId ( ) const;
  135.  
  136. /*----------------------------- Extension Sizing -------------------------------
  137. | The following functions are used to size extensions:                         |
  138. |   attachTo     - Returns the SWP structure, which contains information       |
  139. |                  about how the frame extension should be sized when it is    |
  140. |                  attached to the control.  The position of the control is    |
  141. |                  indicated by the SWP argument.  The SWP structure is        |
  142. |                  updated to account for the space occupied by this           |
  143. |                  extension.                                                  |
  144. |   sizeTo       - Calculates and returns the size this extension would have   |
  145. |                  when it is attached to a control of the argument size.      |
  146. |   totalRectFor - Calculates and returns a rectangle from a base rectangle    |
  147. |                  plus the frame extension's size and position.               |
  148. |   baseRectFor -  Calculates and returns a rectangle from a total rectangle   |
  149. |                  (that is, a client rectangle with a frame extension) minus  |
  150. |                  the frame extension's size and position.                    |
  151. ------------------------------------------------------------------------------*/
  152. virtual ISWP
  153.   attachTo ( ISWP &baseSWP );
  154.  
  155. virtual ISize
  156.   sizeTo ( const ISize &baseSize ) const;
  157.  
  158. virtual IRectangle
  159.   totalRectFor( const IRectangle& baseRect ) const,
  160.   baseRectFor( const IRectangle& totalRect ) const;
  161.  
  162. /*--------------------------------- Drawing ------------------------------------
  163. | This function provides support to aid in drawing frame extensions:           |
  164. |   drawSeparator - Draws the separator line between an extension and the      |
  165. |                   adjacent control (or extension) to which it is attached.   |
  166. ------------------------------------------------------------------------------*/
  167. virtual void
  168.   drawSeparator ( const IPresSpaceHandle &psh ) const;
  169.  
  170. protected:
  171.  
  172. private: /*------------------------ PRIVATE ----------------------------------*/
  173. union
  174.   {
  175.   double
  176.     extRelativeSize;
  177.   unsigned long
  178.     extFixedSize;
  179.   };
  180. Type
  181.   extType;
  182. IFrameWindow::Location
  183.   extLocation;
  184. IFrameWindow::SeparatorType
  185.   extSeparator;
  186. IPoint
  187.   extPosition;
  188. ISize
  189.   extSize;
  190. IWindow
  191.  *extControl;
  192. }; // class IFrameExtension
  193.  
  194.  
  195. class IFrameExtensions : public ISequence< IFrameExtension* > {
  196. /*******************************************************************************
  197. * The IFrameExtensions class is a set that was created using the IBM           *
  198. * Collection Class Library.  The IFrameExtensions class is a wrapper for a     *
  199. * sequence of IFrameExtension objects.  It is used to add a level of           *
  200. * indirection in the IFrameWindow interface.                                   *
  201. *******************************************************************************/
  202. public:
  203.   IFrameExtensions ( );
  204.   ~IFrameExtensions ( );
  205. }; // class IFrameExtensions
  206.  
  207. /*----------------------------------------------------------------------------*/
  208. /* Resume compiler default packing.                                           */
  209. /*----------------------------------------------------------------------------*/
  210. #pragma pack()
  211.  
  212. #ifndef I_NO_INLINES
  213.   #include <iframext.inl>
  214. #endif
  215.  
  216. #pragma info(restore)
  217.  
  218. #endif // _IFRAMEXT_
  219.