00001 #ifndef __CPen__ 00002 #define __CPen__ 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 CPen 00033 { 00034 public: 00035 00036 // =========================================================================== 00037 00041 CPen(); 00042 00046 virtual ~CPen(); 00047 00048 // =========================================================================== 00049 00051 #ifdef WIN32 00052 00059 void initialise(const long width, HDC drawContext, const CAlphaColour &colour); 00060 00065 const HDC getPenHdc() const { return m_hdc; } 00066 00071 const HPEN getPen() const { return m_pen; } 00072 00076 void setPenToNullPen(); 00078 #else 00079 00086 void initialise(CGContextRef drawContext, long size, const CAlphaColour &colour); 00087 00092 CGContextRef getContextRef() const { return m_drawContext; } 00094 #endif 00095 00100 void uninitialise(); 00101 00102 // =========================================================================== 00103 00109 void setPen(const long width, const CAlphaColour &colour); 00110 00115 void setWidth(const long width); 00116 00121 void setColour(const CAlphaColour &colour); 00122 00123 // =========================================================================== 00124 00129 const CAlphaColour &getColour() const { return m_colour; } 00130 00135 long getWidth() const { return m_width; } 00136 00137 // =========================================================================== 00138 00139 protected: 00140 00141 // =========================================================================== 00142 00146 virtual void createPen(); 00147 00151 virtual void deletePen(); 00152 00153 // =========================================================================== 00154 00156 #ifdef WIN32 00157 00158 HGDIOBJ m_hOld; 00159 HDC m_hdc; 00160 HPEN m_pen; 00162 #else 00163 00164 CGContextRef m_drawContext; 00166 #endif 00167 00169 long m_width; 00170 CAlphaColour m_colour; 00172 }; 00173 } 00174 } 00175 } 00176 #endif // End of CPen.hpp