]>
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"
21 #include "wx/colour.h"
23 typedef WXDWORD wxMSWDash
;
25 class WXDLLEXPORT wxPen
;
27 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
29 friend class WXDLLEXPORT wxPen
;
32 wxPenRefData(const wxPenRefData
& data
);
48 // DECLARE_NO_COPY_CLASS(wxPenRefData)
49 // because copy constructor is explicitly declared above;
50 // but no copy assignment operator is defined, so declare
51 // it private to prevent the compiler from defining it:
52 wxPenRefData
& operator=(const wxPenRefData
&);
55 #define M_PENDATA ((wxPenRefData *)m_refData)
58 class WXDLLEXPORT wxPen
: public wxGDIObject
60 DECLARE_DYNAMIC_CLASS(wxPen
)
63 wxPen(const wxColour
& col
, int width
, int style
);
64 wxPen(const wxBitmap
& stipple
, int width
);
65 inline wxPen(const wxPen
& pen
) { Ref(pen
); }
68 inline wxPen
& operator = (const wxPen
& pen
) { if (*this == pen
) return (*this); Ref(pen
); return *this; }
69 inline bool operator == (const wxPen
& pen
) const { return m_refData
== pen
.m_refData
; }
70 inline bool operator != (const wxPen
& pen
) const { return m_refData
!= pen
.m_refData
; }
72 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
74 // Override in order to recreate the pen
75 void SetColour(const wxColour
& col
) ;
76 void SetColour(unsigned char r
, unsigned char g
, unsigned char b
);
78 void SetWidth(int width
) ;
79 void SetStyle(int style
) ;
80 void SetStipple(const wxBitmap
& stipple
) ;
81 void SetDashes(int nb_dashes
, const wxDash
*dash
) ;
82 void SetJoin(int join
) ;
83 void SetCap(int cap
) ;
85 inline wxColour
& GetColour() const { return (M_PENDATA
? M_PENDATA
->m_colour
: wxNullColour
); };
86 inline int GetWidth() const { return (M_PENDATA
? M_PENDATA
->m_width
: 0); };
87 inline int GetStyle() const { return (M_PENDATA
? M_PENDATA
->m_style
: 0); };
88 inline int GetJoin() const { return (M_PENDATA
? M_PENDATA
->m_join
: 0); };
89 inline int GetCap() const { return (M_PENDATA
? M_PENDATA
->m_cap
: 0); };
90 inline int GetDashes(wxDash
**ptr
) const
92 *ptr
= (M_PENDATA
? (wxDash
*)M_PENDATA
->m_dash
: (wxDash
*) NULL
);
93 return (M_PENDATA
? M_PENDATA
->m_nbDash
: 0);
96 inline wxBitmap
*GetStipple() const { return (M_PENDATA
? (& M_PENDATA
->m_stipple
) : (wxBitmap
*) NULL
); };
99 bool RealizeResource();
100 bool FreeResource(bool force
= FALSE
);
101 WXHANDLE
GetResourceHandle() const;
106 int wx2msPenStyle(int wx_style
);