home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 November / VPR9611B.ISO / vabasic / ntclnt.exe / DISK8 / data.8 / datab / INCLUDE / VWFONT.HH < prev    next >
Text File  |  1996-07-29  |  6KB  |  219 lines

  1. //--------------------------------------------------------------
  2. // $Source: /rcs/vwrcs/components/vwfont.hh,v $
  3. // Checked in by: $Author: robert $
  4. // $Date: 1996/07/06 02:37:10 $              $Revision: 1.14 $
  5. //--------------------------------------------------------------
  6. //    Copyright (c) International Business Machines Inc, 1994
  7. //         Copyright(c) 1993, Visual Edge Software Ltd.
  8. //
  9. // ALL RIGHTS RESERVED. This notice is intended as a precaution
  10. // against inadvertent publication, and shall not be deemed to
  11. // consitute an acknowledgment that publication has occurred
  12. // nor to imply any waiver of confidentiality. The year included
  13. // in the notice is the year of the creation of the work.
  14. //--------------------------------------------------------------
  15. // DESCRIPTION:
  16. //      This file contains the class declaration for the
  17. //      VwFont class. The VwFont class implements
  18. //      the common functionality of all the Viper components
  19. //      that have a graphical user interface.
  20. //--------------------------------------------------------------
  21.  
  22. #ifndef VWFONT_HH
  23. #define VWFONT_HH
  24.  
  25. #include <dllclass.hh>
  26.  
  27. VCLASS VwFont;
  28.  
  29. #ifdef VSYS_WININTEL
  30. VCLASS VwpFont;
  31. VCLASS VwiFont;
  32. typedef VwiFont* ToolkitFont;
  33. #else
  34. typedef XmFontList ToolkitFont;
  35. typedef XFontSet ToolkitFontSet;
  36. #endif
  37.  
  38. typedef struct VwFontList {
  39.     unsigned int refcount;
  40.     ToolkitFont fontlist;
  41. #ifdef VSYS_UNIX
  42.     ToolkitFontSet fontset;
  43. #endif
  44. } VwFontList;
  45.  
  46.  
  47.  
  48.  
  49. #ifdef VSYS_UNIX
  50. #ifndef DEFAULT_SYS_FONT_NAME
  51. #define DEFAULT_SYS_FONT_NAME        "helvetica"
  52. #endif
  53. #ifndef DEFAULT_SYS_FONT_SIZE
  54. #define DEFAULT_SYS_FONT_SIZE        8
  55. #endif
  56. #endif // VSYS_UNIX
  57.  
  58. #ifdef VSYS_WINDOWS
  59. #ifndef DEFAULT_SYS_FONT_NAME
  60. #define DEFAULT_SYS_FONT_NAME        "MS Sans Serif"
  61. #endif
  62. #ifndef DEFAULT_SYS_FONT_SIZE
  63. #define DEFAULT_SYS_FONT_SIZE        8
  64. #endif
  65. #endif // VSYS_WINDOWS
  66.  
  67. #ifdef VSYS_OS2
  68. #ifndef DEFAULT_SYS_FONT_NAME
  69. #define DEFAULT_SYS_FONT_NAME        "Helv"
  70. #endif
  71. #ifndef DEFAULT_SYS_FONT_SIZE
  72. #define DEFAULT_SYS_FONT_SIZE        8
  73. #endif
  74. #endif // VSYS_OS2
  75.  
  76. #define DEFAULT_SYS_FONT_FOUNDRY        "*"
  77. #ifdef    VW_NO_FONT_BOLD
  78. #define DEFAULT_SYS_FONT_BOLD        VwFalse
  79. #else
  80. #define DEFAULT_SYS_FONT_BOLD        VwTrue
  81. #endif
  82. #define DEFAULT_SYS_FONT_ITALIC        VwFalse
  83. #define DEFAULT_SYS_FONT_STRIKETHRU        VwFalse
  84. #define DEFAULT_SYS_FONT_UNDERLINE        VwFalse
  85.  
  86.  
  87. // Must also define the compatible fonts
  88. #ifdef VSYS_UNIX
  89. #ifndef COMPATIBLE_SYS_FONT_NAME
  90. #define COMPATIBLE_SYS_FONT_NAME        "helvetica"
  91. #endif
  92. #ifndef COMPATIBLE_SYS_FONT_SIZE
  93. #define COMPATIBLE_SYS_FONT_SIZE        8
  94. #endif
  95. #endif // VSYS_UNIX
  96.  
  97. #ifdef VSYS_WINDOWS
  98. #ifndef COMPATIBLE_SYS_FONT_NAME
  99. #define COMPATIBLE_SYS_FONT_NAME        "MS Sans Serif"
  100. #endif
  101. #ifndef COMPATIBLE_SYS_FONT_SIZE
  102. #define COMPATIBLE_SYS_FONT_SIZE        8
  103. #endif
  104. #endif // VSYS_WINDOWS
  105.  
  106. #ifdef VSYS_OS2
  107. #ifndef COMPATIBLE_SYS_FONT_NAME
  108. #define COMPATIBLE_SYS_FONT_NAME        "Helv"
  109. #endif
  110. #ifndef COMPATIBLE_SYS_FONT_SIZE
  111. #define COMPATIBLE_SYS_FONT_SIZE        8
  112. #endif
  113. #endif // VSYS_OS2
  114.  
  115. #define COMPATIBLE_SYS_FONT_FOUNDRY        "*"
  116. #define COMPATIBLE_SYS_FONT_BOLD        VwTrue
  117. #define COMPATIBLE_SYS_FONT_ITALIC        VwFalse
  118. #define COMPATIBLE_SYS_FONT_STRIKETHRU  VwFalse
  119. #define COMPATIBLE_SYS_FONT_UNDERLINE   VwFalse
  120.  
  121.  
  122.  
  123. VCLASS VwFont : public VeDllBasedClass {
  124.  
  125. public:
  126.     VOPERDECL VwFont ( VTDisplay aDisplay = 0);
  127.     
  128.     VOPERDECL VwFont (    VeString    aFontFoundry,
  129.                 VeString    aFontName,
  130.                 float      aFontSize,
  131.                 VwBool        aFontBold,
  132.                 VwBool     aFontItalic,
  133.                    VwBool     aFontStrikethru,
  134.                    VwBool     aFontUnderline,
  135.                 VTDisplay  aDisplay = 0);
  136.     VOPERDECL ~VwFont ();
  137.                    
  138.                    
  139.     VVIRTUALDECL(status_t) PutFont (            
  140.         VeString    aFontFoundry,
  141.         VeString    aFontName,
  142.         float      aFontSize,
  143.         VwBool        aFontBold = DEFAULT_SYS_FONT_BOLD,
  144.         VwBool     aFontItalic = DEFAULT_SYS_FONT_ITALIC,
  145.         VwBool     aFontStrikethru = DEFAULT_SYS_FONT_STRIKETHRU,
  146.         VwBool     aFontUnderline = DEFAULT_SYS_FONT_UNDERLINE);
  147.  
  148.         VVIRTUALDECL(VwBool)              FontBold ();
  149.         VVIRTUALDECL(status_t)            PutFontBold ( VwBool );
  150.  
  151.         VVIRTUALDECL(VwBool)              FontItalic ();
  152.         VVIRTUALDECL(status_t)            PutFontItalic ( VwBool );
  153.  
  154.         VVIRTUALDECL(const char *)        FontFoundry ();
  155.         VVIRTUALDECL(status_t)            PutFontFoundry ( char * );
  156.  
  157.         VVIRTUALDECL(const char *)        FontName ();
  158.         VVIRTUALDECL(status_t)            PutFontName ( char * );
  159.  
  160.         VVIRTUALDECL(float)               FontSize ();
  161.         VVIRTUALDECL(status_t)            PutFontSize ( float );
  162.  
  163.         VVIRTUALDECL(VwBool)              FontStrikethru ();
  164.         VVIRTUALDECL(status_t)            PutFontStrikethru ( VwBool );
  165.  
  166.         VVIRTUALDECL(VwBool)              FontUnderline ();
  167.         VVIRTUALDECL(status_t)            PutFontUnderline ( VwBool );
  168.         
  169.         VVIRTUALDECL(void)            Acquire ( );
  170.         VVIRTUALDECL(void)            Release ( );
  171.         
  172.         VVIRTUALDECL(ToolkitFont)    GetToolkitFont();
  173.         VVIRTUALDECL(VwFontList*)    GetVwFontList();
  174.  
  175.         VVIRTUALDECL(status_t)            CreateVwFontList( );  
  176.         VVIRTUALDECL(status_t)            CreateToolkitFont( VwFontList*);  
  177.  
  178.     VVIRTUALDECL(void)        DelayUpdate();
  179.     VVIRTUALDECL(status_t)        Update();
  180.  
  181.     static VMETHODDECL(VwFont *)     GetVwFont(VeString foundry, 
  182.                         VeString name, VwSingle size,
  183.                                             VwBool bold, VwBool italic,
  184.                         VwBool strikethru,
  185.                                             VwBool underline, 
  186.                         VTDisplay);
  187.     static VMETHODDECL(void)    DeleteCachedFonts();
  188.     static VMETHODDECL(VwFont *)    GetDefaultVwFont(VTDisplay, VeString);
  189.  
  190. protected:
  191.  
  192.         VeString        itsFontFoundry;
  193.         VeString        itsFontName;
  194.         float          itsFontSize;
  195.         VwBool         isFontBold;
  196.         VwBool         isFontItalic;
  197.         VwBool         isFontStrikethru;
  198.         VwBool         isFontUnderline;
  199.  
  200.     VwBool         isFontDirty; // not used yet
  201.  
  202.  
  203. private:
  204.     VwBool         isDelayed; 
  205.  
  206.     VwFontList     *itsVwFontList;
  207.  
  208. #ifdef VSYS_UNIX
  209.     VTDisplay    itsDisplay;
  210. #endif
  211.     
  212.     VMETHODDECL(void)        Init ();
  213.  
  214. };
  215.  
  216.  
  217. #endif
  218.  
  219.