]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/pen.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPen class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "pen.h"
19 #include "wx/gdiobj.h"
20 #include "wx/colour.h"
21 #include "wx/bitmap.h"
23 typedef char wxMOTIFDash
;
25 class WXDLLEXPORT wxPen
;
27 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
29 friend class WXDLLEXPORT wxPen
;
32 wxPenRefData(const wxPenRefData
& data
);
46 #define M_PENDATA ((wxPenRefData *)m_refData)
49 class WXDLLEXPORT wxPen
: public wxGDIObject
51 DECLARE_DYNAMIC_CLASS(wxPen
)
54 wxPen(const wxColour
& col
, int width
, int style
);
55 wxPen(const wxBitmap
& stipple
, int width
);
56 inline wxPen(const wxPen
& pen
) { Ref(pen
); }
59 inline wxPen
& operator = (const wxPen
& pen
) { if (*this == pen
) return (*this); Ref(pen
); return *this; }
60 inline bool operator == (const wxPen
& pen
) { return m_refData
== pen
.m_refData
; }
61 inline bool operator != (const wxPen
& pen
) { return m_refData
!= pen
.m_refData
; }
63 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
65 // Override in order to recreate the pen
66 void SetColour(const wxColour
& col
) ;
67 void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) ;
69 void SetWidth(int width
) ;
70 void SetStyle(int style
) ;
71 void SetStipple(const wxBitmap
& stipple
) ;
72 void SetDashes(int nb_dashes
, const wxDash
*dash
) ;
73 void SetJoin(int join
) ;
74 void SetCap(int cap
) ;
76 inline wxColour
& GetColour() const { return (M_PENDATA
? M_PENDATA
->m_colour
: wxNullColour
); };
77 inline int GetWidth() const { return (M_PENDATA
? M_PENDATA
->m_width
: 0); };
78 inline int GetStyle() const { return (M_PENDATA
? M_PENDATA
->m_style
: 0); };
79 inline int GetJoin() const { return (M_PENDATA
? M_PENDATA
->m_join
: 0); };
80 inline int GetCap() const { return (M_PENDATA
? M_PENDATA
->m_cap
: 0); };
81 inline int GetDashes(wxDash
**ptr
) const
83 *ptr
= (M_PENDATA
? (wxDash
*)M_PENDATA
->m_dash
: (wxDash
*) NULL
);
84 return (M_PENDATA
? M_PENDATA
->m_nbDash
: 0);
86 inline int GetDashCount() const { return (M_PENDATA
->m_nbDash
); }
87 inline wxDash
* GetDash() const { return (wxDash
*)M_PENDATA
->m_dash
; }
89 inline wxBitmap
*GetStipple() const { return (M_PENDATA
? (& M_PENDATA
->m_stipple
) : (wxBitmap
*) NULL
); };
93 // Useful helper: create the brush resource
94 bool RealizeResource();
96 // When setting properties, we must make sure we're not changing