home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / MSGTRACE.ZIP / MyProjects / MsgTrace / MsgTracer / ColFont.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-30  |  2.3 KB  |  85 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // File        : ColFont.h
  4. // Project     : MsgTrace
  5. // Component   : MsgTracer
  6. //---------------------------------------------------------------------------
  7. // Description : declaration of a colored-font
  8. //
  9. /////////////////////////////////////////////////////////////////////////////
  10. //
  11. // SourceSafe Strings. Do not change.
  12. //---------------------------------------------------------------------------
  13. // $Author: jeskes $
  14. // $Date: $
  15. // $Revision: $
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19. #ifndef COLFONT_H
  20. #define COLFONT_H
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23.  
  24. class CColoredFont : public CObject
  25. {
  26. //---------------------------------------------------------------------------
  27. // construction
  28. //---------------------------------------------------------------------------
  29. public:
  30.     CColoredFont( const CString& sName );
  31.     ~CColoredFont();
  32.  
  33. //---------------------------------------------------------------------------
  34. // color & font
  35. //---------------------------------------------------------------------------
  36. private:
  37.     CString m_sName;
  38.     COLORREF m_rgbColor;
  39.     CFont* m_pFont;
  40.     int m_nTabSize;
  41.     
  42. public:
  43.     BOOL ChooseColoredFont();
  44.     int GetTabSize() const;
  45.  
  46. //---------------------------------------------------------------------------
  47. // operators
  48. //---------------------------------------------------------------------------
  49. public:
  50.     operator CFont* () const;
  51.     operator HFONT () const;
  52.     operator COLORREF () const;
  53.  
  54. //---------------------------------------------------------------------------
  55. // helpers
  56. //---------------------------------------------------------------------------
  57. private:
  58.     LPCSTR GetEntry( LPCSTR lpszEntry ) const;
  59. };
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62.  
  63. inline CColoredFont::operator CFont* () const
  64. {
  65.     return( m_pFont );
  66. }
  67.  
  68. inline CColoredFont::operator HFONT () const
  69. {
  70.     return( (HFONT) m_pFont->m_hObject );
  71. }
  72.  
  73. inline CColoredFont::operator COLORREF    () const
  74. {
  75.     return( m_rgbColor );
  76. }
  77.  
  78. inline int CColoredFont::GetTabSize() const
  79. {
  80.     return( m_nTabSize );
  81. }
  82.     
  83. /////////////////////////////////////////////////////////////////////////////
  84. #endif
  85.