]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gdicmn.h | |
e54c96f1 | 3 | // Purpose: interface of wxRealPoint |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
698d17c3 FM |
9 | |
10 | /** | |
65874118 FM |
11 | Bitmap type flags. |
12 | ||
13 | See wxBitmap and wxImage classes. | |
698d17c3 FM |
14 | */ |
15 | enum wxBitmapType | |
16 | { | |
17 | wxBITMAP_TYPE_INVALID, | |
18 | wxBITMAP_TYPE_BMP, | |
19 | wxBITMAP_TYPE_BMP_RESOURCE, | |
20 | wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE, | |
21 | wxBITMAP_TYPE_ICO, | |
22 | wxBITMAP_TYPE_ICO_RESOURCE, | |
23 | wxBITMAP_TYPE_CUR, | |
24 | wxBITMAP_TYPE_CUR_RESOURCE, | |
25 | wxBITMAP_TYPE_XBM, | |
26 | wxBITMAP_TYPE_XBM_DATA, | |
27 | wxBITMAP_TYPE_XPM, | |
28 | wxBITMAP_TYPE_XPM_DATA, | |
29 | wxBITMAP_TYPE_TIF, | |
30 | wxBITMAP_TYPE_TIF_RESOURCE, | |
31 | wxBITMAP_TYPE_GIF, | |
32 | wxBITMAP_TYPE_GIF_RESOURCE, | |
33 | wxBITMAP_TYPE_PNG, | |
34 | wxBITMAP_TYPE_PNG_RESOURCE, | |
35 | wxBITMAP_TYPE_JPEG, | |
36 | wxBITMAP_TYPE_JPEG_RESOURCE, | |
37 | wxBITMAP_TYPE_PNM, | |
38 | wxBITMAP_TYPE_PNM_RESOURCE, | |
39 | wxBITMAP_TYPE_PCX, | |
40 | wxBITMAP_TYPE_PCX_RESOURCE, | |
41 | wxBITMAP_TYPE_PICT, | |
42 | wxBITMAP_TYPE_PICT_RESOURCE, | |
43 | wxBITMAP_TYPE_ICON, | |
44 | wxBITMAP_TYPE_ICON_RESOURCE, | |
45 | wxBITMAP_TYPE_ANI, | |
46 | wxBITMAP_TYPE_IFF, | |
47 | wxBITMAP_TYPE_TGA, | |
48 | wxBITMAP_TYPE_MACCURSOR, | |
49 | wxBITMAP_TYPE_MACCURSOR_RESOURCE, | |
50 | wxBITMAP_TYPE_ANY = 50 | |
51 | }; | |
52 | ||
53 | /** | |
54 | Standard cursors. | |
65874118 FM |
55 | |
56 | See wxCursor. | |
698d17c3 FM |
57 | */ |
58 | enum wxStockCursor | |
59 | { | |
60 | wxCURSOR_NONE, | |
61 | wxCURSOR_ARROW, | |
62 | wxCURSOR_RIGHT_ARROW, | |
63 | wxCURSOR_BULLSEYE, | |
64 | wxCURSOR_CHAR, | |
65 | wxCURSOR_CROSS, | |
66 | wxCURSOR_HAND, | |
67 | wxCURSOR_IBEAM, | |
68 | wxCURSOR_LEFT_BUTTON, | |
69 | wxCURSOR_MAGNIFIER, | |
70 | wxCURSOR_MIDDLE_BUTTON, | |
71 | wxCURSOR_NO_ENTRY, | |
72 | wxCURSOR_PAINT_BRUSH, | |
73 | wxCURSOR_PENCIL, | |
74 | wxCURSOR_POINT_LEFT, | |
75 | wxCURSOR_POINT_RIGHT, | |
76 | wxCURSOR_QUESTION_ARROW, | |
77 | wxCURSOR_RIGHT_BUTTON, | |
78 | wxCURSOR_SIZENESW, | |
79 | wxCURSOR_SIZENS, | |
80 | wxCURSOR_SIZENWSE, | |
81 | wxCURSOR_SIZEWE, | |
82 | wxCURSOR_SIZING, | |
83 | wxCURSOR_SPRAYCAN, | |
84 | wxCURSOR_WAIT, | |
85 | wxCURSOR_WATCH, | |
86 | wxCURSOR_BLANK, | |
87 | wxCURSOR_DEFAULT, //!< standard X11 cursor | |
88 | wxCURSOR_COPY_ARROW , //!< MacOS Theme Plus arrow | |
89 | // Not yet implemented for Windows | |
90 | wxCURSOR_CROSS_REVERSE, | |
91 | wxCURSOR_DOUBLE_ARROW, | |
92 | wxCURSOR_BASED_ARROW_UP, | |
93 | wxCURSOR_BASED_ARROW_DOWN, | |
94 | wxCURSOR_ARROWWAIT, | |
95 | wxCURSOR_MAX | |
96 | }; | |
97 | ||
98 | ||
99 | ||
23324ae1 FM |
100 | /** |
101 | @class wxRealPoint | |
102 | @wxheader{gdicmn.h} | |
7c913512 | 103 | |
23324ae1 | 104 | A @b wxRealPoint is a useful data structure for graphics operations. |
65874118 | 105 | |
23324ae1 FM |
106 | It contains floating point @e x and @e y members. |
107 | See also wxPoint for an integer version. | |
7c913512 | 108 | |
23324ae1 FM |
109 | @library{wxcore} |
110 | @category{data} | |
7c913512 | 111 | |
e54c96f1 | 112 | @see wxPoint |
23324ae1 | 113 | */ |
7c913512 | 114 | class wxRealPoint |
23324ae1 FM |
115 | { |
116 | public: | |
65874118 FM |
117 | wxRealPoint(); |
118 | ||
23324ae1 | 119 | /** |
65874118 | 120 | Initializes the point with the given coordinates. |
23324ae1 | 121 | */ |
7c913512 | 122 | wxRealPoint(double x, double y); |
65874118 FM |
123 | |
124 | /** | |
125 | X coordinate of this point. | |
126 | */ | |
127 | double x; | |
128 | ||
129 | /** | |
130 | Y coordinate of this point. | |
131 | */ | |
132 | double y; | |
23324ae1 FM |
133 | }; |
134 | ||
135 | ||
e54c96f1 | 136 | |
23324ae1 FM |
137 | /** |
138 | @class wxRect | |
139 | @wxheader{gdicmn.h} | |
7c913512 | 140 | |
23324ae1 | 141 | A class for manipulating rectangles. |
7c913512 | 142 | |
23324ae1 FM |
143 | @library{wxcore} |
144 | @category{data} | |
7c913512 | 145 | |
e54c96f1 | 146 | @see wxPoint, wxSize |
23324ae1 | 147 | */ |
7c913512 | 148 | class wxRect |
23324ae1 FM |
149 | { |
150 | public: | |
151 | //@{ | |
152 | /** | |
153 | Creates a wxRect object from size values at the origin. | |
154 | */ | |
155 | wxRect(); | |
7c913512 FM |
156 | wxRect(int x, int y, int width, int height); |
157 | wxRect(const wxPoint& topLeft, const wxPoint& bottomRight); | |
158 | wxRect(const wxPoint& pos, const wxSize& size); | |
159 | wxRect(const wxSize& size); | |
23324ae1 FM |
160 | //@} |
161 | ||
162 | //@{ | |
163 | /** | |
164 | Returns the rectangle having the same size as this one but centered relatively | |
165 | to the given rectangle @e r. By default, rectangle is centred in both | |
4cc4bfaf | 166 | directions but if @a dir includes only @c wxVERTICAL or only |
23324ae1 FM |
167 | @c wxHORIZONTAL flag, then it is only centered in this direction while |
168 | the other component of its position remains unchanged. | |
169 | */ | |
328f5751 FM |
170 | wxRect CentreIn(const wxRect& r, int dir = wxBOTH) const; |
171 | const wxRect CenterIn(const wxRect& r, int dir = wxBOTH) const; | |
23324ae1 FM |
172 | //@} |
173 | ||
174 | //@{ | |
175 | /** | |
176 | Returns @true if the given rectangle is completely inside this rectangle | |
177 | (or touches its boundary) and @false otherwise. | |
178 | */ | |
328f5751 FM |
179 | bool Contains(int x, int y) const; |
180 | const bool Contains(const wxPoint& pt) const; | |
181 | const bool Contains(const wxRect& rect) const; | |
23324ae1 FM |
182 | //@} |
183 | ||
184 | //@{ | |
185 | /** | |
186 | Decrease the rectangle size. | |
23324ae1 FM |
187 | This method is the opposite from Inflate(): |
188 | Deflate(a, b) is equivalent to Inflate(-a, -b). | |
189 | Please refer to Inflate() for full description. | |
8024723d | 190 | |
4cc4bfaf | 191 | @see Inflate() |
23324ae1 | 192 | */ |
328f5751 FM |
193 | void Deflate(wxCoord dx, wxCoord dy) const; |
194 | void Deflate(const wxSize& diff) const; | |
195 | void Deflate(wxCoord diff) const; | |
196 | wxRect Deflate(wxCoord dx, wxCoord dy) const; | |
23324ae1 FM |
197 | //@} |
198 | ||
199 | /** | |
200 | Gets the bottom point of the rectangle. | |
201 | */ | |
328f5751 | 202 | int GetBottom() const; |
23324ae1 FM |
203 | |
204 | /** | |
205 | Gets the position of the bottom left corner. | |
206 | */ | |
328f5751 | 207 | wxPoint GetBottomLeft() const; |
23324ae1 FM |
208 | |
209 | /** | |
210 | Gets the position of the bottom right corner. | |
211 | */ | |
328f5751 | 212 | wxPoint GetBottomRight() const; |
23324ae1 FM |
213 | |
214 | /** | |
215 | Gets the height member. | |
216 | */ | |
328f5751 | 217 | int GetHeight() const; |
23324ae1 FM |
218 | |
219 | /** | |
220 | Gets the left point of the rectangle (the same as wxRect::GetX). | |
221 | */ | |
328f5751 | 222 | int GetLeft() const; |
23324ae1 FM |
223 | |
224 | /** | |
225 | Gets the position. | |
226 | */ | |
328f5751 | 227 | wxPoint GetPosition() const; |
23324ae1 FM |
228 | |
229 | /** | |
230 | Gets the right point of the rectangle. | |
231 | */ | |
328f5751 | 232 | int GetRight() const; |
23324ae1 FM |
233 | |
234 | /** | |
235 | Gets the size. | |
8024723d | 236 | |
4cc4bfaf | 237 | @see SetSize() |
23324ae1 | 238 | */ |
328f5751 | 239 | wxSize GetSize() const; |
23324ae1 FM |
240 | |
241 | /** | |
242 | Gets the top point of the rectangle (the same as wxRect::GetY). | |
243 | */ | |
328f5751 | 244 | int GetTop() const; |
23324ae1 FM |
245 | |
246 | /** | |
7c913512 | 247 | Gets the position of the top left corner of the rectangle, same as |
23324ae1 FM |
248 | GetPosition(). |
249 | */ | |
328f5751 | 250 | wxPoint GetTopLeft() const; |
23324ae1 FM |
251 | |
252 | /** | |
253 | Gets the position of the top right corner. | |
254 | */ | |
328f5751 | 255 | wxPoint GetTopRight() const; |
23324ae1 FM |
256 | |
257 | /** | |
258 | Gets the width member. | |
259 | */ | |
328f5751 | 260 | int GetWidth() const; |
23324ae1 FM |
261 | |
262 | /** | |
263 | Gets the x member. | |
264 | */ | |
328f5751 | 265 | int GetX() const; |
23324ae1 FM |
266 | |
267 | /** | |
268 | Gets the y member. | |
269 | */ | |
328f5751 | 270 | int GetY() const; |
23324ae1 FM |
271 | |
272 | //@{ | |
273 | /** | |
274 | Increases the size of the rectangle. | |
4cc4bfaf | 275 | The second form uses the same @a diff for both @a dx and @e dy. |
23324ae1 FM |
276 | The first two versions modify the rectangle in place, the last one returns a |
277 | new rectangle leaving this one unchanged. | |
23324ae1 FM |
278 | The left border is moved farther left and the right border is moved farther |
279 | right by @e dx. The upper border is moved farther up and the bottom border | |
280 | is moved farther down by @e dy. (Note the the width and height of the | |
4cc4bfaf FM |
281 | rectangle thus change by 2*@a dx and 2*@e dy, respectively.) If one or |
282 | both of @a dx and @a dy are negative, the opposite happens: the rectangle | |
23324ae1 | 283 | size decreases in the respective direction. |
cdbcf4c2 | 284 | Inflating and deflating behaves "naturally". Defined more precisely, that |
23324ae1 | 285 | means: |
cdbcf4c2 | 286 | "Real" inflates (that is, @a dx and/or @a dy = 0) are not |
23324ae1 FM |
287 | constrained. Thus inflating a rectangle can cause its upper left corner |
288 | to move into the negative numbers. (the versions prior to 2.5.4 forced | |
289 | the top left coordinate to not fall below (0, 0), which implied a | |
290 | forced move of the rectangle.) | |
23324ae1 FM |
291 | Deflates are clamped to not reduce the width or height of the |
292 | rectangle below zero. In such cases, the top-left corner is nonetheless | |
293 | handled properly. For example, a rectangle at (10, 10) with size (20, | |
294 | 40) that is inflated by (-15, -15) will become located at (20, 25) at | |
295 | size (0, 10). Finally, observe that the width and height are treated | |
296 | independently. In the above example, the width is reduced by 20, | |
297 | whereas the height is reduced by the full 30 (rather than also stopping | |
298 | at 20, when the width reached zero). | |
8024723d | 299 | |
4cc4bfaf | 300 | @see Deflate() |
23324ae1 | 301 | */ |
328f5751 FM |
302 | void Inflate(wxCoord dx, wxCoord dy) const; |
303 | void Inflate(const wxSize& diff) const; | |
304 | void Inflate(wxCoord diff) const; | |
305 | wxRect Inflate(wxCoord dx, wxCoord dy) const; | |
23324ae1 FM |
306 | //@} |
307 | ||
308 | //@{ | |
309 | /** | |
310 | Modifies the rectangle to contain the overlapping box of this rectangle and the | |
311 | one passed in as parameter. The const version returns the new rectangle, the | |
312 | other one modifies this rectangle in place. | |
313 | */ | |
314 | wxRect Intersect(const wxRect& rect); | |
328f5751 | 315 | const wxRect& Intersect(const wxRect& rect); |
23324ae1 FM |
316 | //@} |
317 | ||
318 | /** | |
319 | Returns @true if this rectangle has a non-empty intersection with the | |
4cc4bfaf | 320 | rectangle @a rect and @false otherwise. |
23324ae1 | 321 | */ |
328f5751 | 322 | bool Intersects(const wxRect& rect) const; |
23324ae1 FM |
323 | |
324 | /** | |
7c913512 | 325 | Returns @true if this rectangle has a width or height less than or equal to |
23324ae1 FM |
326 | 0 and @false otherwise. |
327 | */ | |
328f5751 | 328 | bool IsEmpty() const; |
23324ae1 FM |
329 | |
330 | //@{ | |
331 | /** | |
4cc4bfaf FM |
332 | Moves the rectangle by the specified offset. If @a dx is positive, the |
333 | rectangle is moved to the right, if @a dy is positive, it is moved to the | |
23324ae1 FM |
334 | bottom, otherwise it is moved to the left or top respectively. |
335 | */ | |
336 | void Offset(wxCoord dx, wxCoord dy); | |
7c913512 | 337 | void Offset(const wxPoint& pt); |
23324ae1 FM |
338 | //@} |
339 | ||
340 | /** | |
341 | Sets the height. | |
342 | */ | |
343 | void SetHeight(int height); | |
344 | ||
345 | /** | |
346 | Sets the size. | |
8024723d | 347 | |
4cc4bfaf | 348 | @see GetSize() |
23324ae1 FM |
349 | */ |
350 | void SetSize(const wxSize& s); | |
351 | ||
352 | /** | |
353 | Sets the width. | |
354 | */ | |
355 | void SetWidth(int width); | |
356 | ||
357 | /** | |
358 | Sets the x position. | |
359 | */ | |
4cc4bfaf | 360 | void SetX(int x); |
23324ae1 FM |
361 | |
362 | /** | |
363 | Sets the y position. | |
364 | */ | |
4cc4bfaf | 365 | void SetY(int y); |
23324ae1 FM |
366 | |
367 | //@{ | |
368 | /** | |
369 | Modifies the rectangle to contain the bounding box of this rectangle and the | |
370 | one passed in as parameter. The const version returns the new rectangle, the | |
371 | other one modifies this rectangle in place. | |
372 | */ | |
373 | wxRect Union(const wxRect& rect); | |
328f5751 | 374 | const wxRect& Union(const wxRect& rect); |
23324ae1 FM |
375 | //@} |
376 | ||
377 | /** | |
378 | int height | |
23324ae1 FM |
379 | Height member. |
380 | */ | |
381 | ||
382 | ||
383 | //@{ | |
384 | /** | |
385 | Returns the intersection of two rectangles (which may be empty). | |
386 | */ | |
387 | bool operator !=(const wxRect& r1, const wxRect& r2); | |
7c913512 FM |
388 | wxRect operator +(const wxRect& r1, const wxRect& r2); |
389 | wxRect operator +=(const wxRect& r); | |
390 | See also wxRect operator *(const wxRect& r1, | |
391 | const wxRect& r2); | |
392 | wxRect operator *=(const wxRect& r); | |
23324ae1 FM |
393 | //@} |
394 | ||
395 | /** | |
396 | Assignment operator. | |
397 | */ | |
398 | void operator =(const wxRect& rect); | |
399 | ||
400 | /** | |
401 | Equality operator. | |
402 | */ | |
403 | bool operator ==(const wxRect& r1, const wxRect& r2); | |
404 | ||
405 | /** | |
406 | int width | |
23324ae1 FM |
407 | Width member. |
408 | */ | |
409 | ||
410 | ||
411 | /** | |
412 | int x | |
23324ae1 FM |
413 | x coordinate of the top-level corner of the rectangle. |
414 | */ | |
415 | ||
416 | ||
417 | /** | |
418 | int y | |
23324ae1 FM |
419 | y coordinate of the top-level corner of the rectangle. |
420 | */ | |
421 | }; | |
422 | ||
423 | ||
e54c96f1 | 424 | |
23324ae1 FM |
425 | /** |
426 | @class wxPoint | |
427 | @wxheader{gdicmn.h} | |
7c913512 | 428 | |
23324ae1 FM |
429 | A @b wxPoint is a useful data structure for graphics operations. |
430 | It simply contains integer @e x and @e y members. | |
7c913512 | 431 | |
23324ae1 | 432 | See also wxRealPoint for a floating point version. |
7c913512 | 433 | |
23324ae1 FM |
434 | @library{wxcore} |
435 | @category{data} | |
7c913512 | 436 | |
65874118 FM |
437 | @stdobjects |
438 | ::wxDefaultPosition | |
439 | ||
e54c96f1 | 440 | @see wxRealPoint |
23324ae1 | 441 | */ |
7c913512 | 442 | class wxPoint |
23324ae1 FM |
443 | { |
444 | public: | |
445 | //@{ | |
446 | /** | |
447 | Create a point. | |
448 | */ | |
449 | wxPoint(); | |
7c913512 | 450 | wxPoint(int x, int y); |
23324ae1 FM |
451 | //@} |
452 | ||
453 | //@{ | |
454 | /** | |
455 | Operators for sum and subtraction between a wxPoint object and a | |
456 | wxSize object. | |
457 | */ | |
458 | void operator =(const wxPoint& pt); | |
7c913512 FM |
459 | bool operator ==(const wxPoint& p1, const wxPoint& p2); |
460 | bool operator !=(const wxPoint& p1, const wxPoint& p2); | |
461 | wxPoint operator +(const wxPoint& p1, const wxPoint& p2); | |
462 | wxPoint operator -(const wxPoint& p1, const wxPoint& p2); | |
463 | wxPoint operator +=(const wxPoint& pt); | |
464 | wxPoint operator -=(const wxPoint& pt); | |
465 | wxPoint operator +(const wxPoint& pt, const wxSize& sz); | |
466 | wxPoint operator -(const wxPoint& pt, const wxSize& sz); | |
467 | wxPoint operator +(const wxSize& sz, const wxPoint& pt); | |
468 | wxPoint operator -(const wxSize& sz, const wxPoint& pt); | |
469 | wxPoint operator +=(const wxSize& sz); | |
470 | wxPoint operator -=(const wxSize& sz); | |
23324ae1 FM |
471 | //@} |
472 | ||
473 | /** | |
474 | int x | |
23324ae1 FM |
475 | x member. |
476 | */ | |
477 | ||
478 | ||
479 | /** | |
480 | int y | |
23324ae1 FM |
481 | y member. |
482 | */ | |
483 | }; | |
484 | ||
65874118 FM |
485 | /** |
486 | Global istance of a wxPoint initialized with values -1;-1. | |
487 | */ | |
488 | wxPoint wxDefaultPosition; | |
23324ae1 | 489 | |
e54c96f1 | 490 | |
23324ae1 FM |
491 | /** |
492 | @class wxColourDatabase | |
493 | @wxheader{gdicmn.h} | |
7c913512 | 494 | |
23324ae1 | 495 | wxWidgets maintains a database of standard RGB colours for a predefined |
cdbcf4c2 | 496 | set of named colours (such as "BLACK", "LIGHT GREY"). The |
23324ae1 FM |
497 | application may add to this set if desired by using |
498 | wxColourDatabase::AddColour and may use it to look up | |
499 | colours by names using wxColourDatabase::Find or find the names | |
500 | for the standard colour suing wxColourDatabase::FindName. | |
7c913512 | 501 | |
23324ae1 FM |
502 | There is one predefined instance of this class called |
503 | @b wxTheColourDatabase. | |
7c913512 | 504 | |
23324ae1 FM |
505 | @library{wxcore} |
506 | @category{FIXME} | |
7c913512 | 507 | |
e54c96f1 | 508 | @see wxColour |
23324ae1 | 509 | */ |
7c913512 | 510 | class wxColourDatabase |
23324ae1 FM |
511 | { |
512 | public: | |
513 | /** | |
514 | Constructs the colour database. It will be initialized at the first use. | |
515 | */ | |
516 | wxColourDatabase(); | |
517 | ||
518 | //@{ | |
519 | /** | |
520 | Adds a colour to the database. If a colour with the same name already exists, | |
521 | it is replaced. | |
23324ae1 FM |
522 | Please note that the overload taking a pointer is deprecated and will be |
523 | removed in the next wxWidgets version, please don't use it. | |
524 | */ | |
525 | void AddColour(const wxString& colourName, | |
526 | const wxColour& colour); | |
7c913512 | 527 | void AddColour(const wxString& colourName, wxColour* colour); |
23324ae1 FM |
528 | //@} |
529 | ||
530 | /** | |
531 | Finds a colour given the name. Returns an invalid colour object (that is, such | |
532 | that its @ref wxColour::isok Ok method returns @false) if the colour wasn't | |
533 | found in the database. | |
534 | */ | |
535 | wxColour Find(const wxString& colourName); | |
536 | ||
537 | /** | |
538 | Finds a colour name given the colour. Returns an empty string if the colour is | |
539 | not found in the database. | |
540 | */ | |
328f5751 | 541 | wxString FindName(const wxColour& colour) const; |
23324ae1 FM |
542 | }; |
543 | ||
544 | ||
23324ae1 FM |
545 | /** |
546 | @class wxSize | |
547 | @wxheader{gdicmn.h} | |
7c913512 | 548 | |
23324ae1 FM |
549 | A @b wxSize is a useful data structure for graphics operations. |
550 | It simply contains integer @e width and @e height members. | |
7c913512 | 551 | |
23324ae1 FM |
552 | wxSize is used throughout wxWidgets as well as wxPoint which, although almost |
553 | equivalent to wxSize, has a different meaning: wxPoint represents a position | |
554 | while wxSize - the size. | |
7c913512 | 555 | |
23324ae1 FM |
556 | @b wxPython note: wxPython defines aliases for the @c x and @c y members |
557 | named @c width and @c height since it makes much more sense for | |
558 | sizes. | |
7c913512 | 559 | |
23324ae1 FM |
560 | @library{wxcore} |
561 | @category{data} | |
7c913512 | 562 | |
65874118 FM |
563 | @stdobjects |
564 | ::wxDefaultSize | |
565 | ||
e54c96f1 | 566 | @see wxPoint, wxRealPoint |
23324ae1 | 567 | */ |
7c913512 | 568 | class wxSize |
23324ae1 FM |
569 | { |
570 | public: | |
571 | //@{ | |
572 | /** | |
573 | Creates a size object. | |
574 | */ | |
575 | wxSize(); | |
7c913512 | 576 | wxSize(int width, int height); |
23324ae1 FM |
577 | //@} |
578 | ||
579 | //@{ | |
580 | /** | |
581 | Decreases the size in x- and y- directions | |
23324ae1 | 582 | By @e size.x and @e size.y for the first overload |
4cc4bfaf FM |
583 | By @a dx and @a dy for the second one |
584 | By @a d and @a d for the third one | |
8024723d | 585 | |
4cc4bfaf | 586 | @see IncBy() |
23324ae1 FM |
587 | */ |
588 | void DecBy(const wxSize& size); | |
7c913512 FM |
589 | void DecBy(int dx, int dy); |
590 | void DecBy(int d); | |
23324ae1 FM |
591 | //@} |
592 | ||
593 | /** | |
594 | Decrements this object so that both of its dimensions are not greater than the | |
595 | corresponding dimensions of the @e size. | |
8024723d | 596 | |
4cc4bfaf | 597 | @see IncTo() |
23324ae1 FM |
598 | */ |
599 | void DecTo(const wxSize& size); | |
600 | ||
601 | /** | |
602 | Gets the height member. | |
603 | */ | |
328f5751 | 604 | int GetHeight() const; |
23324ae1 FM |
605 | |
606 | /** | |
607 | Gets the width member. | |
608 | */ | |
328f5751 | 609 | int GetWidth() const; |
23324ae1 FM |
610 | |
611 | //@{ | |
612 | /** | |
613 | Increases the size in x- and y- directions | |
23324ae1 | 614 | By @e size.x and @e size.y for the first overload |
4cc4bfaf FM |
615 | By @a dx and @a dy for the second one |
616 | By @a d and @a d for the third one | |
8024723d | 617 | |
4cc4bfaf | 618 | @see DecBy() |
23324ae1 FM |
619 | */ |
620 | void IncBy(const wxSize& size); | |
7c913512 FM |
621 | void IncBy(int dx, int dy); |
622 | void IncBy(int d); | |
23324ae1 FM |
623 | //@} |
624 | ||
625 | /** | |
626 | Increments this object so that both of its dimensions are not less than the | |
627 | corresponding dimensions of the @e size. | |
8024723d | 628 | |
4cc4bfaf | 629 | @see DecTo() |
23324ae1 FM |
630 | */ |
631 | void IncTo(const wxSize& size); | |
632 | ||
633 | /** | |
634 | Returns @true if neither of the size object components is equal to -1, which | |
635 | is used as default for the size values in wxWidgets (hence the predefined | |
636 | @c wxDefaultSize has both of its components equal to -1). | |
23324ae1 FM |
637 | This method is typically used before calling |
638 | SetDefaults(). | |
639 | */ | |
328f5751 | 640 | bool IsFullySpecified() const; |
23324ae1 FM |
641 | |
642 | //@{ | |
643 | /** | |
644 | Operators for division and multiplication between a wxSize object and an | |
645 | integer. | |
646 | */ | |
647 | void operator =(const wxSize& sz); | |
7c913512 FM |
648 | bool operator ==(const wxSize& s1, const wxSize& s2); |
649 | bool operator !=(const wxSize& s1, const wxSize& s2); | |
650 | wxSize operator +(const wxSize& s1, const wxSize& s2); | |
651 | wxSize operator -(const wxSize& s1, const wxSize& s2); | |
652 | wxSize operator +=(const wxSize& sz); | |
653 | wxSize operator -=(const wxSize& sz); | |
654 | wxSize operator /(const wxSize& sz, int factor); | |
655 | wxSize operator *(const wxSize& sz, int factor); | |
656 | wxSize operator *(int factor, const wxSize& sz); | |
657 | wxSize operator /=(int factor); | |
658 | wxSize operator *=(int factor); | |
23324ae1 FM |
659 | //@} |
660 | ||
661 | /** | |
662 | Scales the dimensions of this object by the given factors. | |
663 | If you want to scale both dimensions by the same factor you can also use | |
664 | the @ref operators() "operator *=" | |
23324ae1 FM |
665 | Returns a reference to this object (so that you can concatenate other |
666 | operations in the same line). | |
667 | */ | |
668 | wxSize Scale(float xscale, float yscale); | |
669 | ||
670 | /** | |
671 | Sets the width and height members. | |
672 | */ | |
4cc4bfaf | 673 | void Set(int width, int height); |
23324ae1 FM |
674 | |
675 | /** | |
676 | Combine this size object with another one replacing the default (i.e. equal | |
677 | to -1) components of this object with those of the other. It is typically | |
678 | used like this: | |
8024723d | 679 | |
4cc4bfaf | 680 | @see IsFullySpecified() |
23324ae1 FM |
681 | */ |
682 | void SetDefaults(const wxSize& sizeDefault); | |
683 | ||
684 | /** | |
685 | Sets the height. | |
686 | */ | |
687 | void SetHeight(int height); | |
688 | ||
689 | /** | |
690 | Sets the width. | |
691 | */ | |
692 | void SetWidth(int width); | |
693 | }; | |
694 | ||
65874118 FM |
695 | /** |
696 | Global instance of a wxSize object initialized with values -1;-1. | |
697 | */ | |
698 | wxSize wxDefaultSize; | |
23324ae1 | 699 | |
e54c96f1 | 700 | |
23324ae1 | 701 | |
e54c96f1 | 702 | |
23324ae1 FM |
703 | // ============================================================================ |
704 | // Global functions/macros | |
705 | // ============================================================================ | |
706 | ||
3db7c3b1 | 707 | /** @ingroup group_funcmacro_gdi */ |
23324ae1 | 708 | //@{ |
c83e60aa | 709 | |
23324ae1 | 710 | /** |
a055a116 BP |
711 | This macro loads a bitmap from either application resources (on the |
712 | platforms for which they exist, i.e. Windows and OS2) or from an XPM file. | |
713 | This can help to avoid using @ifdef_ when creating bitmaps. | |
714 | ||
715 | @see @ref overview_bitmap, wxICON() | |
716 | ||
717 | @header{wx/gdicmn.h} | |
23324ae1 | 718 | */ |
a055a116 | 719 | #define wxBITMAP(bitmapName) |
23324ae1 | 720 | |
23324ae1 | 721 | /** |
a055a116 BP |
722 | This macro loads an icon from either application resources (on the |
723 | platforms for which they exist, i.e. Windows and OS2) or from an XPM file. | |
724 | This can help to avoid using @ifdef_ when creating icons. | |
725 | ||
726 | @see @ref overview_bitmap, wxBITMAP() | |
727 | ||
728 | @header{wx/gdicmn.h} | |
23324ae1 | 729 | */ |
a055a116 | 730 | wxICON(); |
23324ae1 | 731 | |
23324ae1 | 732 | /** |
a055a116 BP |
733 | Returns @true if the display is colour, @false otherwise. |
734 | ||
735 | @header{wx/gdicmn.h} | |
23324ae1 | 736 | */ |
a055a116 | 737 | bool wxColourDisplay(); |
23324ae1 FM |
738 | |
739 | /** | |
a055a116 BP |
740 | Returns the depth of the display (a value of 1 denotes a monochrome |
741 | display). | |
7c913512 | 742 | |
a055a116 | 743 | @header{wx/gdicmn.h} |
23324ae1 | 744 | */ |
a055a116 | 745 | int wxDisplayDepth(); |
23324ae1 FM |
746 | |
747 | /** | |
a055a116 BP |
748 | Globally sets the cursor; only has an effect on Windows, Mac and GTK+. You |
749 | should call this function with wxNullCursor to restore the system cursor. | |
750 | ||
751 | @see wxCursor, wxWindow::SetCursor() | |
752 | ||
753 | @header{wx/gdicmn.h} | |
23324ae1 | 754 | */ |
a055a116 | 755 | void wxSetCursor(const wxCursor& cursor); |
23324ae1 | 756 | |
a055a116 BP |
757 | //@} |
758 | ||
759 | /** @ingroup group_funcmacro_gdi */ | |
760 | //@{ | |
23324ae1 | 761 | /** |
a055a116 BP |
762 | Returns the dimensions of the work area on the display. On Windows this |
763 | means the area not covered by the taskbar, etc. Other platforms are | |
764 | currently defaulting to the whole display until a way is found to provide | |
765 | this info for all window managers, etc. | |
7c913512 | 766 | |
a055a116 | 767 | @header{wx/gdicmn.h} |
23324ae1 | 768 | */ |
a055a116 BP |
769 | void wxClientDisplayRect(int* x, int* y, int* width, int* height); |
770 | wxRect wxGetClientDisplayRect(); | |
771 | //@} | |
23324ae1 | 772 | |
a055a116 BP |
773 | /** @ingroup group_funcmacro_gdi */ |
774 | //@{ | |
23324ae1 | 775 | /** |
a055a116 BP |
776 | Returns the display size in pixels. |
777 | ||
778 | @header{wx/gdicmn.h} | |
23324ae1 | 779 | */ |
a055a116 BP |
780 | void wxDisplaySize(int* width, int* height); |
781 | wxSize wxGetDisplaySize(); | |
782 | //@} | |
783 | ||
784 | /** @ingroup group_funcmacro_gdi */ | |
785 | //@{ | |
786 | /** | |
787 | Returns the display size in millimeters. | |
23324ae1 | 788 | |
a055a116 BP |
789 | @header{wx/gdicmn.h} |
790 | */ | |
791 | void wxDisplaySizeMM(int* width, int* height); | |
792 | wxSize wxGetDisplaySizeMM(); | |
c83e60aa BP |
793 | //@} |
794 |