]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/pen.h | |
3 | // Purpose: Base header for wxPen | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows Licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_PEN_H_BASE_ | |
13 | #define _WX_PEN_H_BASE_ | |
14 | ||
15 | #include "wx/gdiobj.h" | |
16 | #include "wx/gdicmn.h" | |
17 | ||
18 | enum wxPenStyle | |
19 | { | |
20 | wxPENSTYLE_INVALID = -1, | |
21 | ||
22 | wxPENSTYLE_SOLID = wxSOLID, | |
23 | wxPENSTYLE_DOT = wxDOT, | |
24 | wxPENSTYLE_LONG_DASH = wxLONG_DASH, | |
25 | wxPENSTYLE_SHORT_DASH = wxSHORT_DASH, | |
26 | wxPENSTYLE_DOT_DASH = wxDOT_DASH, | |
27 | wxPENSTYLE_USER_DASH = wxUSER_DASH, | |
28 | ||
29 | wxPENSTYLE_TRANSPARENT = wxTRANSPARENT, | |
30 | ||
31 | wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE, | |
32 | wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK, | |
33 | wxPENSTYLE_STIPPLE = wxSTIPPLE, | |
34 | ||
35 | wxPENSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH, | |
36 | wxPENSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH, | |
37 | wxPENSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH, | |
38 | wxPENSTYLE_CROSS_HATCH = wxCROSS_HATCH, | |
39 | wxPENSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH, | |
40 | wxPENSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH, | |
41 | ||
42 | wxPENSTYLE_FIRST_HATCH = wxFIRST_HATCH, | |
43 | wxPENSTYLE_LAST_HATCH = wxLAST_HATCH | |
44 | }; | |
45 | ||
46 | enum wxPenJoin | |
47 | { | |
48 | wxJOIN_INVALID = -1, | |
49 | ||
50 | wxJOIN_BEVEL = 120, | |
51 | wxJOIN_MITER, | |
52 | wxJOIN_ROUND | |
53 | }; | |
54 | ||
55 | enum wxPenCap | |
56 | { | |
57 | wxCAP_INVALID = -1, | |
58 | ||
59 | wxCAP_ROUND = 130, | |
60 | wxCAP_PROJECTING, | |
61 | wxCAP_BUTT | |
62 | }; | |
63 | ||
64 | ||
65 | class WXDLLEXPORT wxPenBase : public wxGDIObject | |
66 | { | |
67 | public: | |
68 | virtual ~wxPenBase() { } | |
69 | ||
70 | virtual void SetColour(const wxColour& col) = 0; | |
71 | virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0; | |
72 | ||
73 | virtual void SetWidth(int width) = 0; | |
74 | virtual void SetStyle(wxPenStyle style) = 0; | |
75 | virtual void SetStipple(const wxBitmap& stipple) = 0; | |
76 | virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0; | |
77 | virtual void SetJoin(wxPenJoin join) = 0; | |
78 | virtual void SetCap(wxPenCap cap) = 0; | |
79 | ||
80 | virtual wxColour& GetColour() const = 0; | |
81 | virtual wxBitmap *GetStipple() const = 0; | |
82 | virtual wxPenStyle GetStyle() const = 0; | |
83 | virtual wxPenJoin GetJoin() const = 0; | |
84 | virtual wxPenCap GetCap() const = 0; | |
85 | virtual int GetWidth() const = 0; | |
86 | virtual int GetDashes(wxDash **ptr) const = 0; | |
87 | ||
88 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
89 | wxDEPRECATED_FUTURE( void SetStyle(int style) ) | |
90 | { SetStyle((wxPenStyle)style); } | |
91 | #endif | |
92 | }; | |
93 | ||
94 | #if defined(__WXPALMOS__) | |
95 | #include "wx/palmos/pen.h" | |
96 | #elif defined(__WXMSW__) | |
97 | #include "wx/msw/pen.h" | |
98 | #elif defined(__WXMOTIF__) || defined(__WXX11__) | |
99 | #include "wx/x11/pen.h" | |
100 | #elif defined(__WXGTK20__) | |
101 | #include "wx/gtk/pen.h" | |
102 | #elif defined(__WXGTK__) | |
103 | #include "wx/gtk1/pen.h" | |
104 | #elif defined(__WXMGL__) | |
105 | #include "wx/mgl/pen.h" | |
106 | #elif defined(__WXDFB__) | |
107 | #include "wx/dfb/pen.h" | |
108 | #elif defined(__WXMAC__) | |
109 | #include "wx/mac/pen.h" | |
110 | #elif defined(__WXCOCOA__) | |
111 | #include "wx/cocoa/pen.h" | |
112 | #elif defined(__WXPM__) | |
113 | #include "wx/os2/pen.h" | |
114 | #endif | |
115 | ||
116 | class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase | |
117 | { | |
118 | public: | |
119 | wxPen *FindOrCreatePen(const wxColour& colour, | |
120 | int width = 1, | |
121 | wxPenStyle style = wxPENSTYLE_SOLID); | |
122 | ||
123 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
124 | wxPen *FindOrCreatePen(const wxColour& colour, int width, int style) | |
125 | { return FindOrCreatePen(colour, width, (wxPenStyle)style); } | |
126 | #endif | |
127 | #if WXWIN_COMPATIBILITY_2_6 | |
128 | wxDEPRECATED( void AddPen(wxPen*) ); | |
129 | wxDEPRECATED( void RemovePen(wxPen*) ); | |
130 | #endif | |
131 | }; | |
132 | ||
133 | extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList; | |
134 | ||
135 | // provide comparison operators to allow code such as | |
136 | // | |
137 | // if ( pen.GetStyle() == wxTRANSPARENT ) | |
138 | // | |
139 | // to compile without warnings which it would otherwise provoke from some | |
140 | // compilers as it compares elements of different enums | |
141 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
142 | ||
143 | inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t) | |
144 | { | |
145 | return wx_static_cast(int, s) == wx_static_cast(int, t); | |
146 | } | |
147 | ||
148 | inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t) | |
149 | { | |
150 | return !(s == t); | |
151 | } | |
152 | ||
153 | #endif // FUTURE_WXWIN_COMPATIBILITY_3_0 | |
154 | ||
155 | #endif // _WX_PEN_H_BASE_ |