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