]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/stubs/pen.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPen class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "pen.h"
19 #include "wx/gdiobj.h"
20 #include "wx/colour.h"
21 #include "wx/bitmap.h"
23 // PORTERS, NB: this typedef is the platform specific type for dashes..
24 // change all occurences of XSTUBX in pen.h and pen.cpp to something
25 // meaningful for your port (eg. wxMSWDash, wxGTKDash) and change the
26 // type from long to whatever your platform requires.
28 typedef long wxXSTUBXDash
;
30 // wxDash is typedef'd in gdicmn.h and is the type that should be used
31 // for all public interfaces. Convert parameters to the wxXSTUBXDash
32 // type for use inside the platform specific methods, and cast them
33 // back to wxDash again before passing back to the user. -- RL
35 class WXDLLEXPORT wxPen
;
37 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
39 friend class WXDLLEXPORT wxPen
;
42 wxPenRefData(const wxPenRefData
& data
);
54 /* TODO: implementation
59 #define M_PENDATA ((wxPenRefData *)m_refData)
62 class WXDLLEXPORT wxPen
: public wxGDIObject
64 DECLARE_DYNAMIC_CLASS(wxPen
)
67 wxPen(const wxColour
& col
, int width
, int style
);
68 wxPen(const wxBitmap
& stipple
, int width
);
69 inline wxPen(const wxPen
& pen
) { Ref(pen
); }
72 inline wxPen
& operator = (const wxPen
& pen
) { if (*this == pen
) return (*this); Ref(pen
); return *this; }
73 inline bool operator == (const wxPen
& pen
) { return m_refData
== pen
.m_refData
; }
74 inline bool operator != (const wxPen
& pen
) { return m_refData
!= pen
.m_refData
; }
76 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
78 // Override in order to recreate the pen
79 void SetColour(const wxColour
& col
) ;
80 void SetColour(unsigned char r
, unsigned char g
, unsigned char b
) ;
82 void SetWidth(int width
) ;
83 void SetStyle(int style
) ;
84 void SetStipple(const wxBitmap
& stipple
) ;
85 void SetDashes(int nb_dashes
, const wxDash
*dash
) ;
86 void SetJoin(int join
) ;
87 void SetCap(int cap
) ;
89 inline wxColour
& GetColour() const { return (M_PENDATA
? M_PENDATA
->m_colour
: wxNullColour
); };
90 inline int GetWidth() const { return (M_PENDATA
? M_PENDATA
->m_width
: 0); };
91 inline int GetStyle() const { return (M_PENDATA
? M_PENDATA
->m_style
: 0); };
92 inline int GetJoin() const { return (M_PENDATA
? M_PENDATA
->m_join
: 0); };
93 inline int GetCap() const { return (M_PENDATA
? M_PENDATA
->m_cap
: 0); };
94 inline int GetDashes(wxDash
**ptr
) const
96 *ptr
= (M_PENDATA
? (wxDash
*)M_PENDATA
->m_dash
: (wxDash
*)NULL
);
97 return (M_PENDATA
? M_PENDATA
->m_nbDash
: 0);
100 inline wxBitmap
*GetStipple() const { return (M_PENDATA
? (& M_PENDATA
->m_stipple
) : (wxBitmap
*) NULL
); };
104 // Useful helper: create the brush resource
105 bool RealizeResource();
107 // When setting properties, we must make sure we're not changing