+
+ // accessors and setters
+ // ---------------------
+
+ wxColour& GetColour() const { return wx_const_cast(wxColour&, m_colour); }
+ int GetWidth() const { return m_width; }
+ int GetStyle() const { return m_style; }
+ int GetJoin() const { return m_join; }
+ int GetCap() const { return m_cap; }
+ wxDash* GetDash() const { return m_dash; }
+ int GetDashCount() const { return m_nbDash; }
+ wxBitmap* GetStipple() const { return wx_const_cast(wxBitmap *, &m_stipple); }
+
+ void SetColour(const wxColour& col) { Free(); m_colour = col; }
+ void SetWidth(int width) { Free(); m_width = width; }
+ void SetStyle(int style) { Free(); m_style = style; }
+ void SetStipple(const wxBitmap& stipple)
+ {
+ Free();
+
+ m_style = wxSTIPPLE;
+ m_stipple = stipple;
+ }
+
+ void SetDashes(int nb_dashes, const wxDash *dash)
+ {
+ Free();
+
+ m_nbDash = nb_dashes;
+ m_dash = wx_const_cast(wxDash *, dash);
+ }
+
+ void SetJoin(int join) { Free(); m_join = join; }
+ void SetCap(int cap) { Free(); m_cap = cap; }
+
+
+ // HPEN management
+ // ---------------
+
+ // create the HPEN if we don't have it yet
+ bool Alloc();
+
+ // get the HPEN creating it on demand
+ WXHPEN GetHPEN() const;
+
+ // return true if we have a valid HPEN
+ bool HasHPEN() const { return m_hPen != 0; }
+
+ // return true if we had a valid handle before, false otherwise
+ bool Free();
+
+private:
+ // initialize the fields which have reasonable default values
+ //
+ // doesn't initialize m_width and m_style which must be initialize in ctor
+ void Init()
+ {
+ m_join = wxJOIN_ROUND;
+ m_cap = wxCAP_ROUND;
+ m_nbDash = 0;
+ m_dash = NULL;
+ m_hPen = 0;
+ }
+