]>
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; } | |
7d174999 VZ |
258 | void DecToIfSpecified(const wxSize& sz) |
259 | { | |
260 | if ( sz.x != wxDefaultCoord && sz.x < x ) | |
261 | x = sz.x; | |
262 | if ( sz.y != wxDefaultCoord && sz.y < y ) | |
263 | y = sz.y; | |
264 | } | |
f03fc89f | 265 | |
23359747 | 266 | void IncBy(int dx, int dy) { x += dx; y += dy; } |
89b799cc | 267 | void IncBy(const wxPoint& pt); |
23359747 VZ |
268 | void IncBy(const wxSize& sz) { IncBy(sz.x, sz.y); } |
269 | void IncBy(int d) { IncBy(d, d); } | |
270 | ||
271 | void DecBy(int dx, int dy) { IncBy(-dx, -dy); } | |
89b799cc | 272 | void DecBy(const wxPoint& pt); |
23359747 VZ |
273 | void DecBy(const wxSize& sz) { DecBy(sz.x, sz.y); } |
274 | void DecBy(int d) { DecBy(d, d); } | |
275 | ||
276 | ||
c5bad604 RR |
277 | wxSize& Scale(float xscale, float yscale) |
278 | { x = (int)(x*xscale); y = (int)(y*yscale); return *this; } | |
8efb2907 | 279 | |
eddf46fe JS |
280 | // accessors |
281 | void Set(int xx, int yy) { x = xx; y = yy; } | |
72cdf4c9 VZ |
282 | void SetWidth(int w) { x = w; } |
283 | void SetHeight(int h) { y = h; } | |
cc775580 | 284 | |
72cdf4c9 VZ |
285 | int GetWidth() const { return x; } |
286 | int GetHeight() const { return y; } | |
f03fc89f | 287 | |
5d3e7b52 | 288 | bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } |
706f1421 VZ |
289 | |
290 | // combine this size with the other one replacing the default (i.e. equal | |
5d3e7b52 | 291 | // to wxDefaultCoord) components of this object with those of the other |
706f1421 VZ |
292 | void SetDefaults(const wxSize& size) |
293 | { | |
5d3e7b52 | 294 | if ( x == wxDefaultCoord ) |
706f1421 | 295 | x = size.x; |
5d3e7b52 | 296 | if ( y == wxDefaultCoord ) |
706f1421 VZ |
297 | y = size.y; |
298 | } | |
299 | ||
cc775580 | 300 | // compatibility |
72cdf4c9 VZ |
301 | int GetX() const { return x; } |
302 | int GetY() const { return y; } | |
c801d85f KB |
303 | }; |
304 | ||
bc5e942b VZ |
305 | inline bool operator==(const wxSize& s1, const wxSize& s2) |
306 | { | |
307 | return s1.x == s2.x && s1.y == s2.y; | |
308 | } | |
309 | ||
310 | inline bool operator!=(const wxSize& s1, const wxSize& s2) | |
311 | { | |
312 | return s1.x != s2.x || s1.y != s2.y; | |
313 | } | |
314 | ||
bc5e942b VZ |
315 | inline wxSize operator+(const wxSize& s1, const wxSize& s2) |
316 | { | |
317 | return wxSize(s1.x + s2.x, s1.y + s2.y); | |
318 | } | |
319 | ||
bc5e942b VZ |
320 | inline wxSize operator-(const wxSize& s1, const wxSize& s2) |
321 | { | |
322 | return wxSize(s1.x - s2.x, s1.y - s2.y); | |
323 | } | |
324 | ||
bc5e942b VZ |
325 | inline wxSize operator/(const wxSize& s, int i) |
326 | { | |
327 | return wxSize(s.x / i, s.y / i); | |
328 | } | |
329 | ||
bc5e942b VZ |
330 | inline wxSize operator*(const wxSize& s, int i) |
331 | { | |
332 | return wxSize(s.x * i, s.y * i); | |
333 | } | |
334 | ||
bc5e942b VZ |
335 | inline wxSize operator*(int i, const wxSize& s) |
336 | { | |
337 | return wxSize(s.x * i, s.y * i); | |
338 | } | |
339 | ||
06d7b217 FM |
340 | inline wxSize operator/(const wxSize& s, unsigned int i) |
341 | { | |
342 | return wxSize(s.x / i, s.y / i); | |
343 | } | |
344 | ||
345 | inline wxSize operator*(const wxSize& s, unsigned int i) | |
346 | { | |
347 | return wxSize(s.x * i, s.y * i); | |
348 | } | |
349 | ||
350 | inline wxSize operator*(unsigned int i, const wxSize& s) | |
351 | { | |
352 | return wxSize(s.x * i, s.y * i); | |
353 | } | |
354 | ||
355 | inline wxSize operator/(const wxSize& s, long i) | |
356 | { | |
357 | return wxSize(s.x / i, s.y / i); | |
358 | } | |
359 | ||
360 | inline wxSize operator*(const wxSize& s, long i) | |
361 | { | |
362 | return wxSize(s.x * i, s.y * i); | |
363 | } | |
364 | ||
365 | inline wxSize operator*(long i, const wxSize& s) | |
366 | { | |
367 | return wxSize(s.x * i, s.y * i); | |
368 | } | |
369 | ||
370 | inline wxSize operator/(const wxSize& s, unsigned long i) | |
371 | { | |
372 | return wxSize(s.x / i, s.y / i); | |
373 | } | |
374 | ||
375 | inline wxSize operator*(const wxSize& s, unsigned long i) | |
376 | { | |
377 | return wxSize(s.x * i, s.y * i); | |
378 | } | |
379 | ||
380 | inline wxSize operator*(unsigned long i, const wxSize& s) | |
381 | { | |
382 | return wxSize(s.x * i, s.y * i); | |
383 | } | |
384 | ||
91743643 FM |
385 | inline wxSize operator*(const wxSize& s, double i) |
386 | { | |
ee08bdb5 | 387 | return wxSize(int(s.x * i), int(s.y * i)); |
91743643 FM |
388 | } |
389 | ||
390 | inline wxSize operator*(double i, const wxSize& s) | |
391 | { | |
ee08bdb5 | 392 | return wxSize(int(s.x * i), int(s.y * i)); |
91743643 | 393 | } |
bc5e942b VZ |
394 | |
395 | ||
396 | ||
f03fc89f VZ |
397 | // --------------------------------------------------------------------------- |
398 | // Point classes: with real or integer coordinates | |
399 | // --------------------------------------------------------------------------- | |
764a3a49 | 400 | |
53a2db12 | 401 | class WXDLLIMPEXP_CORE wxRealPoint |
c801d85f | 402 | { |
f03fc89f VZ |
403 | public: |
404 | double x; | |
405 | double y; | |
406 | ||
7ee31b00 GD |
407 | wxRealPoint() : x(0.0), y(0.0) { } |
408 | wxRealPoint(double xx, double yy) : x(xx), y(yy) { } | |
a5664fd6 | 409 | wxRealPoint(const wxPoint& pt); |
89b799cc | 410 | |
a5664fd6 FM |
411 | // no copy ctor or assignment operator - the defaults are ok |
412 | ||
413 | //assignment operators | |
414 | wxRealPoint& operator+=(const wxRealPoint& p) { x += p.x; y += p.y; return *this; } | |
415 | wxRealPoint& operator-=(const wxRealPoint& p) { x -= p.x; y -= p.y; return *this; } | |
416 | ||
417 | wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
418 | wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
bc5e942b | 419 | }; |
f03fc89f | 420 | |
f03fc89f | 421 | |
bc5e942b VZ |
422 | inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2) |
423 | { | |
424 | return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y); | |
425 | } | |
426 | ||
bc5e942b VZ |
427 | inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2) |
428 | { | |
429 | return !(p1 == p2); | |
430 | } | |
431 | ||
bc5e942b VZ |
432 | inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2) |
433 | { | |
434 | return wxRealPoint(p1.x + p2.x, p1.y + p2.y); | |
435 | } | |
436 | ||
437 | ||
438 | inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2) | |
439 | { | |
440 | return wxRealPoint(p1.x - p2.x, p1.y - p2.y); | |
441 | } | |
c801d85f | 442 | |
bc14c8b2 | 443 | |
8b655c80 FM |
444 | inline wxRealPoint operator/(const wxRealPoint& s, int i) |
445 | { | |
446 | return wxRealPoint(s.x / i, s.y / i); | |
447 | } | |
448 | ||
449 | inline wxRealPoint operator*(const wxRealPoint& s, int i) | |
450 | { | |
451 | return wxRealPoint(s.x * i, s.y * i); | |
452 | } | |
453 | ||
454 | inline wxRealPoint operator*(int i, const wxRealPoint& s) | |
455 | { | |
456 | return wxRealPoint(s.x * i, s.y * i); | |
457 | } | |
458 | ||
459 | inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i) | |
460 | { | |
461 | return wxRealPoint(s.x / i, s.y / i); | |
462 | } | |
463 | ||
464 | inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i) | |
465 | { | |
466 | return wxRealPoint(s.x * i, s.y * i); | |
467 | } | |
468 | ||
469 | inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s) | |
470 | { | |
471 | return wxRealPoint(s.x * i, s.y * i); | |
472 | } | |
473 | ||
474 | inline wxRealPoint operator/(const wxRealPoint& s, long i) | |
475 | { | |
476 | return wxRealPoint(s.x / i, s.y / i); | |
477 | } | |
478 | ||
479 | inline wxRealPoint operator*(const wxRealPoint& s, long i) | |
480 | { | |
481 | return wxRealPoint(s.x * i, s.y * i); | |
482 | } | |
483 | ||
484 | inline wxRealPoint operator*(long i, const wxRealPoint& s) | |
485 | { | |
486 | return wxRealPoint(s.x * i, s.y * i); | |
487 | } | |
488 | ||
489 | inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i) | |
490 | { | |
491 | return wxRealPoint(s.x / i, s.y / i); | |
492 | } | |
493 | ||
494 | inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i) | |
495 | { | |
496 | return wxRealPoint(s.x * i, s.y * i); | |
497 | } | |
498 | ||
499 | inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s) | |
500 | { | |
501 | return wxRealPoint(s.x * i, s.y * i); | |
502 | } | |
503 | ||
504 | inline wxRealPoint operator*(const wxRealPoint& s, double i) | |
505 | { | |
506 | return wxRealPoint(int(s.x * i), int(s.y * i)); | |
507 | } | |
508 | ||
509 | inline wxRealPoint operator*(double i, const wxRealPoint& s) | |
510 | { | |
511 | return wxRealPoint(int(s.x * i), int(s.y * i)); | |
512 | } | |
513 | ||
514 | ||
bc5e942b VZ |
515 | // ---------------------------------------------------------------------------- |
516 | // wxPoint: 2D point with integer coordinates | |
517 | // ---------------------------------------------------------------------------- | |
518 | ||
53a2db12 | 519 | class WXDLLIMPEXP_CORE wxPoint |
c801d85f | 520 | { |
f03fc89f | 521 | public: |
72cdf4c9 | 522 | int x, y; |
6a6c0a8b | 523 | |
7ee31b00 GD |
524 | wxPoint() : x(0), y(0) { } |
525 | wxPoint(int xx, int yy) : x(xx), y(yy) { } | |
fb0165df | 526 | wxPoint(const wxRealPoint& pt) : x(int(pt.x)), y(int(pt.y)) { } |
f03fc89f VZ |
527 | |
528 | // no copy ctor or assignment operator - the defaults are ok | |
6a6c0a8b | 529 | |
bc5e942b | 530 | //assignment operators |
764a3a49 VZ |
531 | wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; } |
532 | wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; } | |
d02bc4c8 JS |
533 | |
534 | wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; } | |
535 | wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; } | |
06cfc052 VZ |
536 | |
537 | // check if both components are set/initialized | |
538 | bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; } | |
539 | ||
540 | // fill in the unset components with the values from the other point | |
541 | void SetDefaults(const wxPoint& pt) | |
542 | { | |
543 | if ( x == wxDefaultCoord ) | |
544 | x = pt.x; | |
545 | if ( y == wxDefaultCoord ) | |
546 | y = pt.y; | |
547 | } | |
bc5e942b | 548 | }; |
d02bc4c8 | 549 | |
24b800a9 | 550 | |
bc5e942b VZ |
551 | // comparison |
552 | inline bool operator==(const wxPoint& p1, const wxPoint& p2) | |
553 | { | |
554 | return p1.x == p2.x && p1.y == p2.y; | |
555 | } | |
556 | ||
557 | inline bool operator!=(const wxPoint& p1, const wxPoint& p2) | |
558 | { | |
559 | return !(p1 == p2); | |
560 | } | |
561 | ||
562 | ||
563 | // arithmetic operations (component wise) | |
564 | inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2) | |
565 | { | |
566 | return wxPoint(p1.x + p2.x, p1.y + p2.y); | |
567 | } | |
568 | ||
569 | inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2) | |
570 | { | |
571 | return wxPoint(p1.x - p2.x, p1.y - p2.y); | |
572 | } | |
573 | ||
574 | inline wxPoint operator+(const wxPoint& p, const wxSize& s) | |
575 | { | |
576 | return wxPoint(p.x + s.x, p.y + s.y); | |
577 | } | |
578 | ||
579 | inline wxPoint operator-(const wxPoint& p, const wxSize& s) | |
580 | { | |
581 | return wxPoint(p.x - s.x, p.y - s.y); | |
582 | } | |
583 | ||
584 | inline wxPoint operator+(const wxSize& s, const wxPoint& p) | |
585 | { | |
586 | return wxPoint(p.x + s.x, p.y + s.y); | |
587 | } | |
588 | ||
589 | inline wxPoint operator-(const wxSize& s, const wxPoint& p) | |
590 | { | |
591 | return wxPoint(s.x - p.x, s.y - p.y); | |
592 | } | |
593 | ||
594 | inline wxPoint operator-(const wxPoint& p) | |
595 | { | |
596 | return wxPoint(-p.x, -p.y); | |
597 | } | |
598 | ||
ed0dd9c1 FM |
599 | inline wxPoint operator/(const wxPoint& s, int i) |
600 | { | |
601 | return wxPoint(s.x / i, s.y / i); | |
602 | } | |
603 | ||
604 | inline wxPoint operator*(const wxPoint& s, int i) | |
605 | { | |
606 | return wxPoint(s.x * i, s.y * i); | |
607 | } | |
608 | ||
609 | inline wxPoint operator*(int i, const wxPoint& s) | |
610 | { | |
611 | return wxPoint(s.x * i, s.y * i); | |
612 | } | |
613 | ||
614 | inline wxPoint operator/(const wxPoint& s, unsigned int i) | |
615 | { | |
616 | return wxPoint(s.x / i, s.y / i); | |
617 | } | |
618 | ||
619 | inline wxPoint operator*(const wxPoint& s, unsigned int i) | |
620 | { | |
621 | return wxPoint(s.x * i, s.y * i); | |
622 | } | |
623 | ||
624 | inline wxPoint operator*(unsigned int i, const wxPoint& s) | |
625 | { | |
626 | return wxPoint(s.x * i, s.y * i); | |
627 | } | |
628 | ||
629 | inline wxPoint operator/(const wxPoint& s, long i) | |
630 | { | |
631 | return wxPoint(s.x / i, s.y / i); | |
632 | } | |
633 | ||
634 | inline wxPoint operator*(const wxPoint& s, long i) | |
635 | { | |
636 | return wxPoint(s.x * i, s.y * i); | |
637 | } | |
638 | ||
639 | inline wxPoint operator*(long i, const wxPoint& s) | |
640 | { | |
641 | return wxPoint(s.x * i, s.y * i); | |
642 | } | |
643 | ||
644 | inline wxPoint operator/(const wxPoint& s, unsigned long i) | |
645 | { | |
646 | return wxPoint(s.x / i, s.y / i); | |
647 | } | |
648 | ||
649 | inline wxPoint operator*(const wxPoint& s, unsigned long i) | |
650 | { | |
651 | return wxPoint(s.x * i, s.y * i); | |
652 | } | |
653 | ||
654 | inline wxPoint operator*(unsigned long i, const wxPoint& s) | |
655 | { | |
656 | return wxPoint(s.x * i, s.y * i); | |
657 | } | |
658 | ||
659 | inline wxPoint operator*(const wxPoint& s, double i) | |
660 | { | |
661 | return wxPoint(int(s.x * i), int(s.y * i)); | |
662 | } | |
663 | ||
664 | inline wxPoint operator*(double i, const wxPoint& s) | |
665 | { | |
666 | return wxPoint(int(s.x * i), int(s.y * i)); | |
667 | } | |
668 | ||
b0d7707b | 669 | WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE); |
c801d85f | 670 | |
f03fc89f VZ |
671 | // --------------------------------------------------------------------------- |
672 | // wxRect | |
673 | // --------------------------------------------------------------------------- | |
c801d85f | 674 | |
53a2db12 | 675 | class WXDLLIMPEXP_CORE wxRect |
6a6c0a8b | 676 | { |
c801d85f | 677 | public: |
7ee31b00 GD |
678 | wxRect() |
679 | : x(0), y(0), width(0), height(0) | |
680 | { } | |
72cdf4c9 | 681 | wxRect(int xx, int yy, int ww, int hh) |
7ee31b00 GD |
682 | : x(xx), y(yy), width(ww), height(hh) |
683 | { } | |
f03fc89f | 684 | wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); |
df83b840 VZ |
685 | wxRect(const wxPoint& pt, const wxSize& size) |
686 | : x(pt.x), y(pt.y), width(size.x), height(size.y) | |
687 | { } | |
688 | wxRect(const wxSize& size) | |
689 | : x(0), y(0), width(size.x), height(size.y) | |
690 | { } | |
a23fd0e1 VZ |
691 | |
692 | // default copy ctor and assignment operators ok | |
c801d85f | 693 | |
72cdf4c9 VZ |
694 | int GetX() const { return x; } |
695 | void SetX(int xx) { x = xx; } | |
c801d85f | 696 | |
72cdf4c9 VZ |
697 | int GetY() const { return y; } |
698 | void SetY(int yy) { y = yy; } | |
c801d85f | 699 | |
72cdf4c9 VZ |
700 | int GetWidth() const { return width; } |
701 | void SetWidth(int w) { width = w; } | |
c801d85f | 702 | |
72cdf4c9 VZ |
703 | int GetHeight() const { return height; } |
704 | void SetHeight(int h) { height = h; } | |
f03fc89f | 705 | |
dcb44466 | 706 | wxPoint GetPosition() const { return wxPoint(x, y); } |
4aa0010b RL |
707 | void SetPosition( const wxPoint &p ) { x = p.x; y = p.y; } |
708 | ||
dcb44466 | 709 | wxSize GetSize() const { return wxSize(width, height); } |
4aa0010b | 710 | void SetSize( const wxSize &s ) { width = s.GetWidth(); height = s.GetHeight(); } |
f03fc89f | 711 | |
b737ad10 RR |
712 | bool IsEmpty() const { return (width <= 0) || (height <= 0); } |
713 | ||
f790ec82 VZ |
714 | int GetLeft() const { return x; } |
715 | int GetTop() const { return y; } | |
716 | int GetBottom() const { return y + height - 1; } | |
717 | int GetRight() const { return x + width - 1; } | |
718 | ||
719 | void SetLeft(int left) { x = left; } | |
720 | void SetRight(int right) { width = right - x + 1; } | |
721 | void SetTop(int top) { y = top; } | |
722 | void SetBottom(int bottom) { height = bottom - y + 1; } | |
723 | ||
355a5e2b JS |
724 | wxPoint GetTopLeft() const { return GetPosition(); } |
725 | wxPoint GetLeftTop() const { return GetTopLeft(); } | |
726 | void SetTopLeft(const wxPoint &p) { SetPosition(p); } | |
727 | void SetLeftTop(const wxPoint &p) { SetTopLeft(p); } | |
728 | ||
729 | wxPoint GetBottomRight() const { return wxPoint(GetRight(), GetBottom()); } | |
730 | wxPoint GetRightBottom() const { return GetBottomRight(); } | |
731 | void SetBottomRight(const wxPoint &p) { SetRight(p.x); SetBottom(p.y); } | |
732 | void SetRightBottom(const wxPoint &p) { SetBottomRight(p); } | |
733 | ||
f790ec82 VZ |
734 | wxPoint GetTopRight() const { return wxPoint(GetRight(), GetTop()); } |
735 | wxPoint GetRightTop() const { return GetTopRight(); } | |
736 | void SetTopRight(const wxPoint &p) { SetRight(p.x); SetTop(p.y); } | |
afa111d5 | 737 | void SetRightTop(const wxPoint &p) { SetTopRight(p); } |
f03fc89f | 738 | |
f790ec82 VZ |
739 | wxPoint GetBottomLeft() const { return wxPoint(GetLeft(), GetBottom()); } |
740 | wxPoint GetLeftBottom() const { return GetBottomLeft(); } | |
741 | void SetBottomLeft(const wxPoint &p) { SetLeft(p.x); SetBottom(p.y); } | |
742 | void SetLeftBottom(const wxPoint &p) { SetBottomLeft(p); } | |
dcb44466 | 743 | |
1e6feb95 VZ |
744 | // operations with rect |
745 | wxRect& Inflate(wxCoord dx, wxCoord dy); | |
c2c4d939 | 746 | wxRect& Inflate(const wxSize& d) { return Inflate(d.x, d.y); } |
1e6feb95 VZ |
747 | wxRect& Inflate(wxCoord d) { return Inflate(d, d); } |
748 | wxRect Inflate(wxCoord dx, wxCoord dy) const | |
749 | { | |
750 | wxRect r = *this; | |
751 | r.Inflate(dx, dy); | |
752 | return r; | |
753 | } | |
754 | ||
755 | wxRect& Deflate(wxCoord dx, wxCoord dy) { return Inflate(-dx, -dy); } | |
c2c4d939 | 756 | wxRect& Deflate(const wxSize& d) { return Inflate(-d.x, -d.y); } |
1e6feb95 VZ |
757 | wxRect& Deflate(wxCoord d) { return Inflate(-d); } |
758 | wxRect Deflate(wxCoord dx, wxCoord dy) const | |
759 | { | |
760 | wxRect r = *this; | |
761 | r.Deflate(dx, dy); | |
762 | return r; | |
763 | } | |
764 | ||
765 | void Offset(wxCoord dx, wxCoord dy) { x += dx; y += dy; } | |
766 | void Offset(const wxPoint& pt) { Offset(pt.x, pt.y); } | |
767 | ||
768 | wxRect& Intersect(const wxRect& rect); | |
769 | wxRect Intersect(const wxRect& rect) const | |
45816ddd | 770 | { |
1e6feb95 VZ |
771 | wxRect r = *this; |
772 | r.Intersect(rect); | |
773 | return r; | |
45816ddd VZ |
774 | } |
775 | ||
df83b840 VZ |
776 | wxRect& Union(const wxRect& rect); |
777 | wxRect Union(const wxRect& rect) const | |
778 | { | |
779 | wxRect r = *this; | |
780 | r.Union(rect); | |
781 | return r; | |
782 | } | |
45816ddd | 783 | |
5d3e7b52 | 784 | // return true if the point is (not strcitly) inside the rect |
22a35096 VS |
785 | bool Contains(int x, int y) const; |
786 | bool Contains(const wxPoint& pt) const { return Contains(pt.x, pt.y); } | |
fc01e9b3 | 787 | // return true if the rectangle 'rect' is (not strictly) inside this rect |
22a35096 VS |
788 | bool Contains(const wxRect& rect) const; |
789 | ||
790 | #if WXWIN_COMPATIBILITY_2_6 | |
791 | // use Contains() instead | |
792 | wxDEPRECATED( bool Inside(int x, int y) const ); | |
793 | wxDEPRECATED( bool Inside(const wxPoint& pt) const ); | |
794 | wxDEPRECATED( bool Inside(const wxRect& rect) const ); | |
795 | #endif // WXWIN_COMPATIBILITY_2_6 | |
1e6feb95 | 796 | |
5d3e7b52 | 797 | // return true if the rectangles have a non empty intersection |
1e6feb95 | 798 | bool Intersects(const wxRect& rect) const; |
72cdf4c9 | 799 | |
bc5e942b VZ |
800 | // like Union() but don't ignore empty rectangles |
801 | wxRect& operator+=(const wxRect& rect); | |
df83b840 | 802 | |
bc5e942b VZ |
803 | // intersections of two rectrangles not testing for empty rectangles |
804 | wxRect& operator*=(const wxRect& rect); | |
df83b840 | 805 | |
1bfb73b8 VZ |
806 | // centre this rectangle in the given (usually, but not necessarily, |
807 | // larger) one | |
808 | wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const | |
809 | { | |
810 | return wxRect(dir & wxHORIZONTAL ? r.x + (r.width - width)/2 : x, | |
811 | dir & wxVERTICAL ? r.y + (r.height - height)/2 : y, | |
812 | width, height); | |
813 | } | |
814 | ||
815 | wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const | |
816 | { | |
817 | return CentreIn(r, dir); | |
818 | } | |
819 | ||
f03fc89f | 820 | public: |
72cdf4c9 | 821 | int x, y, width, height; |
f03fc89f | 822 | }; |
c801d85f | 823 | |
bc5e942b VZ |
824 | |
825 | // compare rectangles | |
826 | inline bool operator==(const wxRect& r1, const wxRect& r2) | |
827 | { | |
828 | return (r1.x == r2.x) && (r1.y == r2.y) && | |
829 | (r1.width == r2.width) && (r1.height == r2.height); | |
830 | } | |
831 | ||
832 | inline bool operator!=(const wxRect& r1, const wxRect& r2) | |
833 | { | |
834 | return !(r1 == r2); | |
835 | } | |
836 | ||
837 | // like Union() but don't treat empty rectangles specially | |
838 | WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2); | |
839 | ||
840 | // intersections of two rectangles | |
841 | WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2); | |
842 | ||
843 | ||
844 | ||
845 | ||
22a35096 | 846 | #if WXWIN_COMPATIBILITY_2_6 |
3e69f6e5 | 847 | inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } |
22a35096 VS |
848 | inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } |
849 | inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } | |
850 | #endif // WXWIN_COMPATIBILITY_2_6 | |
851 | ||
852 | ||
89b799cc VZ |
853 | // define functions which couldn't be defined above because of declarations |
854 | // order | |
855 | inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); } | |
856 | inline void wxSize::DecBy(const wxPoint& pt) { DecBy(pt.x, pt.y); } | |
857 | ||
f03fc89f | 858 | // --------------------------------------------------------------------------- |
c801d85f | 859 | // Management of pens, brushes and fonts |
f03fc89f VZ |
860 | // --------------------------------------------------------------------------- |
861 | ||
236a9de3 RL |
862 | typedef wxInt8 wxDash; |
863 | ||
1de8d512 | 864 | class WXDLLIMPEXP_CORE wxGDIObjListBase { |
f03fc89f | 865 | public: |
1de8d512 VZ |
866 | wxGDIObjListBase(); |
867 | ~wxGDIObjListBase(); | |
f03fc89f | 868 | |
1de8d512 VZ |
869 | protected: |
870 | wxList list; | |
c801d85f KB |
871 | }; |
872 | ||
f79f1604 PC |
873 | WX_DECLARE_STRING_HASH_MAP(wxColour*, wxStringToColourHashMap); |
874 | ||
53a2db12 | 875 | class WXDLLIMPEXP_CORE wxColourDatabase |
c801d85f | 876 | { |
f03fc89f | 877 | public: |
222ed1d6 | 878 | wxColourDatabase(); |
c50f92d0 | 879 | ~wxColourDatabase(); |
f03fc89f | 880 | |
c50f92d0 VZ |
881 | // find colour by name or name for the given colour |
882 | wxColour Find(const wxString& name) const; | |
f03fc89f | 883 | wxString FindName(const wxColour& colour) const; |
c50f92d0 VZ |
884 | |
885 | // add a new colour to the database | |
886 | void AddColour(const wxString& name, const wxColour& colour); | |
887 | ||
ca3e85cf | 888 | #if WXWIN_COMPATIBILITY_2_6 |
492e2a5b VZ |
889 | // deprecated, use Find() instead |
890 | wxDEPRECATED( wxColour *FindColour(const wxString& name) ); | |
ca3e85cf | 891 | #endif // WXWIN_COMPATIBILITY_2_6 |
c50f92d0 VZ |
892 | |
893 | ||
19bf0c69 DW |
894 | #ifdef __WXPM__ |
895 | // PM keeps its own type of colour table | |
896 | long* m_palTable; | |
897 | size_t m_nSize; | |
898 | #endif | |
c50f92d0 | 899 | |
222ed1d6 | 900 | private: |
c50f92d0 VZ |
901 | // load the database with the built in colour values when called for the |
902 | // first time, do nothing after this | |
903 | void Initialize(); | |
222ed1d6 | 904 | |
c50f92d0 | 905 | wxStringToColourHashMap *m_map; |
c801d85f KB |
906 | }; |
907 | ||
53a2db12 | 908 | class WXDLLIMPEXP_CORE wxResourceCache: public wxList |
f03fc89f VZ |
909 | { |
910 | public: | |
911 | wxResourceCache() { } | |
01871bf6 | 912 | #if !wxUSE_STD_CONTAINERS |
f03fc89f | 913 | wxResourceCache(const unsigned int keyType) : wxList(keyType) { } |
222ed1d6 | 914 | #endif |
d3c7fc99 | 915 | virtual ~wxResourceCache(); |
f03fc89f VZ |
916 | }; |
917 | ||
918 | // --------------------------------------------------------------------------- | |
919 | // global variables | |
920 | // --------------------------------------------------------------------------- | |
921 | ||
c801d85f | 922 | |
f516d986 VZ |
923 | /* Stock objects |
924 | ||
925 | wxStockGDI creates the stock GDI objects on demand. Pointers to the | |
926 | created objects are stored in the ms_stockObject array, which is indexed | |
927 | by the Item enum values. Platorm-specific fonts can be created by | |
928 | implementing a derived class with an override for the GetFont function. | |
929 | wxStockGDI operates as a singleton, accessed through the ms_instance | |
930 | pointer. By default this pointer is set to an instance of wxStockGDI. | |
931 | A derived class must arrange to set this pointer to an instance of itself. | |
932 | */ | |
933 | class WXDLLIMPEXP_CORE wxStockGDI | |
934 | { | |
935 | public: | |
936 | enum Item { | |
937 | BRUSH_BLACK, | |
938 | BRUSH_BLUE, | |
939 | BRUSH_CYAN, | |
940 | BRUSH_GREEN, | |
86028025 | 941 | BRUSH_YELLOW, |
f516d986 VZ |
942 | BRUSH_GREY, |
943 | BRUSH_LIGHTGREY, | |
944 | BRUSH_MEDIUMGREY, | |
945 | BRUSH_RED, | |
946 | BRUSH_TRANSPARENT, | |
947 | BRUSH_WHITE, | |
948 | COLOUR_BLACK, | |
949 | COLOUR_BLUE, | |
950 | COLOUR_CYAN, | |
951 | COLOUR_GREEN, | |
86028025 | 952 | COLOUR_YELLOW, |
f516d986 VZ |
953 | COLOUR_LIGHTGREY, |
954 | COLOUR_RED, | |
955 | COLOUR_WHITE, | |
956 | CURSOR_CROSS, | |
957 | CURSOR_HOURGLASS, | |
958 | CURSOR_STANDARD, | |
959 | FONT_ITALIC, | |
960 | FONT_NORMAL, | |
961 | FONT_SMALL, | |
962 | FONT_SWISS, | |
963 | PEN_BLACK, | |
964 | PEN_BLACKDASHED, | |
d8184587 | 965 | PEN_BLUE, |
f516d986 VZ |
966 | PEN_CYAN, |
967 | PEN_GREEN, | |
86028025 | 968 | PEN_YELLOW, |
f516d986 VZ |
969 | PEN_GREY, |
970 | PEN_LIGHTGREY, | |
971 | PEN_MEDIUMGREY, | |
972 | PEN_RED, | |
973 | PEN_TRANSPARENT, | |
974 | PEN_WHITE, | |
975 | ITEMCOUNT | |
976 | }; | |
977 | ||
978 | wxStockGDI(); | |
979 | virtual ~wxStockGDI(); | |
980 | static void DeleteAll(); | |
981 | ||
982 | static wxStockGDI& instance() { return *ms_instance; } | |
983 | ||
984 | static const wxBrush* GetBrush(Item item); | |
985 | static const wxColour* GetColour(Item item); | |
986 | static const wxCursor* GetCursor(Item item); | |
987 | // Can be overridden by platform-specific derived classes | |
988 | virtual const wxFont* GetFont(Item item); | |
989 | static const wxPen* GetPen(Item item); | |
990 | ||
991 | protected: | |
992 | static wxStockGDI* ms_instance; | |
993 | ||
994 | static wxObject* ms_stockObject[ITEMCOUNT]; | |
995 | ||
c0c133e1 | 996 | wxDECLARE_NO_COPY_CLASS(wxStockGDI); |
f516d986 VZ |
997 | }; |
998 | ||
999 | #define wxITALIC_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_ITALIC) | |
1000 | #define wxNORMAL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_NORMAL) | |
1001 | #define wxSMALL_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SMALL) | |
1002 | #define wxSWISS_FONT wxStockGDI::instance().GetFont(wxStockGDI::FONT_SWISS) | |
1003 | ||
1004 | #define wxBLACK_DASHED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACKDASHED) | |
1005 | #define wxBLACK_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLACK) | |
d8184587 | 1006 | #define wxBLUE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_BLUE) |
f516d986 VZ |
1007 | #define wxCYAN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_CYAN) |
1008 | #define wxGREEN_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREEN) | |
86028025 | 1009 | #define wxYELLOW_PEN wxStockGDI::GetPen(wxStockGDI::PEN_YELLOW) |
f516d986 VZ |
1010 | #define wxGREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_GREY) |
1011 | #define wxLIGHT_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_LIGHTGREY) | |
1012 | #define wxMEDIUM_GREY_PEN wxStockGDI::GetPen(wxStockGDI::PEN_MEDIUMGREY) | |
1013 | #define wxRED_PEN wxStockGDI::GetPen(wxStockGDI::PEN_RED) | |
1014 | #define wxTRANSPARENT_PEN wxStockGDI::GetPen(wxStockGDI::PEN_TRANSPARENT) | |
1015 | #define wxWHITE_PEN wxStockGDI::GetPen(wxStockGDI::PEN_WHITE) | |
1016 | ||
1017 | #define wxBLACK_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLACK) | |
1018 | #define wxBLUE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_BLUE) | |
1019 | #define wxCYAN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_CYAN) | |
1020 | #define wxGREEN_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREEN) | |
86028025 | 1021 | #define wxYELLOW_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_YELLOW) |
f516d986 VZ |
1022 | #define wxGREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_GREY) |
1023 | #define wxLIGHT_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_LIGHTGREY) | |
1024 | #define wxMEDIUM_GREY_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_MEDIUMGREY) | |
1025 | #define wxRED_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_RED) | |
1026 | #define wxTRANSPARENT_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_TRANSPARENT) | |
1027 | #define wxWHITE_BRUSH wxStockGDI::GetBrush(wxStockGDI::BRUSH_WHITE) | |
1028 | ||
1029 | #define wxBLACK wxStockGDI::GetColour(wxStockGDI::COLOUR_BLACK) | |
1030 | #define wxBLUE wxStockGDI::GetColour(wxStockGDI::COLOUR_BLUE) | |
1031 | #define wxCYAN wxStockGDI::GetColour(wxStockGDI::COLOUR_CYAN) | |
1032 | #define wxGREEN wxStockGDI::GetColour(wxStockGDI::COLOUR_GREEN) | |
86028025 | 1033 | #define wxYELLOW wxStockGDI::GetColour(wxStockGDI::COLOUR_YELLOW) |
f516d986 VZ |
1034 | #define wxLIGHT_GREY wxStockGDI::GetColour(wxStockGDI::COLOUR_LIGHTGREY) |
1035 | #define wxRED wxStockGDI::GetColour(wxStockGDI::COLOUR_RED) | |
1036 | #define wxWHITE wxStockGDI::GetColour(wxStockGDI::COLOUR_WHITE) | |
1037 | ||
1038 | #define wxCROSS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_CROSS) | |
1039 | #define wxHOURGLASS_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_HOURGLASS) | |
1040 | #define wxSTANDARD_CURSOR wxStockGDI::GetCursor(wxStockGDI::CURSOR_STANDARD) | |
c801d85f KB |
1041 | |
1042 | // 'Null' objects | |
53a2db12 FM |
1043 | extern WXDLLIMPEXP_DATA_CORE(wxBitmap) wxNullBitmap; |
1044 | extern WXDLLIMPEXP_DATA_CORE(wxIcon) wxNullIcon; | |
1045 | extern WXDLLIMPEXP_DATA_CORE(wxCursor) wxNullCursor; | |
1046 | extern WXDLLIMPEXP_DATA_CORE(wxPen) wxNullPen; | |
1047 | extern WXDLLIMPEXP_DATA_CORE(wxBrush) wxNullBrush; | |
1048 | extern WXDLLIMPEXP_DATA_CORE(wxPalette) wxNullPalette; | |
1049 | extern WXDLLIMPEXP_DATA_CORE(wxFont) wxNullFont; | |
1050 | extern WXDLLIMPEXP_DATA_CORE(wxColour) wxNullColour; | |
1051 | extern WXDLLIMPEXP_DATA_CORE(wxIconBundle) wxNullIconBundle; | |
c801d85f | 1052 | |
53a2db12 | 1053 | extern WXDLLIMPEXP_DATA_CORE(wxColourDatabase*) wxTheColourDatabase; |
f03fc89f | 1054 | |
53a2db12 | 1055 | extern WXDLLIMPEXP_DATA_CORE(const char) wxPanelNameStr[]; |
c801d85f | 1056 | |
53a2db12 FM |
1057 | extern WXDLLIMPEXP_DATA_CORE(const wxSize) wxDefaultSize; |
1058 | extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; | |
f03fc89f | 1059 | |
f03fc89f VZ |
1060 | // --------------------------------------------------------------------------- |
1061 | // global functions | |
1062 | // --------------------------------------------------------------------------- | |
1063 | ||
1064 | // resource management | |
53a2db12 FM |
1065 | extern void WXDLLIMPEXP_CORE wxInitializeStockLists(); |
1066 | extern void WXDLLIMPEXP_CORE wxDeleteStockLists(); | |
c801d85f | 1067 | |
f03fc89f | 1068 | // is the display colour (or monochrome)? |
53a2db12 | 1069 | extern bool WXDLLIMPEXP_CORE wxColourDisplay(); |
c801d85f KB |
1070 | |
1071 | // Returns depth of screen | |
53a2db12 | 1072 | extern int WXDLLIMPEXP_CORE wxDisplayDepth(); |
6a6c0a8b | 1073 | #define wxGetDisplayDepth wxDisplayDepth |
c801d85f | 1074 | |
904a68b6 | 1075 | // get the display size |
53a2db12 FM |
1076 | extern void WXDLLIMPEXP_CORE wxDisplaySize(int *width, int *height); |
1077 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize(); | |
1078 | extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height); | |
1079 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM(); | |
40fcf546 | 1080 | extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI(); |
c801d85f | 1081 | |
ec5d7799 | 1082 | // Get position and size of the display workarea |
53a2db12 FM |
1083 | extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height); |
1084 | extern wxRect WXDLLIMPEXP_CORE wxGetClientDisplayRect(); | |
ec5d7799 | 1085 | |
f03fc89f | 1086 | // set global cursor |
53a2db12 | 1087 | extern void WXDLLIMPEXP_CORE wxSetCursor(const wxCursor& cursor); |
c801d85f | 1088 | |
c801d85f | 1089 | #endif |
34138703 | 1090 | // _WX_GDICMNH__ |