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

  1. #ifndef _ICONTROL_
  2.   #define _ICONTROL_
  3. /*******************************************************************************
  4. * FILE NAME: icontrol.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *    IControl - This is the abstract base class for all control                *
  9. *               view windows.                                                  *
  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 _IWINDOW_
  20.   #include <iwindow.hpp>
  21. #endif
  22. #ifndef _IBITFLAG_
  23.   #include <ibitflag.hpp>
  24. #endif
  25. #ifndef _IPOINT_
  26.   #include <ipoint.hpp>
  27. #endif
  28.  
  29. /*----------------------------------------------------------------------------*/
  30. /* Align classes on four byte boundary.                                       */
  31. /*----------------------------------------------------------------------------*/
  32. #pragma pack(4)
  33.  
  34. // Forward declarations for other classes:
  35. class IFont;
  36.  
  37.  
  38. class IControl : public IWindow  {
  39. typedef IWindow
  40.   Inherited;
  41. /*******************************************************************************
  42. *    The IControl class is the abstract base class for control                 *
  43. *    view windows.                                                             *
  44. *******************************************************************************/
  45. public:
  46. /*---------------------- Style --------------------------------------------
  47.   The IControl::Style nested class provides static members that define the
  48.   set of valid control styles.  These styles can be used in conjunction with
  49.   the styles defined by the nested class IWindow::Style.  For example, you
  50.   could define an instance of the IControl::Style class and initialize it
  51.   like:
  52.               IControl::Style
  53.                 style = IControl::group | IWindow::visible;
  54.   An object of this type is provided when the control is created.  A
  55.   customizable default is used if no styles are specified.  Once the object
  56.   is constructed, IControl and IWindow member functions can be used to set
  57.   or query the object's style.
  58.  
  59.   The declaration of the IControl::Style nested class is generated by the
  60.   INESTEDBITFLAGCLASSDEF1 macro.
  61.  
  62.   The valid control styles are:
  63.     group   - Identifies the control as being the first in a group.  No other
  64.               controls in the group can have this style.  Controls in the
  65.               group must be siblings that are constructed following the first
  66.               control.  The group can be cursored through and when the last
  67.               control in the group is reached, the cursor returns to the
  68.               first control in the group.
  69.     tabStop - Identifies the control as one to which the user can tab.
  70. -------------------------------------------------------------------------*/
  71. INESTEDBITFLAGCLASSDEF1(Style, IControl, IWindow);
  72. static const Style
  73.   group,
  74.   tabStop;
  75.  
  76. /*------------------------ Constructors ----------------------------------------
  77. | Instances of this class cannot be created.                                   |
  78. ------------------------------------------------------------------------------*/
  79.   IControl();
  80. virtual
  81.   ~IControl() = 0;
  82.  
  83. /*-------------------------------- Style Operations ----------------------------
  84. | The following functions are used in style operations:                        |
  85. |    enableGroup     - Sets the group style of a control.  This makes the      |
  86. |                      control first in a cursorable group of controls.        |
  87. |    disableGroup    - Removes the group style from a control.  This removes   |
  88. |                      a control from a group of controls.                     |
  89. |    isGroup         - Returns true if the control has the group style set;    |
  90. |                      otherwise, false is returned.                           |
  91. |    enableTabStop   - Sets the tabstop style of a control.  This identifies   |
  92. |                      the control as one that can be tabbed to.               |
  93. |    disableTabStop  - Removes the tabstop style from a control.  This         |
  94. |                      prevents this control from being tabbed to.             |
  95. |    isTabStop       - Returns true if the control has the tabstop style set;  |
  96. |                      otherwise, false is returned.                           |
  97. ------------------------------------------------------------------------------*/
  98. IControl
  99.  &enableGroup    ( Boolean enable = true ),
  100.  &disableGroup   ( );
  101. Boolean
  102.   isGroup        ( ) const;
  103. IControl
  104.  &enableTabStop  ( Boolean enable = true ),
  105.  &disableTabStop ( );
  106. virtual Boolean
  107.   isTabStop      ( ) const;
  108.  
  109. /*----------------------------- Font -------------------------------------------
  110. | The following function is used to assigns fonts:                             |
  111. |   setFont     - Assigns a new font to be used by the control.                |
  112. ------------------------------------------------------------------------------*/
  113. virtual IControl
  114.  &setFont        (const IFont& fm );
  115.  
  116. protected:
  117. /*------------------------------ Implementation --------------------------------
  118. | The following function may be used to calculate the minimum size for the     |
  119. | control:                                                                     |
  120. |   characterSize   - Calculates and returns the average character width and   |
  121. |                     maximum character height for the currently set font.     |
  122. ------------------------------------------------------------------------------*/
  123. ISize
  124.   characterSize  ( );
  125.  
  126.  
  127. private:
  128. /*--------------------------------- Private ----------------------------------*/
  129.   IControl       ( const IControl& );
  130. IControl
  131.  &operator=      ( const IControl& );
  132.  
  133. ISize
  134.   sizClChar;
  135. };  // class IControl
  136. INESTEDBITFLAGCLASSFUNCS(Style, IControl); // global style functions
  137.  
  138. /*----------------------------------------------------------------------------*/
  139. /* Resume compiler default packing.                                           */
  140. /*----------------------------------------------------------------------------*/
  141. #pragma pack()
  142.  
  143. #endif  /* _ICONTROL_ */
  144.