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

  1. #ifndef _IFILLBOX_
  2.   #define _IFILLBOX_
  3. /*******************************************************************************
  4. * FILE NAME: Ifillbox.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *    Ifillbox - This class creates a filled rectangle control.                 *
  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/IBASECTL/VCS/IFILLBOX.HPV  $
  18. //
  19. //   Rev 1.7   25 Oct 1992 17:05:22   nunn
  20. //changed library name to ICLUI
  21. //
  22. //   Rev 1.6   25 Oct 1992 10:54:14   boezeman
  23. //Add documentation and converted file to skeleton.hpp format.
  24.  
  25.       Rev 1.5   13 Oct 1992 21:22:06   tsuji
  26.    Correct comments around log directive.
  27.  
  28.       Rev 1.4   13 Oct 1992 20:56:50   tsuji
  29.    Correct log directive, remove IBM Confidential classification.
  30.  
  31.       Rev 1.3   13 Oct 1992 19:05:46   tsuji
  32.    Remove no-op virtual destructor, add Inherited typedef.
  33. *******************************************************************************/
  34. #ifndef _ICONTROL_
  35.   #include <icontrol.hpp>
  36. #endif
  37.  
  38. // Forward declarations for other classes:
  39. class IFillBox;  /* fbx */
  40. class IRectangle;
  41. class ISize;
  42. class IWindowHandle;
  43. #ifndef _IBITFLAG_
  44.   #include <ibitflag.hpp>
  45. #endif
  46.  
  47. class IFillBox : public IControl  {
  48. /*******************************************************************************
  49. * This class creates a filled rectangle control.                               *
  50. * To use this class, create a filled rectangle control window with the current *
  51. * background, current foreground, or halftone pattern in the current           *
  52. * foreground color, as follows:                                                *
  53. *   IFillBox fbx(ID_BKGNDRECT, this, IRectangle(10,10,110,210));               *
  54. *                                                                              *
  55. *   IFillBox fbx(ID_BKGNDRECT, this, IRectangle(10,10,110,210),                *
  56. *                WS_VISIBLE | WS_CLIPSIBLINGS | SS_FGNDRECT);                  *
  57. *                                                                              *
  58. *   IFillBox fbx(ID_BKGNDRECT, this, IRectangle(10,10,110,210),                *
  59. *                WS_VISIBLE | WS_CLIPSIBLINGS | SS_HALFTONERECT);              *
  60. *                                                                              *
  61. *                                                                              *
  62. * Valid styles for a fill box control are:                                     *
  63. *   IFillBox::foregroundRect,                                                  *
  64. *   IFillBox::backgroundRect,                                                  *
  65. *   IFillBox::halftoneRect,                                                    *
  66. *   IFillBox::defStyle, and any of the IWindow styles.                         *                 *
  67. *                                                                              *
  68. * EXAMPLE:                                                                     *
  69. *   <sample code>                                                              *
  70. *******************************************************************************/
  71. typedef IControl
  72.   Inherited;
  73.  
  74. public:
  75. INESTEDBITFLAGCLASSDEF1(Style, IFillBox, IWindow);
  76.                                   // style class definition
  77. static const Style
  78.   backgroundRect,
  79.   foregroundRect,
  80.   halftoneRect;
  81. static const Style&
  82.   defStyle;
  83. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  84. | There are 3 ways to construct instances of this class:                       |
  85. |   1. default                                                                 |
  86. |   2. From a Dialog Template                                                  |
  87. |   3. From a Window                                                           |
  88. ------------------------------------------------------------------------------*/
  89.   IFillBox(unsigned long Id,
  90.            const IWindow* parent,
  91.            const IWindow* owner,
  92.            const IRectangle& initial,
  93.            Style style = defStyle);
  94.  
  95.   IFillBox(unsigned long Id,
  96.            const IWindow* parentDialog);
  97.  
  98.   IFillBox(IWindowHandle handle);
  99.  
  100. /*-------------------------------- STYLES --------------------------------------
  101. | These function provide means of getting and setting the default style        |
  102. | attributes of instances of this class:                                       |
  103. |   defaultStyle    - returns the fillbox control default style setting        |
  104. |   setDefaultStyle - sets the fillbox control default style                   |
  105. ------------------------------------------------------------------------------*/
  106. static Style
  107.   defaultStyle();
  108. static void
  109.   setDefaultStyle(Style style);
  110.  
  111. /*-------------------------------- FILLTYPE ------------------------------------
  112. | This function sets how the rectangle is filled.                              |
  113. |   setFillType  -  takes one of the following inputs:                         |
  114. |          foreground  - for foreground color                                  |
  115. |          background  - for background color (default if function not called) |                                   *
  116. |          halftone    - for halftone shading in the foreground color          |
  117. ------------------------------------------------------------------------------*/
  118. enum FillType { foreground, background, halftone };
  119. void
  120.   setFillType(FillType type);
  121.  
  122. protected:
  123. /*----------------------------- LAYOUT SIZE ------------------------------------
  124. | calcMinSize - returns the minimum size that this fill box control should be. |
  125. ------------------------------------------------------------------------------*/
  126. virtual ISize
  127.   calcMinSize();
  128.  
  129. static Style
  130.   classDefaultStyle;
  131.  
  132. private:
  133. /*--------------------------------- PRIVATE ----------------------------------*/
  134.   IFillBox(const IFillBox&);
  135. //IFillBox& operator=(const IFillBox&);
  136.  
  137. static const Style
  138.   defaultRect,
  139.   allRects;
  140. };  // class IFillBox
  141.  
  142. INESTEDBITFLAGCLASSFUNCS(Style, IFillBox);
  143.                                   // global style functions
  144. #endif  /* _IFILLBOX_ */
  145.