]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/renderer.h
Add test for absence of events from wxSpinCtrlDouble ctor.
[wxWidgets.git] / interface / wx / renderer.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: renderer.h
bbc5b7f8 3// Purpose: interface of wxRendererNative
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
bbc5b7f8
BP
9 @anchor wxCONTROL_FLAGS
10
11 The following rendering flags are defined for wxRendererNative:
12*/
13enum
14{
15 /** Control is disabled. */
16 wxCONTROL_DISABLED = 0x00000001,
17
18 /** Currently has keyboard focus. */
19 wxCONTROL_FOCUSED = 0x00000002,
20
21 /** (Button) is pressed. */
22 wxCONTROL_PRESSED = 0x00000004,
23
24 /** Control-specific bit. */
25 wxCONTROL_SPECIAL = 0x00000008,
26
27 /** Only for the buttons. */
28 wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL,
29
30 /** Only for the menu items. */
31 wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL,
32
33 /** Only for the tree items. */
34 wxCONTROL_EXPANDED = wxCONTROL_SPECIAL,
35
36 /** Only for the status bar panes. */
37 wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL,
38
39 /** Checkboxes only: flat border. */
40 wxCONTROL_FLAT = wxCONTROL_SPECIAL,
41
42 /** Mouse is currently over the control. */
43 wxCONTROL_CURRENT = 0x00000010,
44
0824e369 45 /** Selected item in e.g.\ listbox. */
bbc5b7f8
BP
46 wxCONTROL_SELECTED = 0x00000020,
47
48 /** (Check/radio button) is checked. */
49 wxCONTROL_CHECKED = 0x00000040,
50
51 /** (Menu) item can be checked. */
52 wxCONTROL_CHECKABLE = 0x00000080,
53
54 /** (Check) undetermined state. */
55 wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE
56};
57
3427bc78
VZ
58/**
59 Title bar buttons supported by wxRendererNative::DrawTitleBarBitmap().
60 */
61enum wxTitleBarButton
62{
63 wxTITLEBAR_BUTTON_CLOSE = 0x01000000,
64 wxTITLEBAR_BUTTON_MAXIMIZE = 0x02000000,
65 wxTITLEBAR_BUTTON_ICONIZE = 0x04000000,
66 wxTITLEBAR_BUTTON_RESTORE = 0x08000000,
67 wxTITLEBAR_BUTTON_HELP = 0x10000000
68};
69
bbc5b7f8
BP
70/**
71 @struct wxSplitterRenderParams
7c913512
FM
72
73 This is just a simple @c struct used as a return value of
bbc5b7f8 74 wxRendererNative::GetSplitterParams().
7c913512 75
bbc5b7f8
BP
76 It doesn't have any methods and all of its fields are constant, so they can
77 only be examined but not modified.
7c913512 78
a24b5254 79 @library{wxcore}
bbc5b7f8 80 @category{gdi}
23324ae1 81*/
bbc5b7f8 82struct wxSplitterRenderParams
23324ae1 83{
23324ae1 84 /**
bbc5b7f8 85 The only way to initialize this struct is by using this ctor.
23324ae1 86 */
bbc5b7f8 87 wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_);
23324ae1 88
bbc5b7f8
BP
89 /**
90 The width of the border drawn by the splitter inside it, may be 0.
91 */
92 const wxCoord border;
23324ae1
FM
93
94 /**
23324ae1
FM
95 @true if the sash changes appearance when the mouse passes over it, @false
96 otherwise.
97 */
bbc5b7f8 98 const bool isHotSensitive;
23324ae1
FM
99
100 /**
23324ae1
FM
101 The width of the splitter sash.
102 */
bbc5b7f8
BP
103 const wxCoord widthSash;
104};
105
106/**
107 @struct wxHeaderButtonParams
bbc5b7f8
BP
108
109 This @c struct can optionally be used with
110 wxRendererNative::DrawHeaderButton() to specify custom values used to draw
111 the text or bitmap label.
112
a24b5254 113 @library{wxcore}
bbc5b7f8
BP
114 @category{gdi}
115*/
116struct wxHeaderButtonParams
117{
118 wxHeaderButtonParams();
119
120 wxColour m_arrowColour;
121 wxColour m_selectionColour;
122 wxString m_labelText;
123 wxFont m_labelFont;
124 wxColour m_labelColour;
125 wxBitmap m_labelBitmap;
126 int m_labelAlignment;
127};
128
129/**
130 Used to specify the type of sort arrow used with
131 wxRendererNative::DrawHeaderButton().
132*/
133enum wxHeaderSortIconType
134{
135 wxHDR_SORT_ICON_NONE, ///< Don't draw a sort arrow.
136 wxHDR_SORT_ICON_UP, ///< Draw a sort arrow icon pointing up.
137 wxHDR_SORT_ICON_DOWN ///< Draw a sort arrow icon pointing down.
23324ae1
FM
138};
139
140
e54c96f1 141
23324ae1
FM
142/**
143 @class wxDelegateRendererNative
7c913512
FM
144
145 wxDelegateRendererNative allows reuse of renderers code by forwarding all the
191e43fd
FM
146 wxRendererNative methods to the given object and
147 thus allowing you to only modify some of its methods -- without having to
148 reimplement all of them.
7c913512 149
cdbcf4c2 150 Note that the "normal", inheritance-based approach, doesn't work with the
23324ae1
FM
151 renderers as it is impossible to derive from a class unknown at compile-time
152 and the renderer is only chosen at run-time. So suppose that you want to only
153 add something to the drawing of the tree control buttons but leave all the
154 other methods unchanged -- the only way to do it, considering that the renderer
155 class which you want to customize might not even be written yet when you write
156 your code (it could be written later and loaded from a DLL during run-time), is
157 by using this class.
7c913512
FM
158
159 Except for the constructor, it has exactly the same methods as
191e43fd
FM
160 wxRendererNative and their implementation is
161 trivial: they are simply forwarded to the real renderer. Note that the "real"
162 renderer may, in turn, be a wxDelegateRendererNative as well and that there may
163 be arbitrarily many levels like this -- but at the end of the chain there must
164 be a real renderer which does the drawing.
7c913512 165
23324ae1 166 @library{wxcore}
bbc5b7f8
BP
167 @category{gdi}
168
169 @see wxRendererNative
23324ae1
FM
170*/
171class wxDelegateRendererNative : public wxRendererNative
172{
173public:
23324ae1
FM
174 /**
175 The default constructor does the same thing as the other one except that it
bbc5b7f8
BP
176 uses the @ref wxRendererNative::GetGeneric() "generic renderer" instead of the
177 user-specified @a rendererNative.
178
23324ae1
FM
179 In any case, this sets up the delegate renderer object to follow all calls to
180 the specified real renderer.
23324ae1
FM
181 */
182 wxDelegateRendererNative();
23324ae1 183 /**
bbc5b7f8
BP
184 This constructor uses the user-specified @a rendererNative to set up the delegate
185 renderer object to follow all calls to the specified real renderer.
186
187 @note
188 This object does not take ownership of (i.e. won't delete) @a rendererNative.
23324ae1 189 */
bbc5b7f8
BP
190 wxDelegateRendererNative(wxRendererNative& rendererNative);
191
192 // The rest of these functions inherit the documentation from wxRendererNative
193
194 virtual int DrawHeaderButton(wxWindow *win, wxDC& dc,
195 const wxRect& rect, int flags = 0,
196 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
197 wxHeaderButtonParams* params = NULL);
198
199 virtual int DrawHeaderButtonContents(wxWindow *win, wxDC& dc,
200 const wxRect& rect, int flags = 0,
201 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
202 wxHeaderButtonParams* params = NULL);
203
204 virtual int GetHeaderButtonHeight(wxWindow *win);
205
9aebcb5e
VS
206 virtual int GetHeaderButtonMargin(wxWindow *win);
207
bbc5b7f8
BP
208 virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc,
209 const wxRect& rect, int flags = 0);
210
211 virtual void DrawSplitterBorder(wxWindow *win, wxDC& dc,
212 const wxRect& rect, int flags = 0);
213
214 virtual void DrawSplitterSash(wxWindow *win, wxDC& dc,
215 const wxSize& size, wxCoord position,
216 wxOrientation orient, int flags = 0);
217
218 virtual void DrawComboBoxDropButton(wxWindow *win, wxDC& dc,
219 const wxRect& rect, int flags = 0);
220
221 virtual void DrawDropArrow(wxWindow *win, wxDC& dc,
222 const wxRect& rect, int flags = 0);
223
224 virtual void DrawCheckBox(wxWindow *win, wxDC& dc,
225 const wxRect& rect, int flags = 0 );
226
191e43fd 227 virtual wxSize GetCheckBoxSize(wxWindow *win);
e8759560 228
bbc5b7f8
BP
229 virtual void DrawPushButton(wxWindow *win, wxDC& dc,
230 const wxRect& rect, int flags = 0 );
231
232 virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc,
233 const wxRect& rect, int flags = 0 );
234
235 virtual void DrawFocusRect(wxWindow* win, wxDC& dc,
236 const wxRect& rect, int flags = 0);
237
238 virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
239
240 virtual wxRendererVersion GetVersion() const;
23324ae1
FM
241};
242
243
e54c96f1 244
23324ae1
FM
245/**
246 @class wxRendererNative
7c913512 247
bbc5b7f8 248 First, a brief introduction to wxRendererNative and why it is needed.
7c913512 249
23324ae1 250 Usually wxWidgets uses the underlying low level GUI system to draw all the
cdbcf4c2 251 controls - this is what we mean when we say that it is a "native" framework.
23324ae1
FM
252 However not all controls exist under all (or even any) platforms and in this
253 case wxWidgets provides a default, generic, implementation of them written in
254 wxWidgets itself.
7c913512 255
23324ae1
FM
256 These controls don't have the native appearance if only the standard
257 line drawing and other graphics primitives are used, because the native
258 appearance is different under different platforms while the lines are always
259 drawn in the same way.
7c913512 260
bbc5b7f8 261 This is why we have renderers: wxRendererNative is a class which virtualizes the
23324ae1
FM
262 drawing, i.e. it abstracts the drawing operations and allows you to draw say, a
263 button, without caring about exactly how this is done. Of course, as we
264 can draw the button differently in different renderers, this also allows us to
265 emulate the native look and feel.
7c913512 266
23324ae1
FM
267 So the renderers work by exposing a large set of high-level drawing functions
268 which are used by the generic controls. There is always a default global
7c913512 269 renderer but it may be changed or extended by the user, see
bbc5b7f8 270 @ref page_samples_render.
7c913512 271
23324ae1 272 All drawing functions take some standard parameters:
7c913512 273
bbc5b7f8 274 @li @a win - The window being drawn. It is normally not used and when
7c913512 275 it is it should only be used as a generic wxWindow
23324ae1
FM
276 (in order to get its low level handle, for example), but you should
277 not assume that it is of some given type as the same renderer
278 function may be reused for drawing different kinds of control.
bbc5b7f8 279 @li @a dc - The wxDC to draw on. Only this device
23324ae1
FM
280 context should be used for drawing. It is not necessary to restore
281 pens and brushes for it on function exit but, on the other hand, you
282 shouldn't assume that it is in any specific state on function entry:
283 the rendering functions should always prepare it.
bbc5b7f8
BP
284 @li @a rect - The bounding rectangle for the element to be drawn.
285 @li @a flags - The optional flags (none by default) which can be a
286 combination of the @ref wxCONTROL_FLAGS.
7c913512 287
23324ae1
FM
288 Note that each drawing function restores the wxDC attributes if
289 it changes them, so it is safe to assume that the same pen, brush and colours
290 that were active before the call to this function are still in effect after it.
7c913512 291
23324ae1
FM
292 @library{wxcore}
293 @category{gdi}
294*/
7c913512 295class wxRendererNative
23324ae1
FM
296{
297public:
298 /**
299 Virtual destructor as for any base class.
300 */
adaaa686 301 virtual ~wxRendererNative();
23324ae1
FM
302
303 /**
e8759560 304 Draw a check box.
bbc5b7f8 305
4cc4bfaf 306 @a flags may have the @c wxCONTROL_CHECKED, @c wxCONTROL_CURRENT or
bbc5b7f8 307 @c wxCONTROL_UNDETERMINED bit set, see @ref wxCONTROL_FLAGS.
23324ae1 308 */
43c48e1e
FM
309 virtual void DrawCheckBox(wxWindow* win, wxDC& dc, const wxRect& rect,
310 int flags = 0) = 0;
23324ae1
FM
311
312 /**
313 Draw a button like the one used by wxComboBox to show a
314 drop down window. The usual appearance is a downwards pointing arrow.
bbc5b7f8
BP
315
316 @a flags may have the @c wxCONTROL_PRESSED or @c wxCONTROL_CURRENT bit set,
317 see @ref wxCONTROL_FLAGS.
23324ae1 318 */
bbc5b7f8 319 virtual void DrawComboBoxDropButton(wxWindow* win, wxDC& dc,
43c48e1e 320 const wxRect& rect, int flags = 0) = 0;
23324ae1
FM
321
322 /**
323 Draw a drop down arrow that is suitable for use outside a combo box. Arrow will
bbc5b7f8
BP
324 have transparent background.
325
4cc4bfaf 326 @a rect is not entirely filled by the arrow. Instead, you should use bounding
23324ae1 327 rectangle of a drop down button which arrow matches the size you need.
bbc5b7f8
BP
328
329 @a flags may have the @c wxCONTROL_PRESSED or @c wxCONTROL_CURRENT bit set,
330 see @ref wxCONTROL_FLAGS.
23324ae1 331 */
bbc5b7f8 332 virtual void DrawDropArrow(wxWindow* win, wxDC& dc, const wxRect& rect,
43c48e1e 333 int flags = 0) = 0;
23324ae1
FM
334
335 /**
336 Draw a focus rectangle using the specified rectangle.
bbc5b7f8
BP
337 wxListCtrl.
338
339 The only supported flags is @c wxCONTROL_SELECTED for items which are selected.
340 see @ref wxCONTROL_FLAGS.
23324ae1 341 */
bbc5b7f8 342 virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect,
fadc2df6 343 int flags = 0) = 0;
23324ae1
FM
344
345 /**
bbc5b7f8
BP
346 Draw the header control button (used, for example, by wxListCtrl).
347
348 Depending on platforms the @a flags parameter may support the @c wxCONTROL_SELECTED
349 @c wxCONTROL_DISABLED and @c wxCONTROL_CURRENT bits, see @ref wxCONTROL_FLAGS.
350
351 @return
57ab6f23 352 The optimal width to contain the unabbreviated label text or
bbc5b7f8 353 bitmap, the sort arrow if present, and internal margins.
23324ae1 354 */
da1ed74c
FM
355 virtual int DrawHeaderButton(wxWindow* win, wxDC& dc, const wxRect& rect,
356 int flags = 0,
357 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = NULL) = 0;
bbc5b7f8
BP
358
359 /**
360 Draw the contents of a header control button (label, sort arrows,
361 etc.). This function is normally only called by DrawHeaderButton().
362
363 Depending on platforms the @a flags parameter may support the @c wxCONTROL_SELECTED
364 @c wxCONTROL_DISABLED and @c wxCONTROL_CURRENT bits, see @ref wxCONTROL_FLAGS.
365
366 @return
57ab6f23 367 The optimal width to contain the unabbreviated label text or
bbc5b7f8
BP
368 bitmap, the sort arrow if present, and internal margins.
369 */
da1ed74c 370 virtual int DrawHeaderButtonContents(wxWindow* win, wxDC& dc,
bbc5b7f8 371 const wxRect& rect, int flags = 0,
da1ed74c 372 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = NULL) = 0;
23324ae1
FM
373
374 /**
7c913512 375 Draw a selection rectangle underneath the text as used e.g. in a
bbc5b7f8
BP
376 wxListCtrl.
377
378 The supported @a flags are @c wxCONTROL_SELECTED for items
379 which are selected (e.g. often a blue rectangle) and @c wxCONTROL_CURRENT
380 for the item that has the focus (often a dotted line around the item's text).
381 @c wxCONTROL_FOCUSED may be used to indicate if the control has the focus
57ab6f23 382 (otherwise the selection rectangle is e.g. often grey and not blue).
bbc5b7f8
BP
383 This may be ignored by the renderer or deduced by the code directly from
384 the @a win.
23324ae1 385 */
bbc5b7f8 386 virtual void DrawItemSelectionRect(wxWindow* win, wxDC& dc,
fadc2df6 387 const wxRect& rect, int flags = 0) = 0;
23324ae1
FM
388
389 /**
390 Draw a blank push button that looks very similar to wxButton.
bbc5b7f8 391
4cc4bfaf 392 @a flags may have the @c wxCONTROL_PRESSED, @c wxCONTROL_CURRENT or
bbc5b7f8 393 @c wxCONTROL_ISDEFAULT bit set, see @ref wxCONTROL_FLAGS.
23324ae1 394 */
43c48e1e
FM
395 virtual void DrawPushButton(wxWindow* win, wxDC& dc, const wxRect& rect,
396 int flags = 0) = 0;
23324ae1
FM
397
398 /**
399 Draw the border for sash window: this border must be such that the sash
bbc5b7f8 400 drawn by DrawSplitterSash() blends into it well.
23324ae1 401 */
fadc2df6
FM
402 virtual void DrawSplitterBorder(wxWindow* win, wxDC& dc, const wxRect& rect,
403 int flags = 0) = 0;
23324ae1
FM
404
405 /**
4cc4bfaf
FM
406 Draw a sash. The @a orient parameter defines whether the sash should be
407 vertical or horizontal and how the @a position should be interpreted.
23324ae1 408 */
da1ed74c
FM
409 virtual void DrawSplitterSash(wxWindow* win, wxDC& dc, const wxSize& size,
410 wxCoord position, wxOrientation orient,
411 int flags = 0) = 0;
23324ae1
FM
412
413 /**
bbc5b7f8
BP
414 Draw the expanded/collapsed icon for a tree control item.
415
416 To draw an expanded button the @a flags parameter must contain @c wxCONTROL_EXPANDED bit,
417 see @ref wxCONTROL_FLAGS.
23324ae1 418 */
fadc2df6
FM
419 virtual void DrawTreeItemButton(wxWindow* win, wxDC& dc, const wxRect& rect,
420 int flags = 0) = 0;
23324ae1 421
92c32bbe 422 /**
befa206b
KO
423 Draw a native wxChoice
424 */
6e6b532c 425 virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
befa206b 426
92c32bbe 427 /**
befa206b
KO
428 Draw a native wxComboBox
429 */
6e6b532c 430 virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
befa206b 431
92c32bbe 432 /**
befa206b
KO
433 Draw a native wxTextCtrl frame
434 */
6e6b532c 435 virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
befa206b
KO
436
437 /**
6e6b532c 438 Draw a native wxRadioButton bitmap.
befa206b 439 */
6e6b532c 440 virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
befa206b 441
3427bc78
VZ
442 /**
443 Draw a title bar button in the given state.
444
445 This function is currently only available under MSW and OS X (and only
446 for wxTITLEBAR_BUTTON_CLOSE under the latter), its best replacement for
447 the other platforms is to use wxArtProvider to retrieve the bitmaps for
448 @c wxART_HELP and @c wxART_CLOSE (but not any other title bar buttons
449 and not for any state but normal, i.e. not pressed and not current one).
450
451 The presence of this function is indicated by @c
452 wxHAS_DRAW_TITLE_BAR_BITMAP symbol being defined.
453
454 Also notice that PNG handler must be enabled using wxImage::AddHandler()
455 to use this function under OS X currently as the bitmaps are embedded
456 in the library itself in PNG format.
457
458 @since 2.9.1
459 */
460 virtual void DrawTitleBarBitmap(wxWindow *win,
461 wxDC& dc,
462 const wxRect& rect,
463 wxTitleBarButton button,
464 int flags = 0) = 0;
465
23324ae1
FM
466 /**
467 Return the currently used renderer.
468 */
382f12e4 469 static wxRendererNative& Get();
23324ae1
FM
470
471 /**
472 Return the default (native) implementation for this platform -- this is also
7c913512 473 the one used by default but this may be changed by calling
23324ae1
FM
474 Set() in which case the return value of this
475 method may be different from the return value of Get().
476 */
382f12e4 477 static wxRendererNative& GetDefault();
23324ae1
FM
478
479 /**
480 Return the generic implementation of the renderer. Under some platforms, this
481 is the default renderer implementation, others have platform-specific default
482 renderer which can be retrieved by calling GetDefault().
483 */
382f12e4 484 static wxRendererNative& GetGeneric();
23324ae1 485
e8759560
VZ
486 /**
487 Returns the size of a check box.
191e43fd 488 The @a win parameter is not used currently and can be @NULL.
e8759560 489 */
191e43fd 490 virtual wxSize GetCheckBoxSize(wxWindow* win) = 0;
e8759560 491
23324ae1
FM
492 /**
493 Returns the height of a header button, either a fixed platform height if
191e43fd 494 available, or a generic height based on the @a win window's font.
23324ae1 495 */
da1ed74c 496 virtual int GetHeaderButtonHeight(wxWindow* win) = 0;
23324ae1 497
9aebcb5e
VS
498 /**
499 Returns the horizontal margin on the left and right sides of header
500 button's label.
501
502 @since 2.9.2
503 */
504 virtual int GetHeaderButtonMargin(wxWindow *win) = 0;
505
23324ae1 506 /**
191e43fd
FM
507 Get the splitter parameters, see wxSplitterRenderParams.
508 The @a win parameter should be a wxSplitterWindow.
23324ae1 509 */
da1ed74c 510 virtual wxSplitterRenderParams GetSplitterParams(const wxWindow* win) = 0;
23324ae1
FM
511
512 /**
7c913512 513 This function is used for version checking: Load()
23324ae1
FM
514 refuses to load any shared libraries implementing an older or incompatible
515 version.
bbc5b7f8
BP
516
517 @remarks
23324ae1 518 The implementation of this method is always the same in all renderers (simply
bbc5b7f8
BP
519 construct wxRendererVersion using the @c wxRendererVersion::Current_XXX values),
520 but it has to be in the derived, not base, class, to detect mismatches between
521 the renderers versions and so you have to implement it anew in all renderers.
23324ae1 522 */
da1ed74c 523 virtual wxRendererVersion GetVersion() const = 0;
23324ae1
FM
524
525 /**
526 Load the renderer from the specified DLL, the returned pointer must be
527 deleted by caller if not @NULL when it is not used any more.
bbc5b7f8 528
4cc4bfaf 529 The @a name should be just the base name of the renderer and not the full
7c913512 530 name of the DLL file which is constructed differently (using
bbc5b7f8 531 wxDynamicLibrary::CanonicalizePluginName())
23324ae1
FM
532 on different systems.
533 */
bbc5b7f8 534 static wxRendererNative* Load(const wxString& name);
23324ae1
FM
535
536 /**
537 Set the renderer to use, passing @NULL reverts to using the default
538 renderer (the global renderer must always exist).
bbc5b7f8 539
23324ae1
FM
540 Return the previous renderer used with Set() or @NULL if none.
541 */
bbc5b7f8 542 static wxRendererNative* Set(wxRendererNative* renderer);
23324ae1
FM
543};
544
545
e54c96f1 546
23324ae1 547/**
bbc5b7f8 548 @struct wxRendererVersion
7c913512
FM
549
550 This simple struct represents the wxRendererNative
551 interface version and is only used as the return value of
bbc5b7f8 552 wxRendererNative::GetVersion().
7c913512 553
23324ae1
FM
554 The version has two components: the version itself and the age. If the main
555 program and the renderer have different versions they are never compatible with
556 each other because the version is only changed when an existing virtual
557 function is modified or removed. The age, on the other hand, is incremented
558 each time a new virtual method is added and so, at least for the compilers
559 using a common C++ object model, the calling program is compatible with any
560 renderer which has the age greater or equal to its age. This verification is
e54c96f1 561 done by IsCompatible() method.
7c913512 562
a24b5254 563 @library{wxcore}
bbc5b7f8 564 @category{gdi}
23324ae1 565*/
bbc5b7f8 566struct wxRendererVersion
23324ae1 567{
5812de8a
RD
568 wxRendererVersion(int version_, int age_);
569
23324ae1 570 /**
7c913512 571 Checks if the main program is compatible with the renderer having the version
23324ae1 572 @e ver, returns @true if it is and @false otherwise.
bbc5b7f8
BP
573
574 This method is used by wxRendererNative::Load() to determine whether a
23324ae1
FM
575 renderer can be used.
576 */
577 static bool IsCompatible(const wxRendererVersion& ver);
578
579 /**
23324ae1
FM
580 The age component.
581 */
bbc5b7f8 582 const int age;
23324ae1
FM
583
584 /**
23324ae1
FM
585 The version component.
586 */
bbc5b7f8 587 const int version;
23324ae1 588};
e54c96f1 589