]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/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/bitmap.h"
22 typedef WXDWORD wxMSWDash
;
24 class WXDLLEXPORT wxPen
;
26 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
28 friend class WXDLLEXPORT wxPen
;
31 wxPenRefData(const wxPenRefData
& data
);
47 // DECLARE_NO_COPY_CLASS(wxPenRefData)
48 // because copy constructor is explicitly declared above;
49 // but no copy assignment operator is defined, so declare
50 // it private to prevent the compiler from defining it:
51 wxPenRefData
& operator=(const wxPenRefData
&);
54 #define M_PENDATA ((wxPenRefData *)m_refData)
57 class WXDLLEXPORT wxPen
: public wxGDIObject
59 DECLARE_DYNAMIC_CLASS(wxPen
)
62 wxPen(const wxColour
& col
, int width
, int style
);
63 wxPen(const wxBitmap
& stipple
, int width
);
64 inline wxPen(const wxPen
& pen
) { Ref(pen
); }
67 inline wxPen
& operator = (const wxPen
& pen
) { if (*this == pen
) return (*this); Ref(pen
); return *this; }
68 inline bool operator == (const wxPen
& pen
) const { return m_refData
== pen
.m_refData
; }
69 inline bool operator != (const wxPen
& pen
) const { return m_refData
!= pen
.m_refData
; }
71 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
73 // Override in order to recreate the pen
74 void SetColour(const wxColour
& col
) ;
75 void SetColour(unsigned char r
, unsigned char g
, unsigned char b
);
77 void SetWidth(int width
) ;
78 void SetStyle(int style
) ;
79 void SetStipple(const wxBitmap
& stipple
) ;
80 void SetDashes(int nb_dashes
, const wxDash
*dash
) ;
81 void SetJoin(int join
) ;
82 void SetCap(int cap
) ;
84 inline wxColour
& GetColour() const { return (M_PENDATA
? M_PENDATA
->m_colour
: wxNullColour
); };
85 inline int GetWidth() const { return (M_PENDATA
? M_PENDATA
->m_width
: 0); };
86 inline int GetStyle() const { return (M_PENDATA
? M_PENDATA
->m_style
: 0); };
87 inline int GetJoin() const { return (M_PENDATA
? M_PENDATA
->m_join
: 0); };
88 inline int GetCap() const { return (M_PENDATA
? M_PENDATA
->m_cap
: 0); };
89 inline int GetDashes(wxDash
**ptr
) const
91 *ptr
= (M_PENDATA
? (wxDash
*)M_PENDATA
->m_dash
: (wxDash
*) NULL
);
92 return (M_PENDATA
? M_PENDATA
->m_nbDash
: 0);
95 inline wxBitmap
*GetStipple() const { return (M_PENDATA
? (& M_PENDATA
->m_stipple
) : (wxBitmap
*) NULL
); };
98 bool RealizeResource();
99 bool FreeResource(bool force
= FALSE
);
100 WXHANDLE
GetResourceHandle() const;
105 int wx2msPenStyle(int wx_style
);