]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/pen.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPen class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/gdiobj.h"
16 #include "wx/bitmap.h"
18 typedef long wxPMDash
;
20 class WXDLLEXPORT wxPen
;
22 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
24 friend class WXDLLEXPORT wxPen
;
27 wxPenRefData(const wxPenRefData
& data
);
42 #define M_PENDATA ((wxPenRefData *)m_refData)
45 class WXDLLEXPORT wxPen
: public wxGDIObject
47 DECLARE_DYNAMIC_CLASS(wxPen
)
50 wxPen(const wxColour
& col
, int width
, int style
);
51 wxPen(const wxBitmap
& stipple
, int width
);
52 inline wxPen(const wxPen
& pen
) { Ref(pen
); }
55 inline wxPen
& operator = (const wxPen
& pen
) { if (*this == pen
) return (*this); Ref(pen
); return *this; }
56 inline bool operator == (const wxPen
& pen
) { return m_refData
== pen
.m_refData
; }
57 inline bool operator != (const wxPen
& pen
) { return m_refData
!= pen
.m_refData
; }
59 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
61 // Override in order to recreate the pen
62 void SetColour(const wxColour
& col
) ;
63 void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) ;
65 void SetWidth(int width
) ;
66 void SetStyle(int style
) ;
67 void SetStipple(const wxBitmap
& stipple
) ;
68 void SetDashes(int nb_dashes
, const wxDash
*dash
) ;
69 void SetJoin(int join
) ;
70 void SetCap(int cap
) ;
72 inline wxColour
& GetColour() const { return (M_PENDATA
? M_PENDATA
->m_colour
: wxNullColour
); };
73 inline int GetWidth() const { return (M_PENDATA
? M_PENDATA
->m_width
: 0); };
74 inline int GetStyle() const { return (M_PENDATA
? M_PENDATA
->m_style
: 0); };
75 inline int GetJoin() const { return (M_PENDATA
? M_PENDATA
->m_join
: 0); };
76 inline int GetCap() const { return (M_PENDATA
? M_PENDATA
->m_cap
: 0); };
77 inline int GetDashes(wxDash
**ptr
) const
79 *ptr
= (M_PENDATA
? (wxDash
*)M_PENDATA
->m_dash
: (wxDash
*) NULL
);
80 return (M_PENDATA
? M_PENDATA
->m_nbDash
: 0);
83 inline wxBitmap
*GetStipple() const { return (M_PENDATA
? (& M_PENDATA
->m_stipple
) : (wxBitmap
*) NULL
); };
87 // Useful helper: create the brush resource
88 bool RealizeResource();
89 bool FreeResource(bool force
= FALSE
);
90 WXHANDLE
GetResourceHandle() ;