home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / ui / fontdesc.h < prev    next >
C/C++ Source or Header  |  1995-04-08  |  2KB  |  103 lines

  1.  
  2.  
  3. #ifndef _fontdesc_h_ /* Thu Dec 29 10:03:04 1994 */
  4. #define _fontdesc_h_
  5.  
  6.  
  7. #if defined(__GNUC__)
  8. #pragma interface
  9. #endif
  10.  
  11. #include "base/string.h"
  12.  
  13. enum UIFont_Style {UIFont_Italic    = 1,
  14.                    UIFont_Underline = 2,
  15.                    UIFont_BoldFace  = 4,
  16.                    UIFont_StrikeOut = 8
  17.                };
  18.  
  19.  
  20. // A FontDesc object is a ``font descriptor'' that an application program
  21. // can use to describe a font. The platform does not guarantee that a font
  22. // described by a FontDesc exists; the application must use the FontInfo
  23. // object to obtain information about the actual font.
  24.  
  25. class CL_EXPORT UI_FontDesc: public CL_Object {
  26.  
  27. public:
  28.  
  29.     UI_FontDesc (const char* type_face, short point_size = 10,
  30.                  ulong style_enum = 0);
  31.     // The third parameter is a disjunction of {\tt StyleEnum} values.
  32.  
  33.     UI_FontDesc ();
  34.     
  35.     ~UI_FontDesc () {};
  36.     
  37.     short Compare (const CL_Object&) const;
  38.  
  39.     short Compare (const UI_FontDesc&) const;
  40.  
  41.     void operator= (const CL_Object&);
  42.  
  43.     UI_FontDesc& operator= (const UI_FontDesc&);
  44.  
  45.  
  46.     short PointSize() const    {return _ptSize;};
  47.  
  48.     CL_String TypeFace() const {return _typeFace;};
  49.  
  50.     ulong Style () const   {return _style;};
  51.  
  52. protected:
  53.     short             _ptSize;
  54.     CL_String         _typeFace;
  55.     short             _style;
  56.  
  57.  
  58. };
  59.  
  60.  
  61. //  The FontInfo class is an enhancement of the FontDesc class to include
  62. //  platform-specific information.
  63.  
  64. class CL_EXPORT UI_FontInfo: public UI_FontDesc {
  65.  
  66. public:
  67.     UI_FontInfo ();
  68.     
  69. #if defined(__X_MOTIF__)
  70.     bool IsFixedWidth() const {return _fixedWidth;};
  71.  
  72. #endif
  73.  
  74.     bool IsScalable () const {return _scalable;};
  75.  
  76.     short Compare (const CL_Object&) const;
  77.  
  78.     short Compare (const UI_FontInfo&) const;
  79.  
  80.     void operator= (const CL_Object&);
  81.  
  82.     UI_FontInfo& operator= (const UI_FontInfo&);
  83.  
  84.     CL_String AsString () const;
  85.  
  86. protected:
  87.     UI_FontInfo (const char* type_face, short point_size = 10,
  88.                  ulong style_enum = 0, bool = FALSE);
  89.     // Under Windows, the last parameter is TRUE for TrueType fonts; under
  90.     // X, it is TRUE for proportional fonts.
  91.     
  92.     bool              _scalable;
  93.     
  94. #if defined(__X_MOTIF__)
  95.     bool              _fixedWidth;
  96.     CL_String         _realName;
  97. #endif
  98.  
  99.     friend class UI_Font;
  100. };
  101.  
  102. #endif /* _fontdesc_h_ */
  103.