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

  1. #ifndef _ISTATTXT_
  2.   #define _ISTATTXT_
  3. /*******************************************************************************
  4. * FILE NAME: istattxt.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     Istattxt - This class creates and manages the static text control window.*
  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/ISTATTXT.HPV  $
  18. //
  19. //   Rev 1.7   25 Oct 1992 17:06:16   nunn
  20. //changed library name to ICLUI
  21. //
  22. //   Rev 1.6   25 Oct 1992 10:57:58   boezeman
  23. //Add documentation and converted file to skeleton.hpp format.
  24.  
  25.       Rev 1.5   13 Oct 1992 21:22:38   tsuji
  26.    Correct comments around log directive.
  27.  
  28.       Rev 1.4   13 Oct 1992 20:57:56   tsuji
  29.    Correct log directive, remove IBM Confidential classification.
  30.  
  31.       Rev 1.3   13 Oct 1992 19:06:20   tsuji
  32.    Remove no-op virtual destructor, add Inherited typedef.
  33. *******************************************************************************/
  34. #ifndef _ITEXTCTL_
  35.   #include <itextctl.hpp>
  36. #endif
  37. // Forward declarations for other classes:
  38. class IStaticText;  /* sttxt */
  39. class IRectangle;
  40. class ISize;
  41. class IWindowHandle;
  42. #ifndef _IBITFLAG_
  43.   #include <ibitflag.hpp>
  44. #endif
  45.  
  46. class IStaticText : public ITextControl  {
  47. /*******************************************************************************
  48. * This class creates and manages the static text control window.               *
  49. *                                                                              *
  50. * To use this class, create an instance of this class as follows:              *
  51. *   IStaticText sttxtText(ID_TEXT,this,IRectangle(10,10,30,12));               *
  52. *   sttxtText.setText("It is a wonderful day");                                *
  53. *                                                                              *
  54. * To change the style of the static text control after it has been created,    *
  55. * use functions such as:                                                       *
  56. *   setAlignment(IStaticText::centerCenter).                                   *
  57. *                                                                              *
  58. * Valid styles for a static text control are:                                  *
  59. *   IStaticText::autosize,                                                     *
  60. *   IStaticText::left,                                                         *
  61. *   IStaticText::center,                                                       *
  62. *   IStaticText::right,                                                        *
  63. *   IStaticText::top,                                                          *
  64. *   IStaticText::vertCenter,                                                   *
  65. *   IStaticText::bottom,                                                       *
  66. *   IStaticText::wordBreak,                                                    *
  67. *   IStaticText::defStyle, and any of the                                      *
  68. *   IWindow styles.                                                            *
  69. *                                                                              *
  70. * EXAMPLE:                                                                     *
  71. *   <sample code>                                                              *
  72. *******************************************************************************/
  73. typedef ITextControl
  74.   Inherited;
  75. public:
  76. INESTEDBITFLAGCLASSDEF1(Style, IStaticText, IWindow);
  77.                                   // style class definition
  78. static const Style
  79.   autosize,
  80.   left,
  81.   center,
  82.   right,
  83.   top,
  84.   vertCenter,
  85.   bottom,
  86.   wordBreak;
  87. static const Style&
  88.   defStyle;
  89.  
  90. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  91. | There are 3 ways to construct instances of this class:                       |
  92. |   1. default                                                                 |
  93. |   2. From a Dialog Template                                                  |
  94. |   3. From a Window                                                           |
  95. ------------------------------------------------------------------------------*/
  96.   IStaticText(unsigned long Id,
  97.               const IWindow* parent,
  98.               const IWindow* owner,
  99.               const IRectangle& initial,
  100.               Style style = defStyle);
  101.  
  102.   IStaticText(unsigned long Id,
  103.               const IWindow* parentDialog);
  104.  
  105.   IStaticText(IWindowHandle handle);
  106.  
  107. /*-------------------------------- STYLES --------------------------------------
  108. | These function provide means of getting and setting the default style        |
  109. | attributes of instances of this class:                                       |
  110. |   defaultStyle    - returns the static text control default style setting    |
  111. |   setDefaultStyle - sets the static text control default style               |
  112. ------------------------------------------------------------------------------*/
  113. static Style
  114.    defaultStyle();
  115. static void
  116.    setDefaultStyle(Style style);
  117.  
  118. /*-------------------------------- ALIGNMENT OPERATION -------------------------
  119. |   setAlignment - sets the alignment of the static text.                      |
  120. ------------------------------------------------------------------------------*/
  121. enum Alignment { topLeft, topLeftWrapped, topCenter,
  122.                  topRight, centerLeft, centerCenter,
  123.                  centerRight, bottomLeft,
  124.                  bottomCenter, bottomRight };
  125. void
  126.   setAlignment(Alignment alignment);
  127.  
  128. protected:
  129. /*----------------------------- LAYOUT SIZE ------------------------------------
  130. | calcMinSize - returns the minimum size that this static text control should be|
  131. ------------------------------------------------------------------------------*/
  132. virtual ISize
  133.   calcMinSize();
  134.  
  135. static Style
  136.   classDefaultStyle;
  137.  
  138. private:
  139. /*--------------------------------- PRIVATE ----------------------------------*/
  140.   IStaticText(const IStaticText&);
  141. //IStaticText& operator=(const IStaticText&);
  142.  
  143. static const Style
  144.   staticText,
  145.   allAlignments;
  146. };  // class IStaticText
  147.  
  148. INESTEDBITFLAGCLASSFUNCS(Style, IStaticText);
  149.                                   // global style functions
  150. #endif  // _ISTATTXT_
  151.