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