home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / istattxt.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  5.8 KB  |  195 lines

  1. #ifndef _ISTATTXT_
  2.   #define _ISTATTXT_
  3. /*******************************************************************************
  4. * FILE NAME: istattxt.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IStaticText                                                              *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - 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. *******************************************************************************/
  18. #include <itextctl.hpp>
  19. #include <icolor.hpp>
  20. #include <irect.hpp>
  21.  
  22. #pragma pack(4)
  23.  
  24. class ISize;
  25. class IStaticTextHandler;
  26. class IStaticTextData;
  27.  
  28. class IStaticText : public ITextControl {
  29. typedef ITextControl
  30.   Inherited;
  31. public:
  32. class Style;
  33. /*------------------------------- Constructors -------------------------------*/
  34.   IStaticText ( unsigned long        id,
  35.                 IWindow*             parent,
  36.                 IWindow*             owner,
  37.                 const IRectangle&    initial = IRectangle(),
  38.                 const Style&         style   = defaultStyle() );
  39.  
  40.   IStaticText ( unsigned long        id,
  41.                 IWindow*             parent );
  42.  
  43.   IStaticText ( const IWindowHandle& handle );
  44.  
  45. virtual
  46.  ~IStaticText ( );
  47.  
  48. /*---------------------------------- Styles ----------------------------------*/
  49. INESTEDBITFLAGCLASSDEF2 ( Style,
  50.                           IStaticText,
  51.                           IWindow,
  52.                           IControl );
  53. static const Style
  54.   IC_IMPORTU classDefaultStyle,
  55.   IC_IMPORTU left,
  56.   IC_IMPORTU center,
  57.   IC_IMPORTU right,
  58.   IC_IMPORTU wordBreak,
  59.   IC_IMPORTU mnemonic,
  60.   IC_IMPORTU top,
  61.   IC_IMPORTU vertCenter,
  62.   IC_IMPORTU bottom,
  63.   IC_IMPORTU halftone,
  64.   IC_IMPORTU underscore,
  65.   IC_IMPORTU strikeout,
  66.   IC_IMPORTU fillBackground,
  67. #ifndef IC_MOTIFPM_FLAGNOP
  68.   IC_IMPORTU border3D;
  69. #endif
  70.  
  71. static Style
  72.   defaultStyle      ( );
  73.  
  74. static void
  75.   setDefaultStyle   ( const Style&    style );
  76.  
  77. virtual unsigned long
  78.   convertToGUIStyle ( const IBitFlag& style,
  79.                       Boolean         extendedOnly = false ) const;
  80.  
  81. /*------------------------------- Alignment ----------------------------------*/
  82. enum Alignment {
  83.   topLeft,
  84.   topLeftWrapped,
  85.   topCenter,
  86.   topRight,
  87.   centerLeft,
  88.   centerCenter,
  89.   centerRight,
  90.   bottomLeft,
  91.   bottomCenter,
  92.   bottomRight
  93. };
  94.  
  95. virtual IStaticText
  96.  &setAlignment ( Alignment alignment = IStaticText::topLeft );
  97.  
  98. Alignment
  99.   alignment    ( ) const;
  100.  
  101. /*------------------------- Style Functions ----------------------------------*/
  102. virtual IStaticText
  103.  &enableStrikeout       ( Boolean enable = true ),
  104.  &disableStrikeout      ( ),
  105.  &enableUnderscore      ( Boolean enable = true ),
  106.  &disableUnderscore     ( ),
  107.  &enableHalftone        ( Boolean enable = true ),
  108.  &disableHalftone       ( ),
  109.  &enableFillBackground  ( Boolean enable = true ),
  110.  &disableFillBackground ( );
  111.  
  112. Boolean
  113.   isStrikeout           ( ) const,
  114.   isUnderscore          ( ) const,
  115.   isHalftone            ( ) const,
  116.   hasFillBackground     ( ) const;
  117.  
  118. /*---------------------------------- Colors ----------------------------------*/
  119. virtual IColor
  120.   foregroundColor ( ) const,
  121.   backgroundColor ( ) const;
  122.  
  123. virtual IColor
  124.   fillColor       ( ) const;
  125.  
  126. virtual IStaticText
  127.  &setFillColor    ( const IColor& color ),
  128.  &resetFillColor  ( );
  129.  
  130. /*-------------------------- Minimum Size Adjustment -------------------------*/
  131. virtual IStaticText
  132.  &setLimit ( unsigned long limit = 0 );
  133.  
  134. unsigned long
  135.   limit    ( ) const;
  136.  
  137. /*------------------------------ Text Processing -----------------------------*/
  138. virtual IStaticText
  139.  &setText ( const char*        text ),
  140.  &setText ( const IResourceId& text );
  141.  
  142. /*----------------------- Notification Event Descriptions --------------------*/
  143. static INotificationId const
  144.   IC_IMPORTU strikeoutId,
  145.   IC_IMPORTU underscoreId,
  146.   IC_IMPORTU halftoneId,
  147.   IC_IMPORTU fillColorId,
  148.   IC_IMPORTU fillBackgroundId,
  149.   IC_IMPORTU limitId;
  150.  
  151. /*----------------------------- Window Positioning ---------------------------*/
  152.  
  153.  
  154. protected:
  155. /*------------------------------ Layout Support ------------------------------*/
  156. virtual ISize
  157.   calcMinimumSize ( ) const,
  158.   calcLimitSize   ( ) const;
  159.  
  160. /*---------------------- Event-Handling Implementation -----------------------*/
  161.  
  162. private:
  163. /*------------------------------ Hidden Members ------------------------------*/
  164.   IStaticText ( const IStaticText& );
  165. IStaticText
  166.  &operator=   ( const IStaticText& );
  167.  
  168. void
  169.   notify      ( INotificationId nId,
  170.                 Boolean enabled );
  171.  
  172. /*--------------------------------- Private ----------------------------------*/
  173. friend class IStaticTextHandler;
  174.  
  175. static Style
  176.   currentDefaultStyle;
  177.  
  178. unsigned long
  179.   ulClLimit;
  180.  
  181. IStaticTextData
  182.  *fStaticTextData;
  183.  
  184. }; // class IStaticText
  185.  
  186. INESTEDBITFLAGCLASSFUNCS(Style, IStaticText);
  187.                                   // global style functions
  188.  
  189. #pragma pack()
  190.  
  191. /*--------------------------------- Inlines ----------------------------------*/
  192.   #include <istattxt.inl>
  193.  
  194. #endif  // _ISTATTXT_
  195.