00001 #ifndef __CBrush__ 00002 #define __CBrush__ 00003 00004 #include "../Basics/CAlphaColour.hpp" 00005 using Exponent::GUI::Basics::CAlphaColour; 00006 00007 // =========================================================================== 00008 00009 namespace Exponent 00010 { 00011 namespace GUI 00012 { 00013 namespace Graphics 00014 { 00032 class CBrush 00033 { 00034 public: 00035 00039 CBrush(); 00040 00044 virtual ~CBrush(); 00045 00046 // =========================================================================== 00047 00051 void uninitialise(); 00052 00053 // =========================================================================== 00054 00056 #ifdef WIN32 00057 00063 void initialise(HDC hdc, const CAlphaColour &colour); 00064 00068 void setColourToNullBrush(); 00069 00074 const HDC getBrushHdc() const { return m_hdc; } 00075 00080 HDC getMutableBrushHdc() { return m_hdc; } 00081 00086 const HBRUSH getBrush() const { return m_brush; } 00088 #else 00089 00095 void initialise(CGContextRef drawContext, const CAlphaColour &colour); 00096 00101 CGContextRef getContextRef() const { return m_drawContext; } 00103 #endif 00104 00110 void setColour(const CAlphaColour &colour); 00111 00112 // =========================================================================== 00113 00118 const CAlphaColour &getColour() const { return m_colour; } 00119 00120 // =========================================================================== 00121 00122 protected: 00123 00124 // =========================================================================== 00125 00129 void createBrush(); 00130 00134 void deleteBrush(); 00135 00136 // =========================================================================== 00137 00139 #ifdef WIN32 00140 00141 HDC m_hdc; 00142 HGDIOBJ m_hOld; 00143 HBRUSH m_brush; 00145 #else 00146 00147 CGContextRef m_drawContext; 00149 #endif 00150 00152 CAlphaColour m_colour; 00154 }; 00155 } 00156 } 00157 } 00158 #endif // End of CBrush.hpp