]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/pen.h
79b162ecd1feb6b6f53622f481bd2ffd81ab2319
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"
21 typedef WXDWORD wxDash
;
23 class WXDLLEXPORT wxPen
;
25 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
27 friend class WXDLLEXPORT wxPen
;
30 wxPenRefData(const wxPenRefData
& data
);
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
, int style
);
54 wxPen(const wxBitmap
& stipple
, int width
);
55 inline wxPen(const wxPen
& pen
) { Ref(pen
); }
58 inline wxPen
& operator = (const wxPen
& pen
) { if (*this == pen
) return (*this); Ref(pen
); return *this; }
59 inline bool operator == (const wxPen
& pen
) { return m_refData
== pen
.m_refData
; }
60 inline bool operator != (const wxPen
& pen
) { return m_refData
!= pen
.m_refData
; }
62 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
64 // Override in order to recreate the pen
65 void SetColour(const wxColour
& col
) ;
66 void SetColour(unsigned char r
, unsigned char g
, unsigned char b
);
68 void SetWidth(int width
) ;
69 void SetStyle(int style
) ;
70 void SetStipple(const wxBitmap
& stipple
) ;
71 void SetDashes(int nb_dashes
, const wxDash
*dash
) ;
72 void SetJoin(int join
) ;
73 void SetCap(int cap
) ;
75 inline wxColour
& GetColour() const { return (M_PENDATA
? M_PENDATA
->m_colour
: wxNullColour
); };
76 inline int GetWidth() const { return (M_PENDATA
? M_PENDATA
->m_width
: 0); };
77 inline int GetStyle() const { return (M_PENDATA
? M_PENDATA
->m_style
: 0); };
78 inline int GetJoin() const { return (M_PENDATA
? M_PENDATA
->m_join
: 0); };
79 inline int GetCap() const { return (M_PENDATA
? M_PENDATA
->m_cap
: 0); };
80 inline int GetDashes(wxDash
**ptr
) const {
81 *ptr
= (M_PENDATA
? M_PENDATA
->m_dash
: NULL
); return (M_PENDATA
? M_PENDATA
->m_nbDash
: 0);
84 inline wxBitmap
*GetStipple() const { return (M_PENDATA
? (& M_PENDATA
->m_stipple
) : NULL
); };
87 bool RealizeResource();
88 bool FreeResource(bool force
= FALSE
);
89 WXHANDLE
GetResourceHandle() ;
94 int wx2msPenStyle(int wx_style
);