]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/classic/pen.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/classic/pen.h
3 // Purpose: wxPen class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/gdiobj.h"
16 #include "wx/colour.h"
17 #include "wx/bitmap.h"
19 class WXDLLEXPORT wxPen
;
21 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
23 friend class WXDLLEXPORT wxPen
;
26 wxPenRefData(const wxPenRefData
& data
);
27 virtual ~wxPenRefData();
29 wxPenRefData
& operator=(const wxPenRefData
& data
);
40 /* TODO: implementation
45 #define M_PENDATA ((wxPenRefData *)m_refData)
48 class WXDLLEXPORT wxPen
: public wxGDIObject
50 DECLARE_DYNAMIC_CLASS(wxPen
)
53 wxPen(const wxColour
& col
, int width
= 1, int style
= wxSOLID
);
54 wxPen(const wxBitmap
& stipple
, int width
);
57 inline bool operator == (const wxPen
& pen
) const { return m_refData
== pen
.m_refData
; }
58 inline bool operator != (const wxPen
& pen
) const { return m_refData
!= pen
.m_refData
; }
60 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
62 // Override in order to recreate the pen
63 void SetColour(const wxColour
& col
) ;
64 void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) ;
66 void SetWidth(int width
) ;
67 void SetStyle(int style
) ;
68 void SetStipple(const wxBitmap
& stipple
) ;
69 void SetDashes(int nb_dashes
, const wxDash
*dash
) ;
70 void SetJoin(int join
) ;
71 void SetCap(int cap
) ;
73 inline wxColour
& GetColour() const { return (M_PENDATA
? M_PENDATA
->m_colour
: wxNullColour
); };
74 inline int GetWidth() const { return (M_PENDATA
? M_PENDATA
->m_width
: 0); };
75 inline int GetStyle() const { return (M_PENDATA
? M_PENDATA
->m_style
: 0); };
76 inline int GetJoin() const { return (M_PENDATA
? M_PENDATA
->m_join
: 0); };
77 inline int GetCap() const { return (M_PENDATA
? M_PENDATA
->m_cap
: 0); };
78 inline int GetDashes(wxDash
**ptr
) const {
79 *ptr
= (M_PENDATA
? M_PENDATA
->m_dash
: (wxDash
*) NULL
); return (M_PENDATA
? M_PENDATA
->m_nbDash
: 0);
82 inline wxBitmap
*GetStipple() const { return (M_PENDATA
? (& M_PENDATA
->m_stipple
) : (wxBitmap
*) NULL
); };
86 // Useful helper: create the brush resource
87 bool RealizeResource();
89 // When setting properties, we must make sure we're not changing