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

  1. #ifndef _ITITLE_
  2.   #define _ITITLE_
  3. /**************************************************************/
  4. /* FILE NAME: ititle.hpp                                      */
  5. /*                                                            */
  6. /* DESCRIPTION:                                               */
  7. /*    Declaration of the class:                               */
  8. /*      ITitle - manages the window title text                */
  9. /*                                                            */
  10. /* COPYRIGHT:                                                 */
  11. /*   Licensed Materials - Property of IBM                     */
  12. /*   (c) Copyright IBM Corporation 1992, 1993                 */
  13. /*   US Government Users Restricted Rights - Use duplication  */
  14. /*   or disclosure restricted by GSA ADP Schedule Contract    */
  15. /*   with IBM Corp.                                           */
  16. /*                                                            */
  17. /*                                                            */
  18. /**************************************************************/
  19. #ifndef _ITEXTCTL_
  20. #include <itextctl.hpp>
  21. #endif
  22. #ifndef _IRESLIB_
  23. #include <ireslib.hpp>
  24. #endif
  25.  
  26. /*----------------------------------------------------------------------------*/
  27. /* Align classes on four byte boundary.                                       */
  28. /*----------------------------------------------------------------------------*/
  29. #pragma pack(4)
  30.  
  31. /*----------------------------------------------------------------------------*/
  32. /* Turn off warning for compiler generated copy/assignment                    */
  33. /*----------------------------------------------------------------------------*/
  34. #pragma info(nocpy)
  35.  
  36. // Forward declarations for other classes
  37. class  IResourceId;
  38. class  IString;
  39. class  IColor;
  40.  
  41. class ITitle : public ITextControl {
  42. typedef  ITextControl
  43.   Inherited;
  44. /**********************************************************************
  45. * The ITitle class consists of three components:                      *
  46. *   o Object text                                                     *
  47. *   o View text                                                       *
  48. *   o View number.                                                    *
  49. *                                                                     *
  50. * The object text is required, while the other two are optional.  The *
  51. * object text and view text are separated by a hyphen (-).  The view  *
  52. * text and view number are separated by a colon (:).                  *
  53. *                                                                     *
  54. * Example:                                                            *
  55. *                                                                     *
  56. *   OS/2 System - Icon View:2                                         *
  57. *                                                                     *
  58. * NOTE: Due to a Presentation Manager limitation, the length of any   *
  59. *       title cannot exceed 60 characters.  If you try to set the     *
  60. *       title text to a length greater than 60, the text will be      *
  61. *       truncated.                                                    *
  62. **********************************************************************/
  63.   public:
  64. /*------------------ Constructors/Destructor --------------------------
  65. | You can construct instances of this class in the following ways:    |
  66. |   - From char*                                                      |
  67. |   - From IResourceIds of STRINGTABLE items.                         |
  68. ---------------------------------------------------------------------*/
  69.   ITitle ( IWindow*           owner,
  70.            const char*        objectName       = 0,
  71.            const char*        viewName         = 0,
  72.            unsigned long      viewNumber       = 0);
  73.  
  74.   ITitle ( IWindow*           owner,
  75.            const IResourceId& objectNameResId,
  76.            const IResourceId& viewNameResId    = 0,
  77.            unsigned long      viewNum = 0);
  78.  
  79. /*---------------------- Accessors ------------------------------------
  80. | The following functions provide access to the title's components:   |
  81. |   objectText    - Returns the object text.                          |
  82. |   setObjectText - Sets the object text.                             |
  83. |   viewText      - Returns the view text.                            |
  84. |   setViewText   - Sets the view text.                               |
  85. |   viewNum       - Returns the view number.                          |
  86. |   setViewNum    - Sets the view number.                             |
  87. |   setTitleText  - Sets all three components (object text, view      |
  88. |                   text, and view number) at once.                   |
  89. ---------------------------------------------------------------------*/
  90. IString
  91.   objectText ( ) const,
  92.   viewText   ( ) const;
  93.  
  94. ITitle
  95.  &setObjectText ( const char*       objectName ),
  96.  &setObjectText ( const IResourceId &objectNameResId ),
  97.  &setViewText   ( const char*       viewName ),
  98.  &setViewText   ( const IResourceId &viewNameResId ),
  99.  &setViewNum    ( unsigned long     viewNum ),
  100.  &setTitleText  ( const char*       objectName,
  101.                   const char*       viewName          = 0,
  102.                   unsigned long     viewNum           = 0 ),
  103.  &setTitleText  ( const IResourceId &objectNameResId,
  104.                   const IResourceId &viewNameResId    = 0,
  105.                   unsigned long     viewNum           = 0 );
  106.  
  107. unsigned long
  108.   viewNum() const;
  109.  
  110. /*---------------------- ColorArea Enumeration ---------------------------------
  111. | ColorArea - Enumeration that is used to replace the color for a particular   |
  112. |             area of the title bar.  The valid values are:                    |
  113. |               activeFill             - Sets the color for the area not       |
  114. |                                        occupied by text when the window is   |
  115. |                                        active.                               |
  116. |               inactiveFill           - Sets the color for the area not       |
  117. |                                        occupied by text when the window is   |
  118. |                                        inactive.                             |
  119. |               activeTextForeground   - Sets the color of the title text      |
  120. |                                        foreground when the window is active. |
  121. |               inactiveTextForeground - Sets the color of the title text      |
  122. |                                        foreground when the window is         |
  123. |                                        inactive.                             |
  124. |               activeTextBackground   - Sets the color of the title text      |
  125. |                                        background when the window is         |
  126. |                                        active.                               |
  127. |               inactiveTextBackground - Sets the color of the title text      |
  128. |                                        background when the window is         |
  129. |                                        inactive.                             |
  130. |               border                 - Sets the color of the title bar       |
  131. |                                        border.                               |
  132. ------------------------------------------------------------------------------*/
  133. enum ColorArea {
  134.   activeFill,
  135.   inactiveFill,
  136.   activeTextForeground,
  137.   inactiveTextForeground,
  138.   activeTextBackground,
  139.   inactiveTextBackground,
  140.   border };
  141.  
  142. /*-------------------------- Set and Query Color ------------------------------
  143. | The following functions provide a means to set and query the title color:    |
  144. |   setColor - Changes the color of the specific title bar area.               |
  145. |   color    - Returns the color of the specific title bar area.               |
  146. ------------------------------------------------------------------------------*/
  147. ITitle
  148.   &setColor ( ColorArea     value,
  149.               const IColor& color );
  150. IColor
  151.   color ( ColorArea value ) const;
  152.  
  153. /*----------------------- PRIVATE -----------------------------------*/
  154. private:
  155.   ITitle(const ITitle& tleCopy) {}
  156. IWindow
  157.  *pwinClOwner;
  158. };
  159.  
  160. /*----------------------------------------------------------------------------*/
  161. /* Resume compiler default packing and warning messages.                      */
  162. /*----------------------------------------------------------------------------*/
  163. #pragma pack()
  164. #pragma info(restore)
  165.  
  166. #endif  /* ifndef _ITITLE_ */
  167.