]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
ca3e85cf | 2 | // Name: wx/gdicmn.h |
c801d85f KB |
3 | // Purpose: Common GDI classes, types and declarations |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
99d80019 | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_GDICMNH__ |
13 | #define _WX_GDICMNH__ | |
c801d85f | 14 | |
f03fc89f VZ |
15 | // --------------------------------------------------------------------------- |
16 | // headers | |
17 | // --------------------------------------------------------------------------- | |
18 | ||
2ecf902b | 19 | #include "wx/defs.h" |
c801d85f | 20 | #include "wx/list.h" |
34138703 | 21 | #include "wx/string.h" |
ed39ff57 | 22 | #include "wx/fontenc.h" |
f79f1604 | 23 | #include "wx/hashmap.h" |
bc14c8b2 | 24 | #include "wx/math.h" |
c801d85f | 25 | |
f03fc89f VZ |
26 | // --------------------------------------------------------------------------- |
27 | // forward declarations | |
28 | // --------------------------------------------------------------------------- | |
29 | ||
b5dbe15d VS |
30 | class WXDLLIMPEXP_FWD_CORE wxBitmap; |
31 | class WXDLLIMPEXP_FWD_CORE wxBrush; | |
32 | class WXDLLIMPEXP_FWD_CORE wxColour; | |
33 | class WXDLLIMPEXP_FWD_CORE wxCursor; | |
34 | class WXDLLIMPEXP_FWD_CORE wxFont; | |
35 | class WXDLLIMPEXP_FWD_CORE wxIcon; | |
36 | class WXDLLIMPEXP_FWD_CORE wxPalette; | |
37 | class WXDLLIMPEXP_FWD_CORE wxPen; | |
38 | class WXDLLIMPEXP_FWD_CORE wxRegion; | |
39 | class WXDLLIMPEXP_FWD_BASE wxString; | |
40 | class WXDLLIMPEXP_FWD_CORE wxIconBundle; | |
41 | class WXDLLIMPEXP_FWD_CORE wxPoint; | |
f03fc89f VZ |
42 | |
43 | // --------------------------------------------------------------------------- | |
44 | // constants | |
45 | // --------------------------------------------------------------------------- | |
46 | ||
47 | // Bitmap flags | |
2aeec9ec | 48 | enum wxBitmapType |
f03fc89f | 49 | { |
6d167489 VZ |
50 | wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility! |
51 | wxBITMAP_TYPE_BMP, | |
f03fc89f VZ |
52 | wxBITMAP_TYPE_BMP_RESOURCE, |
53 | wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, | |
54 | wxBITMAP_TYPE_ICO, | |
55 | wxBITMAP_TYPE_ICO_RESOURCE, | |
56 | wxBITMAP_TYPE_CUR, | |
57 | wxBITMAP_TYPE_CUR_RESOURCE, | |
58 | wxBITMAP_TYPE_XBM, | |
59 | wxBITMAP_TYPE_XBM_DATA, | |
60 | wxBITMAP_TYPE_XPM, | |
61 | wxBITMAP_TYPE_XPM_DATA, | |
4ca8531f DS |
62 | wxBITMAP_TYPE_TIFF, |
63 | wxBITMAP_TYPE_TIF = wxBITMAP_TYPE_TIFF, | |
64 | wxBITMAP_TYPE_TIFF_RESOURCE, | |
65 | wxBITMAP_TYPE_TIF_RESOURCE = wxBITMAP_TYPE_TIFF_RESOURCE, | |
f03fc89f VZ |
66 | wxBITMAP_TYPE_GIF, |
67 | wxBITMAP_TYPE_GIF_RESOURCE, | |
68 | wxBITMAP_TYPE_PNG, | |
69 | wxBITMAP_TYPE_PNG_RESOURCE, | |
70 | wxBITMAP_TYPE_JPEG, | |
71 | wxBITMAP_TYPE_JPEG_RESOURCE, | |
bcc46c75 SB |
72 | wxBITMAP_TYPE_PNM, |
73 | wxBITMAP_TYPE_PNM_RESOURCE, | |
6523d119 GRG |
74 | wxBITMAP_TYPE_PCX, |
75 | wxBITMAP_TYPE_PCX_RESOURCE, | |
6d167489 VZ |
76 | wxBITMAP_TYPE_PICT, |
77 | wxBITMAP_TYPE_PICT_RESOURCE, | |
78 | wxBITMAP_TYPE_ICON, | |
79 | wxBITMAP_TYPE_ICON_RESOURCE, | |
658974ae | 80 | wxBITMAP_TYPE_ANI, |
63f8abca | 81 | wxBITMAP_TYPE_IFF, |
3af706cc | 82 | wxBITMAP_TYPE_TGA, |
6d167489 VZ |
83 | wxBITMAP_TYPE_MACCURSOR, |
84 | wxBITMAP_TYPE_MACCURSOR_RESOURCE, | |
d75a69e8 FM |
85 | |
86 | wxBITMAP_TYPE_MAX, | |
f03fc89f VZ |
87 | wxBITMAP_TYPE_ANY = 50 |
88 | }; | |
89 | ||
89efaf2b FM |
90 | // Polygon filling mode |
91 | enum wxPolygonFillMode | |
92 | { | |
93 | wxODDEVEN_RULE = 1, | |
94 | wxWINDING_RULE | |
95 | }; | |
96 | ||
c801d85f | 97 | // Standard cursors |
f03fc89f VZ |
98 | enum wxStockCursor |
99 | { | |
100 | wxCURSOR_NONE, // should be 0 | |
101 | wxCURSOR_ARROW, | |
15dadf31 | 102 | wxCURSOR_RIGHT_ARROW, |
f03fc89f VZ |
103 | wxCURSOR_BULLSEYE, |
104 | wxCURSOR_CHAR, | |
105 | wxCURSOR_CROSS, | |
106 | wxCURSOR_HAND, | |
107 | wxCURSOR_IBEAM, | |
108 | wxCURSOR_LEFT_BUTTON, | |
109 | wxCURSOR_MAGNIFIER, | |
110 | wxCURSOR_MIDDLE_BUTTON, | |
111 | wxCURSOR_NO_ENTRY, | |
112 | wxCURSOR_PAINT_BRUSH, | |
113 | wxCURSOR_PENCIL, | |
114 | wxCURSOR_POINT_LEFT, | |
115 | wxCURSOR_POINT_RIGHT, | |
116 | wxCURSOR_QUESTION_ARROW, | |
117 | wxCURSOR_RIGHT_BUTTON, | |
118 | wxCURSOR_SIZENESW, | |
119 | wxCURSOR_SIZENS, | |
120 | wxCURSOR_SIZENWSE, | |
121 | wxCURSOR_SIZEWE, | |
122 | wxCURSOR_SIZING, | |
123 | wxCURSOR_SPRAYCAN, | |
124 | wxCURSOR_WAIT, | |
125 | wxCURSOR_WATCH, | |
126 | wxCURSOR_BLANK, | |
ae53c98c KB |
127 | #ifdef __WXGTK__ |
128 | wxCURSOR_DEFAULT, // standard X11 cursor | |
129 | #endif | |
5f7a6626 | 130 | #ifdef __WXMAC__ |
5d3e7b52 | 131 | wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow |
5f7a6626 | 132 | #endif |
c801d85f | 133 | #ifdef __X__ |
f03fc89f VZ |
134 | // Not yet implemented for Windows |
135 | wxCURSOR_CROSS_REVERSE, | |
136 | wxCURSOR_DOUBLE_ARROW, | |
137 | wxCURSOR_BASED_ARROW_UP, | |
ea804aad | 138 | wxCURSOR_BASED_ARROW_DOWN, |
f03fc89f | 139 | #endif // X11 |
83f96286 | 140 | wxCURSOR_ARROWWAIT, |
ca91e1eb | 141 | #ifdef __WXMAC__ |
87315ea2 FM |
142 | wxCURSOR_OPEN_HAND, |
143 | wxCURSOR_CLOSED_HAND, | |
ca91e1eb | 144 | #endif |
83f96286 | 145 | |
f03fc89f VZ |
146 | wxCURSOR_MAX |
147 | }; | |
148 | ||
943d28e4 | 149 | #ifndef __WXGTK__ |
87315ea2 | 150 | #define wxCURSOR_DEFAULT wxCURSOR_ARROW |
943d28e4 VZ |
151 | #endif |
152 | ||
ca91e1eb SC |
153 | #ifndef __WXMAC__ |
154 | // TODO CS supply openhand and closedhand cursors | |
87315ea2 FM |
155 | #define wxCURSOR_OPEN_HAND wxCURSOR_HAND |
156 | #define wxCURSOR_CLOSED_HAND wxCURSOR_HAND | |
ca91e1eb SC |
157 | #endif |
158 | ||
f03fc89f VZ |
159 | // --------------------------------------------------------------------------- |
160 | // macros | |
161 | // --------------------------------------------------------------------------- | |
162 | ||
e7092398 VZ |
163 | #if defined(__WINDOWS__) || defined(__WXPM__) |
164 | #define wxHAS_IMAGES_IN_RESOURCES | |
165 | #endif | |
166 | ||
f03fc89f VZ |
167 | /* Useful macro for creating icons portably, for example: |
168 | ||
3cb332c1 | 169 | wxIcon *icon = new wxICON(sample); |
f03fc89f VZ |
170 | |
171 | expands into: | |
172 | ||
e7092398 VZ |
173 | wxIcon *icon = new wxIcon("sample"); // On Windows |
174 | wxIcon *icon = new wxIcon(sample_xpm); // On wxGTK/Linux | |
f03fc89f VZ |
175 | */ |
176 | ||
327972e7 | 177 | #ifdef __WINDOWS__ |
f03fc89f | 178 | // Load from a resource |
2b5f62a0 | 179 | #define wxICON(X) wxIcon(wxT(#X)) |
1777b9bb DW |
180 | #elif defined(__WXPM__) |
181 | // Load from a resource | |
2b5f62a0 | 182 | #define wxICON(X) wxIcon(wxT(#X)) |
d8bfd727 VS |
183 | #elif defined(__WXDFB__) |
184 | // Initialize from an included XPM | |
e45080c1 | 185 | #define wxICON(X) wxIcon( X##_xpm ) |
f03fc89f VZ |
186 | #elif defined(__WXGTK__) |
187 | // Initialize from an included XPM | |
e45080c1 | 188 | #define wxICON(X) wxIcon( X##_xpm ) |
0532484d GD |
189 | #elif defined(__WXMAC__) |
190 | // Initialize from an included XPM | |
e45080c1 | 191 | #define wxICON(X) wxIcon( X##_xpm ) |
f03fc89f VZ |
192 | #elif defined(__WXMOTIF__) |
193 | // Initialize from an included XPM | |
194 | #define wxICON(X) wxIcon( X##_xpm ) | |
83df96d6 JS |
195 | #elif defined(__WXX11__) |
196 | // Initialize from an included XPM | |
197 | #define wxICON(X) wxIcon( X##_xpm ) | |
f03fc89f VZ |
198 | #else |
199 | // This will usually mean something on any platform | |
2b5f62a0 | 200 | #define wxICON(X) wxIcon(wxT(#X)) |
f03fc89f VZ |
201 | #endif // platform |
202 | ||
0c5d3e1c VZ |
203 | /* Another macro: this one is for portable creation of bitmaps. We assume that |
204 | under Unix bitmaps live in XPMs and under Windows they're in ressources. | |
205 | */ | |
206 | ||
327972e7 | 207 | #if defined(__WINDOWS__) || defined(__WXPM__) |
4ca8531f | 208 | #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_BMP_RESOURCE) |
d22004c4 WS |
209 | #elif defined(__WXGTK__) || \ |
210 | defined(__WXMOTIF__) || \ | |
211 | defined(__WXX11__) || \ | |
212 | defined(__WXMAC__) || \ | |
d8bfd727 | 213 | defined(__WXDFB__) || \ |
d22004c4 | 214 | defined(__WXCOCOA__) |
bab537dc | 215 | // Initialize from an included XPM |
e45080c1 | 216 | #define wxBITMAP(name) wxBitmap(name##_xpm) |
b8aa1680 | 217 | #else // other platforms |
0c5d3e1c VZ |
218 | #define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM) |
219 | #endif // platform | |
220 | ||
f03fc89f VZ |
221 | // =========================================================================== |
222 | // classes | |
223 | // =========================================================================== | |
c801d85f | 224 | |
f03fc89f VZ |
225 | // --------------------------------------------------------------------------- |
226 | // wxSize | |
227 | // --------------------------------------------------------------------------- | |
1e6feb95 | 228 | |
53a2db12 | 229 | class WXDLLIMPEXP_CORE wxSize |
c801d85f KB |
230 | { |
231 | public: | |
e6c96a7c | 232 | // members are public for compatibility, don't use them directly. |
72cdf4c9 | 233 | int x, y; |
f03fc89f VZ |
234 | |
235 | // constructors | |
7ee31b00 GD |
236 | wxSize() : x(0), y(0) { } |
237 | wxSize(int xx, int yy) : x(xx), y(yy) { } | |
f03fc89f VZ |
238 | |
239 | // no copy ctor or assignment operator - the defaults are ok | |
1e6feb95 | 240 | |
fc84bd05 WS |
241 | wxSize& operator+=(const wxSize& sz) { x += sz.x; y += sz.y; return *this; } |
242 | wxSize& operator-=(const wxSize& sz) { x -= sz.x; y -= sz.y; return *this; } | |
bc5e942b VZ |
243 | wxSize& operator/=(int i) { x /= i; y /= i; return *this; } |
244 | wxSize& operator*=(int i) { x *= i; y *= i; return *this; } | |
06d7b217 FM |
245 | wxSize& operator/=(unsigned int i) { x /= i; y /= i; return *this; } |
246 | wxSize& operator*=(unsigned int i) { x *= i; y *= i; return *this; } | |
247 | wxSize& operator/=(long i) { x /= i; y /= i; return *this; } | |
248 | wxSize& operator*=(long i) { x *= i; y *= i; return *this; } | |
249 | wxSize& operator/=(unsigned long i) { x /= i; y /= i; return *this; } | |
250 | wxSize& operator*=(unsigned long i) { x *= i; y *= i; return *this; } | |
ee08bdb5 FM |
251 | wxSize& operator/=(double i) { x = int(x/i); y = int(y/i); return *this; } |
252 | wxSize& operator*=(double i) { x = int(x*i); y = int(y*i); return *this; } | |
706f1421 | 253 | |
5b087ae2 VZ |
254 | void IncTo(const wxSize& sz) |
255 | { if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; } | |
256 | void DecTo(const wxSize& sz) | |
257 | { if ( sz.x < x ) x = sz.x; if ( sz.y < y ) y = sz.y; } | |
f03fc89f | 258 | |
23359747 | 259 | void IncBy(int dx, int dy) { x += dx; y += dy; } |
89b799cc | 260 | void IncBy(const wxPoint& pt); |
23359747 VZ |
261 | void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } |
262 | void IncBy(int d) { IncBy(d, d); } | |
263 | ||
264 | void DecBy(int dx, int dy) { IncBy(-dx, -dy); } | |
89b799cc | 265 | void DecBy(const wxPoint& pt); |
23359747 VZ |
266 | void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } |
267 | void DecBy(int d) { DecBy(d, d); } | |
268 | ||
269 | ||
c5bad604 RR |
270 | wxSize& Scale(float xscale, float yscale) |
271 | { x = (int)(x*xscale); y = (int)(y*yscale); return *this; } | |
8efb2907 | 272 | |
eddf46fe JS |
273 | // accessors |
274 | void Set(int xx, int yy) { x = xx; y = yy; } | |
72cdf4c9 VZ |
275 | void SetWidth(int w) { x = w; } |
276 | void SetHeight(int h) { y = h; } | |
cc775580 | 277 | |
72cdf4c9 VZ |
278 | int GetWidth() const { return x; } |
279 | int GetHeight() const { return y; } | |
f03fc89f | 280 | |
5d3e7b52 | 281 | bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } |
706f1421 VZ |
282 | |
283 | // combine this size with the other one replacing the default (i.e. equal | |
5d3e7b52 | 284 | // to wxDefaultCoord) components of this object with those of the other |
706f1421 VZ |
285 | void SetDefaults(const wxSize& size) |
286 | { | |
5d3e7b52 | 287 | if ( x == wxDefaultCoord ) |
706f1421 | 288 | x = size.x; |
5d3e7b52 | 289 | if ( y == wxDefaultCoord ) |
706f1421 VZ |
290 | y = size.y; |
291 | } | |
292 | ||
cc775580 | 293 | // compatibility |
72cdf4c9 VZ |
294 | int GetX() const { return x; } |
295 | int GetY() const { return y; } | |
c801d85f KB |
296 | }; |
297 | ||
bc5e942b VZ |
298 | inline bool operator==(const wxSize& s1, const wxSize& s2) |
299 | { | |
300 | return s1.x == s2.x && s1.y == s2.y; | |
301 | } | |
302 | ||
303 | inline bool operator!=(const wxSize& s1, const wxSize& s2) | |
304 | { | |
305 | return s1.x != s2.x || s1.y != s2.y; | |
306 | } | |
307 | ||
bc5e942b VZ |
308 | inline wxSize operator+(const wxSize& s1, const wxSize& s2) |
309 | { | |
310 | return wxSize(s1.x + s2.x, s1.y + s2.y); | |
311 | } | |
312 | ||
bc5e942b VZ |
313 | inline wxSize operator-(const wxSize& s1, const wxSize& s2) |
314 | { | |
315 | return wxSize(s1.x - s2.x, s1.y - s2.y); | |
316 | } | |
317 | ||
bc5e942b VZ |
318 | inline wxSize operator/(const wxSize& s, int i) |
319 | { | |
320 | return wxSize(s.x / i, s.y / i); | |
321 | } | |
322 | ||
bc5e942b VZ |
323 | inline wxSize operator*(const wxSize& s, int i) |
324 | { | |
325 | return wxSize(s.x * i, s.y * i); | |
326 | } | |
327 | ||
bc5e942b VZ |
328 | inline wxSize operator*(int i, const wxSize& s) |
329 | { | |
330 | return wxSize(s.x * i, s.y * i); | |
331 | } | |
332 | ||
06d7b217 FM |
333 | inline wxSize operator/(const wxSize& s, unsigned int i) |
334 | { | |
335 | return wxSize(s.x / i, s.y / i); | |
336 | } | |
337 | ||
338 | inline wxSize operator*(const wxSize& s, unsigned int i) | |
339 | { | |
340 | return wxSize(s.x * i, s.y * i); | |
341 | } | |
342 | ||
343 | inline wxSize operator*(unsigned int i, const wxSize& s) | |
344 | { | |
345 | return wxSize(s.x * i, s.y * i); | |
346 | } | |
347 | ||
348 | inline wxSize operator/(const wxSize& s, long i) | |
349 | { | |
350 | return wxSize(s.x / i, s.y / i); | |
351 | } | |
352 | ||
353 | inline wxSize operator*(const wxSize& s, long i) | |
354 | { | |
355 | return wxSize(s.x * i, s.y * i); | |
356 | } | |
357 | ||
358 | inline wxSize operator*(long i, const wxSize& s) | |
359 | { | |
360 | return wxSize(s.x * i, s.y * i); | |
361 | } | |
362 | ||
363 | inline wxSize operator/(const wxSize& s, unsigned long i) | |
364 | { | |
365 | return wxSize(s.x / i, s.y / i); | |
366 | } | |
367 | ||
368 | inline wxSize operator*(const wxSize& s, unsigned long i) | |
369 | { | |
370 | return wxSize(s.x * i, s.y * i); | |
371 | } | |
372 | ||
373 | inline wxSize operator*(unsigned long i, const wxSize& s) | |
374 | { | |
375 | return wxSize(s.x * i, s.y * i); | |
376 | } | |
377 | ||
91743643 FM |
378 | inline wxSize operator*(const wxSize& s, double i) |
379 | { | |
ee08bdb5 | 380 | return wxSize(int(s.x * i), int(s.y * i)); |
91743643 FM |
381 | } |
382 | ||
383 | inline wxSize operator*(double i, const wxSize& s) | |
384 | { | |
ee08bdb5 | 385 | return wxSize(int(s.x * i), int(s.y * i)); |
91743643 | 386 | } |
bc5e942b VZ |
387 | |
388 | ||
389 | ||
f03fc89f VZ |
390 | // --------------------------------------------------------------------------- |
391 | // Point classes: with real or integer coordinates | |
392 | // --------------------------------------------------------------------------- | |
764a3a49 | 393 | |
53a2db12 | 394 | class WXDLLIMPEXP_CORE wxRealPoint |
c801d85f | 395 | { |
f03fc89f VZ |
396 | public: |
397 | double x; | |
398 | double y; | |
399 | ||
7ee31b00 GD |
400 | wxRealPoint() : x(0.0), y(0.0) { } |
401 | wxRealPoint(double xx, double yy) : x(xx), y(yy) { } | |
a5664fd6 | 402 | wxRealPoint(const wxPoint& pt); |
89b799cc | 403 | |
a5664fd6 FM |
404 | // no copy ctor or assignment operator - the defaults are ok |
405 | ||
406 | //assignment operators | |
407 | wxRealPoint& operator+=(const wxRealPoint& p) { x += p.x; y += p.y; return *this; } | |
408 | wxRealPoint& operator-=(const wxRealPoint& p) { x -= p.x; y -= p.y; return *this; } | |
409 | ||
410 | wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
411 | wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
bc5e942b | 412 | }; |
f03fc89f | 413 | |
f03fc89f | 414 | |
bc5e942b VZ |
415 | inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2) |
416 | { | |
417 | return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y); | |
418 | } | |
419 | ||
bc5e942b VZ |
420 | inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2) |
421 | { | |
422 | return !(p1 == p2); | |
423 | } | |
424 | ||
bc5e942b VZ |
425 | inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2) |
426 | { | |
427 | return wxRealPoint(p1.x + p2.x, p1.y + p2.y); | |
428 | } | |
429 | ||
430 | ||
431 | inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2) | |
432 | { | |
433 | return wxRealPoint(p1.x - p2.x, p1.y - p2.y); | |
434 | } | |
c801d85f | 435 | |
bc14c8b2 | 436 | |
8b655c80 FM |
437 | inline wxRealPoint operator/(const wxRealPoint& s, int i) |
438 | { | |
439 | return wxRealPoint(s.x / i, s.y / i); | |
440 | } | |
441 | ||
442 | inline wxRealPoint operator*(const wxRealPoint& s, int i) | |
443 | { | |
444 | return wxRealPoint(s.x * i, s.y * i); | |
445 | } | |
446 | ||
447 | inline wxRealPoint operator*(int i, const wxRealPoint& s) | |
448 | { | |
449 | return wxRealPoint(s.x * i, s.y * i); | |
450 | } | |
451 | ||
452 | inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i) | |
453 | { | |
454 | return wxRealPoint(s.x / i, s.y / i); | |
455 | } | |
456 | ||
457 | inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i) | |
458 | { | |
459 | return wxRealPoint(s.x * i, s.y * i); | |
460 | } | |
461 | ||
462 | inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s) | |
463 | { | |
464 | return wxRealPoint(s.x * i, s.y * i); | |
465 | } | |
466 | ||
467 | inline wxRealPoint operator/(const wxRealPoint& s, long i) | |
468 | { | |
469 | return wxRealPoint(s.x / i, s.y / i); | |
470 | } | |
471 | ||
472 | inline wxRealPoint operator*(const wxRealPoint& s, long i) | |
473 | { | |
474 | return wxRealPoint(s.x * i, s.y * i); | |
475 | } | |
476 | ||
477 | inline wxRealPoint operator*(long i, const wxRealPoint& s) | |
478 | { | |
479 | return wxRealPoint(s.x * i, s.y * i); | |
480 | } | |
481 | ||
482 | inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i) | |
483 | { | |
484 | return wxRealPoint(s.x / i, s.y / i); | |
485 | } | |
486 | ||
487 | inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i) | |
488 | { | |
489 | return wxRealPoint(s.x * i, s.y * i); | |
490 | } | |
491 | ||
492 | inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s) | |
493 | { | |
494 | return wxRealPoint(s.x * i, s.y * i); | |
495 | } | |
496 | ||
497 | inline wxRealPoint operator*(const wxRealPoint& s, double i) | |
498 | { | |
499 | return wxRealPoint(int(s.x * i), int(s.y * i)); | |
500 | } | |
501 | ||
502 | inline wxRealPoint operator*(double i, const wxRealPoint& s) | |
503 | { | |
504 | return wxRealPoint(int(s.x * i), int(s.y * i)); | |
505 | } | |
506 | ||
507 | ||
bc5e942b VZ |
508 | // ---------------------------------------------------------------------------- |
509 | // wxPoint: 2D point with integer coordinates | |
510 | // ---------------------------------------------------------------------------- | |
511 | ||
53a2db12 | 512 | class WXDLLIMPEXP_CORE wxPoint |
c801d85f | 513 | { |
f03fc89f | 514 | public: |
72cdf4c9 | 515 | int x, y; |
6a6c0a8b | 516 | |
7ee31b00 GD |
517 | wxPoint() : x(0), y(0) { } |
518 | wxPoint(int xx, int yy) : x(xx), y(yy) { } | |
fb0165df | 519 | wxPoint(const wxRealPoint& pt) : x(int(pt.x)), y(int(pt.y)) { } |
f03fc89f VZ |
520 | |
521 | // no copy ctor or assignment operator - the defaults are ok | |
6a6c0a8b | 522 | |
bc5e942b | 523 | //assignment operators |
764a3a49 VZ |
524 | wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } |
525 | wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } | |
d02bc4c8 JS |
526 | |
527 | wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
528 | wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
06cfc052 VZ |
529 | |
530 | // check if both components are set/initialized | |
531 | bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } | |
532 | ||
533 | // fill in the unset components with the values from the other point | |
534 | void SetDefaults(const wxPoint& pt) | |
535 | { | |
536 | if ( x == wxDefaultCoord ) | |
537 | x = pt.x; | |
538 | if ( y == wxDefaultCoord ) | |
539 | y = pt.y; | |
540 | } | |
bc5e942b | 541 | }; |
d02bc4c8 | 542 | |
24b800a9 | 543 | |
bc5e942b VZ |
544 | // comparison |
545 | inline bool operator==(const wxPoint& p1, const wxPoint& p2) | |
546 | { | |
547 | return p1.x == p2.x && p1.y == p2.y; | |
548 | } | |
549 | ||
550 | inline bool operator!=(const wxPoint& p1, const wxPoint& p2) | |
551 | { | |
552 | return !(p1 == p2); | |
553 | } | |
554 | ||
555 | ||
556 | // arithmetic operations (component wise) | |
557 | inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2) | |
558 | { | |
559 | return wxPoint(p1.x + p2.x, p1.y + p2.y); | |
560 | } | |
561 | ||
562 | inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2) | |
563 | { | |
564 | return wxPoint(p1.x - p2.x, p1.y - p2.y); | |
565 | } | |
566 | ||
567 | inline wxPoint operator+(const wxPoint& p, const wxSize& s) | |
568 | { | |
569 | return wxPoint(p.x + s.x, p.y + s.y); | |
570 | } | |
571 | ||
572 | inline wxPoint operator-(const wxPoint& p, const wxSize& s) | |
573 | { | |
574 | return wxPoint(p.x - s.x, p.y - s.y); | |
575 | } | |
576 | ||
577 | inline wxPoint operator+(const wxSize& s, const wxPoint& p) | |
578 | { | |
579 | return wxPoint(p.x + s.x, p.y + s.y); | |
580 | } | |
581 | ||
582 | inline wxPoint operator-(const wxSize& s, const wxPoint& p) | |
583 | { | |
584 | return wxPoint(s.x - p.x, s.y - p.y); | |
585 | } | |
586 | ||
587 | inline wxPoint operator-(const wxPoint& p) | |
588 | { | |
589 | return wxPoint(-p.x, -p.y); | |
590 | } | |
591 | ||
ed0dd9c1 FM |
592 | inline wxPoint operator/(const wxPoint& s, int i) |
593 | { | |
594 | return wxPoint(s.x / i, s.y / i); | |
595 | } | |
596 | ||
597 | inline wxPoint operator*(const wxPoint& s, int i) | |
598 | { | |
599 | return wxPoint(s.x * i, s.y * i); | |
600 | } | |
601 | ||
602 | inline wxPoint operator*(int i, const wxPoint& s) | |
603 | { | |
604 | return wxPoint(s.x * i, s.y * i); | |
605 | } | |
606 | ||
607 | inline wxPoint operator/(const wxPoint& s, unsigned int i) | |
608 | { | |
609 | return wxPoint(s.x / i, s.y / i); | |
610 | } | |
611 | ||
612 | inline wxPoint operator*(const wxPoint& s, unsigned int i) | |
613 | { | |
614 | return wxPoint(s.x * i, s.y * i); | |
615 | } | |
616 | ||
617 | inline wxPoint operator*(unsigned int i, const wxPoint& s) | |
618 | { | |
619 | return wxPoint(s.x * i, s.y * i); | |
620 | } | |
621 | ||
622 | inline wxPoint operator/(const wxPoint& s, long i) | |
623 | { | |
624 | return wxPoint(s.x / i, s.y / i); | |
625 | } | |
626 | ||
627 | inline wxPoint operator*(const wxPoint& s, long i) | |
628 | { | |
629 | return wxPoint(s.x * i, s.y * i); | |
630 | } | |
631 | ||
632 | inline wxPoint operator*(long i, const wxPoint& s) | |
633 | { | |
634 | return wxPoint(s.x * i, s.y * i); | |
635 | } | |
636 | ||
637 | inline wxPoint operator/(const wxPoint& s, unsigned long i) | |
638 | { | |
639 | return wxPoint(s.x / i, s.y / i); | |
640 | } | |
641 | ||
642 | inline wxPoint operator*(const wxPoint& s, unsigned long i) | |
643 | { | |
644 | return wxPoint(s.x * i, s.y * i); | |
645 | } | |
646 | ||
647 | inline wxPoint operator*(unsigned long i, const wxPoint& s) | |
648 | { | |
649 | return wxPoint(s.x * i, s.y * i); | |
650 | } | |
651 | ||
652 | inline wxPoint operator*(const wxPoint& s, double i) | |
653 | { | |
654 | return wxPoint(int(s.x * i), int(s.y * i)); | |
655 | } | |
656 | ||
657 | inline wxPoint operator*(double i, const wxPoint& s) | |
658 | { | |
659 | return wxPoint(int(s.x * i), int(s.y * i)); | |
660 | } | |
661 | ||
b0d7707b | 662 | WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE); |
c801d85f | 663 | |
f03fc89f VZ |
664 | // --------------------------------------------------------------------------- |
665 | // wxRect | |
666 | // --------------------------------------------------------------------------- | |
c801d85f | 667 | |
53a2db12 | 668 | class WXDLLIMPEXP_CORE wxRect |
6a6c0a8b | 669 | { |
c801d85f | 670 | public: |
7ee31b00 GD |
671 | wxRect() |
672 | : x(0), y(0), width(0), height(0) | |
673 | { } | |
72cdf4c9 | 674 | wxRect(int xx, int yy, int ww, int hh) |
7ee31b00 GD |
675 | : x(xx), y(yy), width(ww), height(hh) |
676 | { } | |
f03fc89f | 677 | wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); |
df83b840 VZ |
678 | wxRect(const wxPoint& pt, const wxSize& size) |
679 | : x(pt.x), y(pt.y), width(size.x), height(size.y) | |
680 | { } | |
681 | wxRect(const wxSize& size) | |
682 | : x(0), y(0), width(size.x), height(size.y) | |
683 | { } | |
a23fd0e1 VZ |
684 | |
685 | // default copy ctor and assignment operators ok | |
c801d85f | 686 | |
72cdf4c9 VZ |
687 | int GetX() const { return x; } |
688 | void SetX(int xx) { x = xx; } | |
c801d85f | 689 | |
72cdf4c9 VZ |
690 | int GetY() const { return y; } |
691 | void SetY(int yy) { y = yy; } | |
c801d85f | 692 | |
72cdf4c9 VZ |
693 | int GetWidth() const { return width; } |
694 | void SetWidth(int w) { width = w; } | |
c801d85f | 695 | |
72cdf4c9 VZ |
696 | int GetHeight() const { return height; } |
697 | void SetHeight(int h) { height = h; } | |
f03fc89f | 698 | |
dcb44466 | 699 | wxPoint GetPosition() const { return wxPoint(x, y); } |
4aa0010b RL |
700 | void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } |
701 | ||
dcb44466 | 702 | wxSize GetSize() const { return wxSize(width, height); } |
4aa0010b | 703 | void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } |
f03fc89f | 704 | |
b737ad10 RR |
705 | bool IsEmpty() const { return (width <= 0) || (height <= 0); } |
706 | ||
f790ec82 VZ |
707 | int GetLeft() const { return x; } |
708 | int GetTop() const { return y; } | |
709 | int GetBottom() const { return y + height - 1; } | |
710 | int GetRight() const { return x + width - 1; } | |
711 | ||
712 | void SetLeft(int left) { x = left; } | |
713 | void SetRight(int right) { width = right - x + 1; } | |
714 | void SetTop(int top) { y = top; } | |
715 | void SetBottom(int bottom) { height = bottom - y + 1; } | |
716 | ||
355a5e2b JS |
717 | wxPoint GetTopLeft() const { return GetPosition(); } |
718 | wxPoint GetLeftTop() const { return GetTopLeft(); } | |
719 | void SetTopLeft(const wxPoint &p) { SetPosition(p); } | |
720 | void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } | |
721 | ||
722 | wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } | |
723 | wxPoint GetRightBottom() const { return GetBottomRight(); } | |
724 | void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } | |
725 | void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } | |
726 | ||
f790ec82 VZ |
727 | wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } |
728 | wxPoint GetRightTop() const { return GetTopRight(); } | |
729 | void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } | |
afa111d5 | 730 | void SetRightTop(const wxPoint &p) { SetTopRight(p); } |
f03fc89f | 731 | |
f790ec82 VZ |
732 | wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } |
733 | wxPoint GetLeftBottom() const { return GetBottomLeft(); } | |
734 | void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); } | |
735 | void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); } | |
dcb44466 | 736 | |
1e6feb95 VZ |
737 | // operations with rect |
738 | wxRect& Inflate(wxCoord dx, wxCoord dy); | |
c2c4d939 | 739 | wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); } |
1e6feb95 VZ |
740 | wxRect& Inflate(wxCoord d) { return Inflate(d, d); } |
741 | wxRect Inflate(wxCoord dx, wxCoord dy) const | |
742 | { | |
743 | wxRect r = *this; | |
744 | r.Inflate(dx, dy); | |
745 | return r; | |
746 | } | |
747 | ||
748 | wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } | |
c2c4d939 | 749 | wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); } |
1e6feb95 VZ |
750 | wxRect& Deflate(wxCoord d) { return Inflate(-d); } |
751 | wxRect Deflate(wxCoord dx, wxCoord dy) const | |
752 | { | |
753 | wxRect r = *this; | |
754 | r.Deflate(dx, dy); | |
755 | return r; | |
756 | } | |
757 | ||
758 | void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } | |
759 | void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } | |
760 | ||
761 | wxRect& Intersect(const wxRect& rect); | |
762 | wxRect Intersect(const wxRect& rect) const | |
45816ddd | 763 | { |
1e6feb95 VZ |
764 | wxRect r = *this; |
765 | r.Intersect(rect); | |
766 | return r; | |
45816ddd VZ |
767 | } |
768 | ||
df83b840 VZ |
769 | wxRect& Union(const wxRect& rect); |
770 | wxRect Union(const wxRect& rect) const | |
771 | { | |
772 | wxRect r = *this; | |
773 | r.Union(rect); | |
774 | return r; | |
775 | } | |
45816ddd | 776 | |
5d3e7b52 | 777 | // return true if the point is (not strcitly) inside the rect |
22a35096 VS |
778 | bool Contains(int x, int y) const; |
779 | bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } | |
fc01e9b3 | 780 | // return true if the rectangle 'rect' is (not strictly) inside this rect |
22a35096 VS |
781 | bool Contains(const wxRect& rect) const; |
782 | ||
783 | #if WXWIN_COMPATIBILITY_2_6 | |
784 | // use Contains() instead | |
785 | wxDEPRECATED( bool Inside(int x, int y) const ); | |
786 | wxDEPRECATED( bool Inside(const wxPoint& pt) const ); | |
787 | wxDEPRECATED( bool Inside(const wxRect& rect) const ); | |
788 | #endif // WXWIN_COMPATIBILITY_2_6 | |
1e6feb95 | 789 | |
5d3e7b52 | 790 | // return true if the rectangles have a non empty intersection |
1e6feb95 | 791 | bool Intersects(const wxRect& rect) const; |
72cdf4c9 | 792 | |
bc5e942b VZ |
793 | // like Union() but don't ignore empty rectangles |
794 | wxRect& operator+=(const wxRect& rect); | |
df83b840 | 795 | |
bc5e942b VZ |
796 | // intersections of two rectrangles not testing for empty rectangles |
797 | wxRect& operator*=(const wxRect& rect); | |
df83b840 | 798 | |
1bfb73b8 VZ |
799 | // centre this rectangle in the given (usually, but not necessarily, |
800 | // larger) one | |
801 | wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const | |
802 | { | |
803 | return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x, | |
804 | dir & wxVERTICAL ? r.y + (r.height - height)/2 : y, | |
805 | width, height); | |
806 | } | |
807 | ||
808 | wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const | |
809 | { | |
810 | return CentreIn(r, dir); | |
811 | } | |
812 | ||
f03fc89f | 813 | public: |
72cdf4c9 | 814 | int x, y, width, height; |
f03fc89f | 815 | }; |
c801d85f | 816 | |
bc5e942b VZ |
817 | |
818 | // compare rectangles | |
819 | inline bool operator==(const wxRect& r1, const wxRect& r2) | |
820 | { | |
821 | return (r1.x == r2.x) && (r1.y == r2.y) && | |
822 | (r1.width == r2.width) && (r1.height == r2.height); | |
823 | } | |
824 | ||
825 | inline bool operator!=(const wxRect& r1, const wxRect& r2) | |
826 | { | |
827 | return !(r1 == r2); | |
828 | } | |
829 | ||
830 | // like Union() but don't treat empty rectangles specially | |
831 | WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2); | |
832 | ||
833 | // intersections of two rectangles | |
834 | WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2); | |
835 | ||
836 | ||
837 | ||
838 | ||
22a35096 | 839 | #if WXWIN_COMPATIBILITY_2_6 |
3e69f6e5 | 840 | inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } |
22a35096 VS |
841 | inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } |
842 | inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } | |
843 | #endif // WXWIN_COMPATIBILITY_2_6 | |
844 | ||
845 | ||
89b799cc VZ |
846 | // define functions which couldn't be defined above because of declarations |
847 | // order | |
848 | inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); } | |
849 | inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); } | |
850 | ||
f03fc89f | 851 | // --------------------------------------------------------------------------- |
c801d85f | 852 | // Management of pens, brushes and fonts |
f03fc89f VZ |
853 | // --------------------------------------------------------------------------- |
854 | ||
236a9de3 RL |
855 | typedef wxInt8 wxDash; |
856 | ||
1de8d512 | 857 | class WXDLLIMPEXP_CORE wxGDIObjListBase { |
f03fc89f | 858 | public: |
1de8d512 VZ |
859 | wxGDIObjListBase(); |
860 | ~wxGDIObjListBase(); | |
f03fc89f | 861 | |
1de8d512 VZ |
862 | protected: |
863 | wxList list; | |
c801d85f KB |
864 | }; |
865 | ||
f79f1604 PC |
866 | WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); |
867 | ||
53a2db12 | 868 | class WXDLLIMPEXP_CORE wxColourDatabase |
c801d85f | 869 | { |
f03fc89f | 870 | public: |
222ed1d6 | 871 | wxColourDatabase(); |
c50f92d0 | 872 | ~wxColourDatabase(); |
f03fc89f | 873 | |
c50f92d0 VZ |
874 | // find colour by name or name for the given colour |
875 | wxColour Find(const wxString& name) const; | |
f03fc89f | 876 | wxString FindName(const wxColour& colour) const; |
c50f92d0 VZ |
877 | |
878 | // add a new colour to the database | |
879 | void AddColour(const wxString& name, const wxColour& colour); | |
880 | ||
ca3e85cf | 881 | #if WXWIN_COMPATIBILITY_2_6 |
492e2a5b VZ |
882 | // deprecated, use Find() instead |
883 | wxDEPRECATED( wxColour *FindColour(const wxString& name) ); | |
ca3e85cf | 884 | #endif // WXWIN_COMPATIBILITY_2_6 |
c50f92d0 VZ |
885 | |
886 | ||
19bf0c69 DW |
887 | #ifdef __WXPM__ |
888 | // PM keeps its own type of colour table | |
889 | long* m_palTable; | |
890 | size_t m_nSize; | |
891 | #endif | |
c50f92d0 | 892 | |
222ed1d6 | 893 | private: |
c50f92d0 VZ |
894 | // load the database with the built in colour values when called for the |
895 | // first time, do nothing after this | |
896 | void Initialize(); | |
222ed1d6 | 897 | |
c50f92d0 | 898 | wxStringToColourHashMap *m_map; |
c801d85f KB |
899 | }; |
900 | ||
53a2db12 | 901 | class WXDLLIMPEXP_CORE wxResourceCache: public wxList |
f03fc89f VZ |
902 | { |
903 | public: | |
904 | wxResourceCache() { } | |
01871bf6 | 905 | #if !wxUSE_STD_CONTAINERS |
f03fc89f | 906 | wxResourceCache(const unsigned int keyType) : wxList(keyType) { } |
222ed1d6 | 907 | #endif |
d3c7fc99 | 908 | virtual ~wxResourceCache(); |
f03fc89f VZ |
909 | }; |
910 | ||
911 | // --------------------------------------------------------------------------- | |
912 | // global variables | |
913 | // --------------------------------------------------------------------------- | |
914 | ||
c801d85f | 915 | |
f516d986 VZ |
916 | /* Stock objects |
917 | ||
918 | wxStockGDI creates the stock GDI objects on demand. Pointers to the | |
919 | created objects are stored in the ms_stockObject array, which is indexed | |
920 | by the Item enum values. Platorm-specific fonts can be created by | |
921 | implementing a derived class with an override for the GetFont function. | |
922 | wxStockGDI operates as a singleton, accessed through the ms_instance | |
923 | pointer. By default this pointer is set to an instance of wxStockGDI. | |
924 | A derived class must arrange to set this pointer to an instance of itself. | |
925 | */ | |
926 | class WXDLLIMPEXP_CORE wxStockGDI | |
927 | { | |
928 | public: | |
929 | enum Item { | |
930 | BRUSH_BLACK, | |
931 | BRUSH_BLUE, | |
932 | BRUSH_CYAN, | |
933 | BRUSH_GREEN, | |
86028025 | 934 | BRUSH_YELLOW, |
f516d986 VZ |
935 | BRUSH_GREY, |
936 | BRUSH_LIGHTGREY, | |
937 | BRUSH_MEDIUMGREY, | |
938 | BRUSH_RED, | |
939 | BRUSH_TRANSPARENT, | |
940 | BRUSH_WHITE, | |
941 | COLOUR_BLACK, | |
942 | COLOUR_BLUE, | |
943 | COLOUR_CYAN, | |
944 | COLOUR_GREEN, | |
86028025 | 945 | COLOUR_YELLOW, |
f516d986 VZ |
946 | COLOUR_LIGHTGREY, |
947 | COLOUR_RED, | |
948 | COLOUR_WHITE, | |
949 | CURSOR_CROSS, | |
950 | CURSOR_HOURGLASS, | |
951 | CURSOR_STANDARD, | |
952 | FONT_ITALIC, | |
953 | FONT_NORMAL, | |
954 | FONT_SMALL, | |
955 | FONT_SWISS, | |
956 | PEN_BLACK, | |
957 | PEN_BLACKDASHED, | |
d8184587 | 958 | PEN_BLUE, |
f516d986 VZ |
959 | PEN_CYAN, |
960 | PEN_GREEN, | |
86028025 | 961 | PEN_YELLOW, |
f516d986 VZ |
962 | PEN_GREY, |
963 | PEN_LIGHTGREY, | |
964 | PEN_MEDIUMGREY, | |
965 | PEN_RED, | |
966 | PEN_TRANSPARENT, | |
967 | PEN_WHITE, | |
968 | ITEMCOUNT | |
969 | }; | |
970 | ||
971 | wxStockGDI(); | |
972 | virtual ~wxStockGDI(); | |
973 | static void DeleteAll(); | |
974 | ||
975 | static wxStockGDI& instance() { return *ms_instance; } | |
976 | ||
977 | static const wxBrush* GetBrush(Item item); | |
978 | static const wxColour* GetColour(Item item); | |
979 | static const wxCursor* GetCursor(Item item); | |
980 | // Can be overridden by platform-specific derived classes | |
981 | virtual const wxFont* GetFont(Item item); | |
982 | static const wxPen* GetPen(Item item); | |
983 | ||
984 | protected: | |
985 | static wxStockGDI* ms_instance; | |
986 | ||
987 | static wxObject* ms_stockObject[ITEMCOUNT]; | |
988 | ||
c0c133e1 | 989 | wxDECLARE_NO_COPY_CLASS(wxStockGDI); |
f516d986 VZ |
990 | }; |
991 | ||
992 | #define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) | |
993 | #define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL) | |
994 | #define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL) | |
995 | #define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS) | |
996 | ||
997 | #define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) | |
998 | #define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) | |
d8184587 | 999 | #define wxBLUE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLUE) |
f516d986 VZ |
1000 | #define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) |
1001 | #define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) | |
86028025 | 1002 | #define wxYELLOW_PEN wxStockGDI::GetPen(wxStockGDI::PEN_YELLOW) |
f516d986 VZ |
1003 | #define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) |
1004 | #define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) | |
1005 | #define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) | |
1006 | #define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED) | |
1007 | #define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT) | |
1008 | #define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE) | |
1009 | ||
1010 | #define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK) | |
1011 | #define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) | |
1012 | #define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) | |
1013 | #define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) | |
86028025 | 1014 | #define wxYELLOW_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_YELLOW) |
f516d986 VZ |
1015 | #define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) |
1016 | #define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) | |
1017 | #define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) | |
1018 | #define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED) | |
1019 | #define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT) | |
1020 | #define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE) | |
1021 | ||
1022 | #define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK) | |
1023 | #define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) | |
1024 | #define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) | |
1025 | #define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) | |
86028025 | 1026 | #define wxYELLOW wxStockGDI::GetColour(wxStockGDI::COLOUR_YELLOW) |
f516d986 VZ |
1027 | #define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) |
1028 | #define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) | |
1029 | #define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) | |
1030 | ||
1031 | #define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS) | |
1032 | #define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS) | |
1033 | #define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) | |
c801d85f KB |
1034 | |
1035 | // 'Null' objects | |
53a2db12 FM |
1036 | extern WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap; |
1037 | extern WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon; | |
1038 | extern WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor; | |
1039 | extern WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen; | |
1040 | extern WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush; | |
1041 | extern WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette; | |
1042 | extern WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont; | |
1043 | extern WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour; | |
1044 | extern WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle; | |
c801d85f | 1045 | |
53a2db12 | 1046 | extern WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase; |
f03fc89f | 1047 | |
53a2db12 | 1048 | extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; |
c801d85f | 1049 | |
53a2db12 FM |
1050 | extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize; |
1051 | extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; | |
f03fc89f | 1052 | |
f03fc89f VZ |
1053 | // --------------------------------------------------------------------------- |
1054 | // global functions | |
1055 | // --------------------------------------------------------------------------- | |
1056 | ||
1057 | // resource management | |
53a2db12 FM |
1058 | extern void WXDLLIMPEXP_CORE wxInitializeStockLists(); |
1059 | extern void WXDLLIMPEXP_CORE wxDeleteStockLists(); | |
c801d85f | 1060 | |
f03fc89f | 1061 | // is the display colour (or monochrome)? |
53a2db12 | 1062 | extern bool WXDLLIMPEXP_CORE wxColourDisplay(); |
c801d85f KB |
1063 | |
1064 | // Returns depth of screen | |
53a2db12 | 1065 | extern int WXDLLIMPEXP_CORE wxDisplayDepth(); |
6a6c0a8b | 1066 | #define wxGetDisplayDepth wxDisplayDepth |
c801d85f | 1067 | |
904a68b6 | 1068 | // get the display size |
53a2db12 FM |
1069 | extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height); |
1070 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize(); | |
1071 | extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height); | |
1072 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM(); | |
40fcf546 | 1073 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI(); |
c801d85f | 1074 | |
ec5d7799 | 1075 | // Get position and size of the display workarea |
53a2db12 FM |
1076 | extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height); |
1077 | extern wxRect WXDLLIMPEXP_CORE wxGetClientDisplayRect(); | |
ec5d7799 | 1078 | |
f03fc89f | 1079 | // set global cursor |
53a2db12 | 1080 | extern void WXDLLIMPEXP_CORE wxSetCursor(const wxCursor& cursor); |
c801d85f | 1081 | |
c801d85f | 1082 | #endif |
34138703 | 1083 | // _WX_GDICMNH__ |