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

  1. #ifndef _IOUTLBOX_
  2.  
  3.   #define _IOUTLBOX_
  4. /*******************************************************************************
  5. * FILE NAME: ioutlbox.hpp                                                      *
  6. *                                                                              *
  7. * DESCRIPTION:                                                                 *
  8. *   Declaration of the class(es):                                              *
  9. *     IOutlineBox - This class creates and manages an unfilled rectangle control.*
  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 disclosure    *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *******************************************************************************/
  19. #ifndef _ICONTROL_
  20.   #include <icontrol.hpp>
  21. #endif
  22.  
  23. // Forward declarations for other classes:
  24. class IRectangle;
  25. class ISize;
  26. class IWindowHandle;
  27. class IColor;
  28. #ifndef _IRECT_
  29.   #include <irect.hpp>
  30. #endif
  31. #ifndef _IBITFLAG_
  32.   #include <ibitflag.hpp>
  33. #endif
  34.  
  35. /*----------------------------------------------------------------------------*/
  36. /* Align classes on four byte boundary.                                       */
  37. /*----------------------------------------------------------------------------*/
  38. #pragma pack(4)
  39.  
  40. class IOutlineBox : public IControl  {
  41. typedef IControl Inherited;
  42. /*******************************************************************************
  43. * The IOutlineBox class creates and manages an unfilled rectangle control.     *
  44. *                                                                              *
  45. * EXAMPLE:                                                                     *
  46. *   IOutlineBox olbx1(ID_BKGNDRECT, this, this, IRectangle(10,10,110,210));    *
  47. *                                                                              *
  48. *   IOutlineBox olbx2(ID_FGNDRECT, this, this, IRectangle(120,10,220,210));    *
  49. *   olbx2.setOutlineType(IOutlineBox::foreground);                             *
  50. *                                                                              *
  51. *   IOutlineBox olbx3(ID_HTONERECT, this, this, IRectangle(230,10,330,210));   *
  52. *   olbx3.setOutlineType(IOutlineBox::halftone);                               *
  53. *******************************************************************************/
  54. public:
  55. /*------------------- Style -----------------------------------------------
  56.   The following functions provide a means to set and query outline box styles:
  57.  
  58.     Style - Nested class that provides static members that define the set of
  59.             valid outline box styles.  These styles can be used in
  60.             conjunction with the styles defined by the IWindow::Style nested
  61.             class.  For example, you could define an instance of the
  62.             IOutlineBox::Style class and initialize it like:
  63.               IOutlineBox::Style
  64.                 style = IOutlineBox::halftoneFrame | IWindow::visible;
  65.             An object of this type is provided when the outline box is
  66.             created.  A customizable default is used if no styles are
  67.             specified.  Once the object is constructed, IOutlineBox and
  68.             IWindow member functions can be used to set or query the
  69.             object's style.
  70.  
  71.             The declaration of the IOutlineBox::Style nested class is
  72.             generated by the INESTEDBITFLAGCLASSDEF1 macro.
  73.  
  74.   The valid outline box styles are:
  75.     classDefaultStyle - Original default style for this class, which is
  76.                         foregroundFrame | IWindow::visible.
  77.     backgroundFrame   - Causes the outline box to have a frame equal to the
  78.                         background color.
  79.     foregroundFrame   - Causes the outline box to have a frame equal to the
  80.                         foreground color.
  81.     halftoneFrame     - Causes the outline box to have the frame shaded in a
  82.                         halftone of the foreground color.
  83.  
  84.   The following functions provide a means of getting and setting the default
  85.   style for this class:
  86.     defaultStyle    - Returns the current default style.  This is the same as
  87.                       classDefaultStyle unless setDefaultStyle has been
  88.                       called.
  89.     setDefaultStyle - Sets the default style for all subsequent outline boxes.
  90. -------------------------------------------------------------------------*/
  91. INESTEDBITFLAGCLASSDEF1(Style, IOutlineBox, IWindow);
  92.                                   // style class definition
  93. static const Style
  94.   classDefaultStyle,
  95.   backgroundFrame,
  96.   foregroundFrame,
  97.   halftoneFrame;
  98.  
  99. static Style
  100.    defaultStyle();
  101. static void
  102.    setDefaultStyle(Style style);
  103.  
  104. /*------------------------ Constructors ----------------------------------------
  105. | You can construct instances of this class in the following ways:             |
  106. |    - From a control ID, parent and owner windows, rectangle, and style.      |
  107. |      This creates the specified outline box control and an object for it.    |
  108. |    - From the ID of an outline box control on a dialog window.  This         |
  109. |      creates the object for the specified outline box control.               |
  110. |    - From the window handle of an existing outline box control.  This        |
  111. |      creates the object for the specified outline box control.               |
  112. ------------------------------------------------------------------------------*/
  113.   IOutlineBox(unsigned long id,
  114.               IWindow* parent,
  115.               IWindow* owner,
  116.               const IRectangle& initial= IRectangle(),
  117.               const Style& style = defaultStyle() );
  118.  
  119.   IOutlineBox(unsigned long id,
  120.               IWindow* parentDialog);
  121.  
  122.   IOutlineBox(const IWindowHandle& handle);
  123.  
  124. /*---------------------------- Enumerations ------------------------------------
  125. | The following enumerations are defined:                                      |
  126. |   OutlineType - Enumeration that specifies outline type parameters.  Values  |
  127. |                 are:                                                         |
  128. |                   foreground - Uses the currently set foreground color.      |
  129. |                   background - Uses the system background color.             |
  130. |                   halftone   - Uses halftone shading in the foreground color.|
  131. |                                                                              |
  132. |   ColorArea   - Enumeration that is used to replace the color for a          |
  133. |                 particular region.  The value is:                            |
  134. |                   fillRegion - Sets the color with which the outline is      |
  135. |                                drawn.  This overides the currently set       |
  136. |                                OutlineType.                                  |
  137. ------------------------------------------------------------------------------*/
  138. enum OutlineType {
  139.   foreground,
  140.   background,
  141.   halftone };
  142. enum ColorArea {
  143.   fillRegion};
  144.  
  145. /*-------------------------------- Filltype ------------------------------------
  146. |   setOutlineType  - Sets the type of outline.                                |
  147. |   outlineType     - Returns the type of outline.                             |
  148. ------------------------------------------------------------------------------*/
  149. IOutlineBox&
  150.   setOutlineType(OutlineType type);
  151. OutlineType
  152.   outlineType() const;
  153.  
  154. /*----------------------------- Color Functions --------------------------------
  155. |  setColor - Changes the color of the given color region.                     |
  156. |  color    - Returns the color of the given color region.                     |
  157. ------------------------------------------------------------------------------*/
  158. IOutlineBox
  159.   &setColor(ColorArea value, const IColor& color);
  160.  
  161. IColor
  162.   color(ColorArea value) const;
  163.  
  164. protected:
  165.  
  166. private:
  167. /*--------------------------------- PRIVATE ----------------------------------*/
  168.   IOutlineBox(const IOutlineBox&);
  169.   IOutlineBox& operator=(const IOutlineBox&);
  170.  
  171. static Style
  172.   currentDefaultStyle;
  173.  
  174. };  // class IOutlineBox
  175.  
  176. INESTEDBITFLAGCLASSFUNCS(Style, IOutlineBox);
  177.                                   // global style functions
  178.  
  179. /*----------------------------------------------------------------------------*/
  180. /* Resume compiler default packing.                                           */
  181. /*----------------------------------------------------------------------------*/
  182. #pragma pack()
  183.  
  184. #endif  // _IOUTLBOX_
  185.