]> git.saurik.com Git - wxWidgets.git/blob - include/wx/pen.h
simplify wxEVT_MENU_OPEN/CLOSE generation
[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 // 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 #if WXWIN_COMPATIBILITY_2_8
19 #include "wx/brush.h" // needed for some deprecated declarations
20 #endif
21
22 enum wxPenStyle
23 {
24 #if WXWIN_COMPATIBILITY_2_8
25 /* start of deprecated values */
26 /* wxSOLID, wxTRANSPARENT, wxSTIPPLE are already defined in wxBrushStyle */
27 wxDOT = 101,
28 wxLONG_DASH = 102,
29 wxSHORT_DASH = 103,
30 wxDOT_DASH = 104,
31 wxUSER_DASH = 105,
32 /* end of deprecated values */
33
34 wxPENSTYLE_SOLID = wxSOLID,
35 wxPENSTYLE_DOT = wxDOT,
36 wxPENSTYLE_LONG_DASH = wxLONG_DASH,
37 wxPENSTYLE_SHORT_DASH = wxSHORT_DASH,
38 wxPENSTYLE_DOT_DASH = wxDOT_DASH,
39 wxPENSTYLE_USER_DASH = wxUSER_DASH,
40
41 wxPENSTYLE_TRANSPARENT = wxTRANSPARENT,
42
43 wxPENSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
44 wxPENSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
45 wxPENSTYLE_STIPPLE = wxSTIPPLE,
46
47 wxPENSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH,
48 wxPENSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH,
49 wxPENSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH,
50 wxPENSTYLE_CROSS_HATCH = wxCROSS_HATCH,
51 wxPENSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH,
52 wxPENSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH,
53
54 wxPENSTYLE_FIRST_HATCH = wxFIRST_HATCH,
55 wxPENSTYLE_LAST_HATCH = wxLAST_HATCH,
56
57 wxPENSTYLE_MAX
58 #else
59 wxPENSTYLE_SOLID,
60 wxPENSTYLE_DOT,
61 wxPENSTYLE_LONG_DASH,
62 wxPENSTYLE_SHORT_DASH,
63 wxPENSTYLE_DOT_DASH,
64 wxPENSTYLE_USER_DASH,
65
66 wxPENSTYLE_TRANSPARENT,
67
68 /* Pen Stippling. */
69 wxPENSTYLE_STIPPLE_MASK_OPAQUE,
70 /* mask is used for blitting monochrome using text fore and back ground colors */
71
72 wxPENSTYLE_STIPPLE_MASK,
73 /* mask is used for masking areas in the stipple bitmap (TO DO) */
74
75 wxPENSTYLE_STIPPLE,
76 /* drawn with a Pen, and without any Brush -- and it can be stippled. */
77
78 /* In wxWidgets < 2.6 use WX_HATCH macro */
79 /* to verify these wx*_HATCH are in style */
80 /* of wxBrush. In wxWidgets >= 2.6 use */
81 /* wxBrush::IsHatch() instead. */
82 wxPENSTYLE_BDIAGONAL_HATCH,
83 wxPENSTYLE_CROSSDIAG_HATCH,
84 wxPENSTYLE_FDIAGONAL_HATCH,
85 wxPENSTYLE_CROSS_HATCH,
86 wxPENSTYLE_HORIZONTAL_HATCH,
87 wxPENSTYLE_VERTICAL_HATCH,
88
89 wxPENSTYLE_FIRST_HATCH = wxPENSTYLE_BDIAGONAL_HATCH,
90 wxPENSTYLE_LAST_HATCH = wxPENSTYLE_VERTICAL_HATCH,
91
92 wxPENSTYLE_MAX
93 #endif
94 };
95
96 enum wxPenJoin
97 {
98 wxJOIN_INVALID = -1,
99
100 wxJOIN_BEVEL = 120,
101 wxJOIN_MITER,
102 wxJOIN_ROUND,
103 };
104
105 enum wxPenCap
106 {
107 wxCAP_INVALID = -1,
108
109 wxCAP_ROUND = 130,
110 wxCAP_PROJECTING,
111 wxCAP_BUTT
112 };
113
114
115 class WXDLLEXPORT wxPenBase : public wxGDIObject
116 {
117 public:
118 virtual ~wxPenBase() { }
119
120 virtual void SetColour(const wxColour& col) = 0;
121 virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) = 0;
122
123 virtual void SetWidth(int width) = 0;
124 virtual void SetStyle(wxPenStyle style) = 0;
125 virtual void SetStipple(const wxBitmap& stipple) = 0;
126 virtual void SetDashes(int nb_dashes, const wxDash *dash) = 0;
127 virtual void SetJoin(wxPenJoin join) = 0;
128 virtual void SetCap(wxPenCap cap) = 0;
129
130 virtual wxColour& GetColour() const = 0;
131 virtual wxBitmap *GetStipple() const = 0;
132 virtual wxPenStyle GetStyle() const = 0;
133 virtual wxPenJoin GetJoin() const = 0;
134 virtual wxPenCap GetCap() const = 0;
135 virtual int GetWidth() const = 0;
136 virtual int GetDashes(wxDash **ptr) const = 0;
137
138 #if WXWIN_COMPATIBILITY_2_8
139 void SetStyle(wxBrushStyle style)
140 { SetStyle((wxPenStyle)style); }
141 #endif
142 };
143
144 #if defined(__WXPALMOS__)
145 #include "wx/palmos/pen.h"
146 #elif defined(__WXMSW__)
147 #include "wx/msw/pen.h"
148 #elif defined(__WXMOTIF__) || defined(__WXX11__)
149 #include "wx/x11/pen.h"
150 #elif defined(__WXGTK20__)
151 #include "wx/gtk/pen.h"
152 #elif defined(__WXGTK__)
153 #include "wx/gtk1/pen.h"
154 #elif defined(__WXMGL__)
155 #include "wx/mgl/pen.h"
156 #elif defined(__WXDFB__)
157 #include "wx/dfb/pen.h"
158 #elif defined(__WXMAC__)
159 #include "wx/mac/pen.h"
160 #elif defined(__WXCOCOA__)
161 #include "wx/cocoa/pen.h"
162 #elif defined(__WXPM__)
163 #include "wx/os2/pen.h"
164 #endif
165
166 class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
167 {
168 public:
169 wxPen *FindOrCreatePen(const wxColour& colour, int width, wxPenStyle style);
170 #if WXWIN_COMPATIBILITY_2_6
171 wxDEPRECATED( void AddPen(wxPen*) );
172 wxDEPRECATED( void RemovePen(wxPen*) );
173 #endif
174 };
175
176 extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
177
178 #endif
179 // _WX_PEN_H_BASE_