Define __VISUALC__ for ICC under Windows again.
[wxWidgets.git] / include / wx / pen.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/pen.h
3 // Purpose: Base header for wxPen
4 // Author: Julian Smart
5 // Modified by:
6 // Created:
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows Licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_PEN_H_BASE_
12 #define _WX_PEN_H_BASE_
13
14 #include "wx/gdiobj.h"
15 #include "wx/gdicmn.h"
16
17 enum wxPenStyle
18 {
19 wxPENSTYLE_INVALID = -1,
20
21 wxPENSTYLE_SOLID = wxSOLID,
22 wxPENSTYLE_DOT = wxDOT,
23 wxPENSTYLE_LONG_DASH = wxLONG_DASH,
24 wxPENSTYLE_SHORT_DASH = wxSHORT_DASH,
25 wxPENSTYLE_DOT_DASH = wxDOT_DASH,
26 wxPENSTYLE_USER_DASH = wxUSER_DASH,
27
28 wxPENSTYLE_TRANSPARENT = wxTRANSPARENT,
29
30 wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
31 wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
32 wxPENSTYLE_STIPPLE = wxSTIPPLE,
33
34 wxPENSTYLE_BDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
35 wxPENSTYLE_CROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
36 wxPENSTYLE_FDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
37 wxPENSTYLE_CROSS_HATCH = wxHATCHSTYLE_CROSS,
38 wxPENSTYLE_HORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
39 wxPENSTYLE_VERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
40 wxPENSTYLE_FIRST_HATCH = wxHATCHSTYLE_FIRST,
41 wxPENSTYLE_LAST_HATCH = wxHATCHSTYLE_LAST
42 };
43
44 enum wxPenJoin
45 {
46 wxJOIN_INVALID = -1,
47
48 wxJOIN_BEVEL = 120,
49 wxJOIN_MITER,
50 wxJOIN_ROUND
51 };
52
53 enum wxPenCap
54 {
55 wxCAP_INVALID = -1,
56
57 wxCAP_ROUND = 130,
58 wxCAP_PROJECTING,
59 wxCAP_BUTT
60 };
61
62
63 class WXDLLIMPEXP_CORE wxPenBase : public wxGDIObject
64 {
65 public:
66 virtual ~wxPenBase() { }
67
68 virtual void SetColour(const wxColour& col) = 0;
69 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
70
71 virtual void SetWidth(int width) = 0;
72 virtual void SetStyle(wxPenStyle style) = 0;
73 virtual void SetStipple(const wxBitmap& stipple) = 0;
74 virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0;
75 virtual void SetJoin(wxPenJoin join) = 0;
76 virtual void SetCap(wxPenCap cap) = 0;
77
78 virtual wxColour GetColour() const = 0;
79 virtual wxBitmap *GetStipple() const = 0;
80 virtual wxPenStyle GetStyle() const = 0;
81 virtual wxPenJoin GetJoin() const = 0;
82 virtual wxPenCap GetCap() const = 0;
83 virtual int GetWidth() const = 0;
84 virtual int GetDashes(wxDash **ptr) const = 0;
85
86 // Convenient helpers for testing whether the pen is a transparent one:
87 // unlike GetStyle() == wxPENSTYLE_TRANSPARENT, they work correctly even if
88 // the pen is invalid (they both return false in this case).
89 bool IsTransparent() const
90 {
91 return IsOk() && GetStyle() == wxPENSTYLE_TRANSPARENT;
92 }
93
94 bool IsNonTransparent() const
95 {
96 return IsOk() && GetStyle() != wxPENSTYLE_TRANSPARENT;
97 }
98 };
99
100 #if defined(__WXMSW__)
101 #include "wx/msw/pen.h"
102 #elif defined(__WXMOTIF__) || defined(__WXX11__)
103 #include "wx/x11/pen.h"
104 #elif defined(__WXGTK20__)
105 #include "wx/gtk/pen.h"
106 #elif defined(__WXGTK__)
107 #include "wx/gtk1/pen.h"
108 #elif defined(__WXDFB__)
109 #include "wx/dfb/pen.h"
110 #elif defined(__WXMAC__)
111 #include "wx/osx/pen.h"
112 #elif defined(__WXCOCOA__)
113 #include "wx/cocoa/pen.h"
114 #elif defined(__WXPM__)
115 #include "wx/os2/pen.h"
116 #endif
117
118 class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
119 {
120 public:
121 wxPen *FindOrCreatePen(const wxColour& colour,
122 int width = 1,
123 wxPenStyle style = wxPENSTYLE_SOLID);
124
125 #if FUTURE_WXWIN_COMPATIBILITY_3_0
126 wxPen *FindOrCreatePen(const wxColour& colour, int width, int style)
127 { return FindOrCreatePen(colour, width, (wxPenStyle)style); }
128 #endif
129 #if WXWIN_COMPATIBILITY_2_6
130 wxDEPRECATED( void AddPen(wxPen*) );
131 wxDEPRECATED( void RemovePen(wxPen*) );
132 #endif
133 };
134
135 extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList;
136
137 // provide comparison operators to allow code such as
138 //
139 // if ( pen.GetStyle() == wxTRANSPARENT )
140 //
141 // to compile without warnings which it would otherwise provoke from some
142 // compilers as it compares elements of different enums
143 #if FUTURE_WXWIN_COMPATIBILITY_3_0
144
145 // Unfortunately some compilers have ambiguity issues when enum comparisons are
146 // overloaded so we have to disable the overloads in this case, see
147 // wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
148 #ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
149
150 inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t)
151 {
152 return static_cast<int>(s) == static_cast<int>(t);
153 }
154
155 inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t)
156 {
157 return !(s == t);
158 }
159
160 #endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM
161
162 #endif // FUTURE_WXWIN_COMPATIBILITY_3_0
163
164 #endif // _WX_PEN_H_BASE_