wxIScan
wxtextctrlcolourizer.h
Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////
00002 // Project:     wxSQuery
00003 // Purpose:     ...
00004 // Name:        wxtextctrlcolourizer.h
00005 // Author:      Daniel Nell
00006 // Created:     2012/02/12
00007 // Copyright:   (c) Daniel Nell
00008 // Licence:     wxWindows licence
00009 // Modified by:
00010 /////////////////////////////////////////////////////////////////////////////
00011 
00012 #ifndef __WXTEXTCTRLCOLOURIZER_H
00013 #define __WXTEXTCTRLCOLOURIZER_H
00014 
00015 /////////////////////////////////////////////////////////////////////////////
00016 //  Class wxTextCtrlColourizer
00017 //
00018 /// \brief ...
00019 ///
00020 /// ...
00021 class wxTextCtrlColourizer
00022 {
00023   public:
00024     /// Default constructor
00025     wxTextCtrlColourizer( wxTextCtrl *poTextCtrl, const wxColour &oColour )
00026     {
00027         m_poTextCtrl= poTextCtrl;
00028         if( m_poTextCtrl )
00029         {
00030             wxTextAttr oStyle( m_poTextCtrl->GetDefaultStyle() );
00031 
00032             m_oDefaultTextColour= oStyle.GetTextColour();
00033             oStyle.SetTextColour( oColour );
00034             m_poTextCtrl->SetDefaultStyle( oStyle );
00035         }
00036     }
00037 
00038     /// Destructor
00039     virtual ~wxTextCtrlColourizer()
00040     {
00041         if( m_poTextCtrl )
00042         {
00043             wxTextAttr oStyle( m_poTextCtrl->GetDefaultStyle() );
00044 
00045             oStyle.SetTextColour( m_oDefaultTextColour );
00046             m_poTextCtrl->SetDefaultStyle( oStyle );
00047         }
00048     }
00049 
00050   protected:
00051     wxTextCtrl *m_poTextCtrl;                           ///< ...
00052     wxColour m_oDefaultTextColour;                      ///< ...
00053 };
00054 
00055 #endif // __WXTEXTCTRLCOLOURIZER_H