]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/renderer.h
compilation fix for wxUSE_STL==1 build
[wxWidgets.git] / include / wx / univ / renderer.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/renderer.h
3// Purpose: wxRenderer class declaration
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 06.08.00
7// RCS-ID: $Id$
442b35b5 8// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10///////////////////////////////////////////////////////////////////////////////
11
20ceebaa
MW
12#ifndef _WX_UNIV_RENDERER_H_
13#define _WX_UNIV_RENDERER_H_
14
1e6feb95 15/*
77ffb593 16 wxRenderer class is used to draw all wxWidgets controls. This is an ABC and
1e6feb95
VZ
17 the look of the application is determined by the concrete derivation of
18 wxRenderer used in the program.
19
20 It also contains a few static methods which may be used by the concrete
21 renderers and provide the functionality which is often similar or identical
22 in all renderers (using inheritance here would be more restrictive as the
23 given concrete renderer may need an arbitrary subset of the base class
9c7f49f5
VZ
24 methods).
25
26 Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and
27 includes the latters functionality (which it may delegate to the generic
28 implementation of the latter or reimplement itself).
1e6feb95
VZ
29 */
30
9c7f49f5
VZ
31#include "wx/renderer.h"
32
b5dbe15d
VS
33class WXDLLIMPEXP_FWD_CORE wxWindow;
34class WXDLLIMPEXP_FWD_CORE wxDC;
35class WXDLLIMPEXP_FWD_CORE wxCheckListBox;
9a6384ca
WS
36
37#if wxUSE_LISTBOX
b5dbe15d 38 class WXDLLIMPEXP_FWD_CORE wxListBox;
9a6384ca
WS
39#endif // wxUSE_LISTBOX
40
41#if wxUSE_MENUS
b5dbe15d
VS
42 class WXDLLIMPEXP_FWD_CORE wxMenu;
43 class WXDLLIMPEXP_FWD_CORE wxMenuGeometryInfo;
9a6384ca
WS
44#endif // wxUSE_MENUS
45
b5dbe15d 46class WXDLLIMPEXP_FWD_CORE wxScrollBar;
9a6384ca
WS
47
48#if wxUSE_TEXTCTRL
b5dbe15d 49 class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
9a6384ca
WS
50#endif
51
8cb172b4 52#if wxUSE_GAUGE
b5dbe15d 53 class WXDLLIMPEXP_FWD_CORE wxGauge;
8cb172b4 54#endif // wxUSE_GAUGE
1e6feb95
VZ
55
56#include "wx/string.h"
57#include "wx/gdicmn.h"
df028524 58#include "wx/icon.h"
1e6feb95 59
71e03035
VZ
60// helper class used by wxMenu-related functions
61class WXDLLEXPORT wxMenuGeometryInfo
62{
63public:
64 // get the total size of the menu
65 virtual wxSize GetSize() const = 0;
66
67 virtual ~wxMenuGeometryInfo();
68};
69
1e6feb95
VZ
70// ----------------------------------------------------------------------------
71// wxRenderer: abstract renderers interface
72// ----------------------------------------------------------------------------
73
9c7f49f5 74class WXDLLEXPORT wxRenderer : public wxDelegateRendererNative
1e6feb95
VZ
75{
76public:
77 // drawing functions
78 // -----------------
79
80 // draw the controls background
81 virtual void DrawBackground(wxDC& dc,
82 const wxColour& col,
83 const wxRect& rect,
193e19cf 84 int flags,
147b8a4a 85 wxWindow *window = NULL) = 0;
193e19cf
RR
86
87 // draw the button surface
88 virtual void DrawButtonSurface(wxDC& dc,
147b8a4a
VZ
89 const wxColour& col,
90 const wxRect& rect,
91 int flags) = 0;
a290fa5a 92
1e6feb95
VZ
93 // draw the label inside the given rectangle with the specified alignment
94 // and optionally emphasize the character with the given index
95 virtual void DrawLabel(wxDC& dc,
96 const wxString& label,
97 const wxRect& rect,
98 int flags = 0,
99 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
100 int indexAccel = -1,
101 wxRect *rectBounds = NULL) = 0;
102
103 // same but also draw a bitmap if it is valid
104 virtual void DrawButtonLabel(wxDC& dc,
105 const wxString& label,
106 const wxBitmap& image,
107 const wxRect& rect,
108 int flags = 0,
109 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
110 int indexAccel = -1,
111 wxRect *rectBounds = NULL) = 0;
112
147b8a4a 113
1e6feb95
VZ
114 // draw the border and optionally return the rectangle containing the
115 // region inside the border
116 virtual void DrawBorder(wxDC& dc,
117 wxBorder border,
118 const wxRect& rect,
119 int flags = 0,
120 wxRect *rectIn = (wxRect *)NULL) = 0;
121
122 // draw text control border (I hate to have a separate method for this but
34621cc5 123 // it is needed to accommodate GTK+)
1e6feb95
VZ
124 virtual void DrawTextBorder(wxDC& dc,
125 wxBorder border,
126 const wxRect& rect,
127 int flags = 0,
128 wxRect *rectIn = (wxRect *)NULL) = 0;
129
130 // draw push button border and return the rectangle left for the label
131 virtual void DrawButtonBorder(wxDC& dc,
132 const wxRect& rect,
133 int flags = 0,
134 wxRect *rectIn = (wxRect *)NULL) = 0;
135
136 // draw a horizontal line
137 virtual void DrawHorizontalLine(wxDC& dc,
138 wxCoord y, wxCoord x1, wxCoord x2) = 0;
139
140 // draw a vertical line
141 virtual void DrawVerticalLine(wxDC& dc,
142 wxCoord x, wxCoord y1, wxCoord y2) = 0;
143
144 // draw a frame with the label (horizontal alignment can be specified)
145 virtual void DrawFrame(wxDC& dc,
146 const wxString& label,
147 const wxRect& rect,
148 int flags = 0,
149 int alignment = wxALIGN_LEFT,
150 int indexAccel = -1) = 0;
151
152 // draw an arrow in the given direction
153 virtual void DrawArrow(wxDC& dc,
154 wxDirection dir,
155 const wxRect& rect,
156 int flags = 0) = 0;
157
158 // draw a scrollbar arrow (may be the same as arrow but may be not)
159 virtual void DrawScrollbarArrow(wxDC& dc,
160 wxDirection dir,
161 const wxRect& rect,
162 int flags = 0) = 0;
163
164 // draw the scrollbar thumb
165 virtual void DrawScrollbarThumb(wxDC& dc,
166 wxOrientation orient,
167 const wxRect& rect,
168 int flags = 0) = 0;
169
170 // draw a (part of) scrollbar shaft
171 virtual void DrawScrollbarShaft(wxDC& dc,
172 wxOrientation orient,
173 const wxRect& rect,
174 int flags = 0) = 0;
175
176 // draw the rectangle in the corner between two scrollbars
177 virtual void DrawScrollCorner(wxDC& dc,
178 const wxRect& rect) = 0;
179
180 // draw an item of a wxListBox
181 virtual void DrawItem(wxDC& dc,
182 const wxString& label,
183 const wxRect& rect,
184 int flags = 0) = 0;
185
186 // draw an item of a wxCheckListBox
187 virtual void DrawCheckItem(wxDC& dc,
188 const wxString& label,
189 const wxBitmap& bitmap,
190 const wxRect& rect,
191 int flags = 0) = 0;
192
193 // draw a checkbutton (bitmap may be invalid to use default one)
194 virtual void DrawCheckButton(wxDC& dc,
195 const wxString& label,
196 const wxBitmap& bitmap,
197 const wxRect& rect,
198 int flags = 0,
199 wxAlignment align = wxALIGN_LEFT,
200 int indexAccel = -1) = 0;
201
202 // draw a radio button
203 virtual void DrawRadioButton(wxDC& dc,
204 const wxString& label,
205 const wxBitmap& bitmap,
206 const wxRect& rect,
207 int flags = 0,
208 wxAlignment align = wxALIGN_LEFT,
209 int indexAccel = -1) = 0;
210
9a6384ca 211#if wxUSE_TOOLBAR
3216dbf5
VZ
212 // draw a toolbar button (label may be empty, bitmap may be invalid, if
213 // both conditions are true this function draws a separator)
214 virtual void DrawToolBarButton(wxDC& dc,
215 const wxString& label,
216 const wxBitmap& bitmap,
217 const wxRect& rect,
a8f4cabe 218 int flags = 0,
370efbe7
WS
219 long style = 0,
220 int tbarStyle = 0) = 0;
9a6384ca 221#endif // wxUSE_TOOLBAR
3216dbf5 222
147b8a4a 223#if wxUSE_TEXTCTRL
1e6feb95
VZ
224 // draw a (part of) line in the text control
225 virtual void DrawTextLine(wxDC& dc,
226 const wxString& text,
227 const wxRect& rect,
228 int selStart = -1,
229 int selEnd = -1,
230 int flags = 0) = 0;
231
232 // draw a line wrap indicator
233 virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect) = 0;
147b8a4a 234#endif // wxUSE_TEXTCTRL
1e6feb95 235
147b8a4a 236#if wxUSE_NOTEBOOK
1e6feb95
VZ
237 // draw a notebook tab
238 virtual void DrawTab(wxDC& dc,
239 const wxRect& rect,
240 wxDirection dir,
241 const wxString& label,
242 const wxBitmap& bitmap = wxNullBitmap,
243 int flags = 0,
244 int indexAccel = -1) = 0;
147b8a4a 245#endif // wxUSE_NOTEBOOK
1e6feb95 246
9a6384ca
WS
247#if wxUSE_SLIDER
248
1e6feb95
VZ
249 // draw the slider shaft
250 virtual void DrawSliderShaft(wxDC& dc,
251 const wxRect& rect,
6766e5d1 252 int lenThumb,
1e6feb95
VZ
253 wxOrientation orient,
254 int flags = 0,
6766e5d1 255 long style = 0,
1e6feb95
VZ
256 wxRect *rectShaft = NULL) = 0;
257
258 // draw the slider thumb
259 virtual void DrawSliderThumb(wxDC& dc,
260 const wxRect& rect,
261 wxOrientation orient,
6766e5d1
JS
262 int flags = 0,
263 long style = 0) = 0;
1e6feb95
VZ
264
265 // draw the slider ticks
266 virtual void DrawSliderTicks(wxDC& dc,
267 const wxRect& rect,
6766e5d1 268 int lenThumb,
1e6feb95
VZ
269 wxOrientation orient,
270 int start,
271 int end,
272 int step = 1,
6766e5d1
JS
273 int flags = 0,
274 long style = 0) = 0;
9a6384ca 275#endif // wxUSE_SLIDER
1e6feb95 276
9a6384ca 277#if wxUSE_MENUS
1e6feb95
VZ
278 // draw a menu bar item
279 virtual void DrawMenuBarItem(wxDC& dc,
280 const wxRect& rect,
281 const wxString& label,
282 int flags = 0,
283 int indexAccel = -1) = 0;
284
285 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
286 //
287 // the geometryInfo is calculated by GetMenuGeometry() function from below
288 virtual void DrawMenuItem(wxDC& dc,
289 wxCoord y,
290 const wxMenuGeometryInfo& geometryInfo,
291 const wxString& label,
292 const wxString& accel,
293 const wxBitmap& bitmap = wxNullBitmap,
294 int flags = 0,
295 int indexAccel = -1) = 0;
296
297 // draw a menu bar separator
298 virtual void DrawMenuSeparator(wxDC& dc,
299 wxCoord y,
300 const wxMenuGeometryInfo& geomInfo) = 0;
9a6384ca 301#endif // wxUSE_MENUS
71e03035 302
9a6384ca 303#if wxUSE_STATUSBAR
71e03035
VZ
304 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
305 // interpreted specially and means "draw the status bar grip" here
306 virtual void DrawStatusField(wxDC& dc,
307 const wxRect& rect,
308 const wxString& label,
c2919ab3 309 int flags = 0, int style = 0) = 0;
9a6384ca 310#endif // wxUSE_STATUSBAR
71e03035 311
24a23c35
VS
312 // draw complete frame/dialog titlebar
313 virtual void DrawFrameTitleBar(wxDC& dc,
314 const wxRect& rect,
315 const wxString& title,
316 const wxIcon& icon,
317 int flags,
813edf09
VS
318 int specialButton = 0,
319 int specialButtonFlags = 0) = 0;
71e03035 320
24a23c35
VS
321 // draw frame borders
322 virtual void DrawFrameBorder(wxDC& dc,
323 const wxRect& rect,
324 int flags) = 0;
325
326 // draw frame titlebar background
327 virtual void DrawFrameBackground(wxDC& dc,
328 const wxRect& rect,
329 int flags) = 0;
330
331 // draw frame title
332 virtual void DrawFrameTitle(wxDC& dc,
333 const wxRect& rect,
334 const wxString& title,
335 int flags) = 0;
336
337 // draw frame icon
338 virtual void DrawFrameIcon(wxDC& dc,
339 const wxRect& rect,
340 const wxIcon& icon,
341 int flags) = 0;
342
343 // draw frame buttons
344 virtual void DrawFrameButton(wxDC& dc,
345 wxCoord x, wxCoord y,
346 int button,
347 int flags = 0) = 0;
348
1e6feb95
VZ
349 // misc functions
350 // --------------
351
147b8a4a 352#if wxUSE_COMBOBOX
1e6feb95
VZ
353 // return the bitmaps to use for combobox button
354 virtual void GetComboBitmaps(wxBitmap *bmpNormal,
e4606ed9 355 wxBitmap *bmpFocus,
1e6feb95
VZ
356 wxBitmap *bmpPressed,
357 wxBitmap *bmpDisabled) = 0;
147b8a4a 358#endif // wxUSE_COMBOBOX
1e6feb95
VZ
359
360 // geometry functions
361 // ------------------
362
363 // get the dimensions of the border: rect.x/y contain the width/height of
364 // the left/top side, width/heigh - of the right/bottom one
365 virtual wxRect GetBorderDimensions(wxBorder border) const = 0;
366
367 // the scrollbars may be drawn either inside the window border or outside
368 // it - this function is used to decide how to draw them
369 virtual bool AreScrollbarsInsideBorder() const = 0;
370
371 // adjust the size of the control of the given class: for most controls,
372 // this just takes into account the border, but for some (buttons, for
373 // example) it is more complicated - the result being, in any case, that
374 // the control looks "nice" if it uses the adjusted rectangle
375 virtual void AdjustSize(wxSize *size, const wxWindow *window) = 0;
376
9a6384ca 377#if wxUSE_SCROLLBAR
1e6feb95
VZ
378 // get the size of a scrollbar arrow
379 virtual wxSize GetScrollbarArrowSize() const = 0;
9a6384ca
WS
380#endif // wxUSE_SCROLLBAR
381
1e6feb95
VZ
382 // get the height of a listbox item from the base font height
383 virtual wxCoord GetListboxItemHeight(wxCoord fontHeight) = 0;
384
385 // get the size of a checkbox/radio button bitmap
386 virtual wxSize GetCheckBitmapSize() const = 0;
387 virtual wxSize GetRadioBitmapSize() const = 0;
388 virtual wxCoord GetCheckItemMargin() const = 0;
389
dd267523 390#if wxUSE_TOOLBAR
3216dbf5
VZ
391 // get the standard size of a toolbar button and also return the size of
392 // a toolbar separator in the provided pointer
393 virtual wxSize GetToolBarButtonSize(wxCoord *separator) const = 0;
394
395 // get the margins between/around the toolbar buttons
396 virtual wxSize GetToolBarMargin() const = 0;
dd267523 397#endif // wxUSE_TOOLBAR
3216dbf5 398
9a6384ca 399#if wxUSE_TEXTCTRL
1e6feb95
VZ
400 // convert between text rectangle and client rectangle for text controls:
401 // the former is typicall smaller to leave margins around text
402 virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
3216dbf5 403 const wxRect& rectText) const = 0;
1e6feb95
VZ
404
405 // extra space is for line indicators
406 virtual wxRect GetTextClientArea(const wxTextCtrl *text,
407 const wxRect& rectTotal,
3216dbf5 408 wxCoord *extraSpaceBeyond) const = 0;
9a6384ca 409#endif // wxUSE_TEXTCTRL
1e6feb95 410
147b8a4a 411#if wxUSE_NOTEBOOK
1e6feb95
VZ
412 // get the overhang of a selected tab
413 virtual wxSize GetTabIndent() const = 0;
414
415 // get the padding around the text in a tab
416 virtual wxSize GetTabPadding() const = 0;
147b8a4a 417#endif // wxUSE_NOTEBOOK
1e6feb95 418
9a6384ca 419#if wxUSE_SLIDER
1e6feb95
VZ
420 // get the default size of the slider in lesser dimension (i.e. height of a
421 // horizontal slider or width of a vertical one)
422 virtual wxCoord GetSliderDim() const = 0;
423
424 // get the length of the slider ticks displayed along side slider
425 virtual wxCoord GetSliderTickLen() const = 0;
426
427 // get the slider shaft rect from the total slider rect
428 virtual wxRect GetSliderShaftRect(const wxRect& rect,
6766e5d1
JS
429 int lenThumb,
430 wxOrientation orient,
431 long style = 0) const = 0;
1e6feb95
VZ
432
433 // get the size of the slider thumb for the given total slider rect
434 virtual wxSize GetSliderThumbSize(const wxRect& rect,
6766e5d1 435 int lenThumb,
1e6feb95 436 wxOrientation orient) const = 0;
9a6384ca 437#endif // wxUSE_SLIDER
1e6feb95
VZ
438
439 // get the size of one progress bar step (in horz and vertical directions)
440 virtual wxSize GetProgressBarStep() const = 0;
441
9a6384ca 442#if wxUSE_MENUS
1e6feb95
VZ
443 // get the size of rectangle to use in the menubar for the given text rect
444 virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0;
445
446 // get the struct storing all layout info needed to draw all menu items
447 // (this can't be calculated for each item separately as they should be
448 // aligned)
449 //
450 // the returned pointer must be deleted by the caller
451 virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
452 const wxMenu& menu) const = 0;
9a6384ca 453#endif // wxUSE_MENUS
71e03035 454
9a6384ca 455#if wxUSE_STATUSBAR
71e03035 456 // get the borders around the status bar fields (x and y fields of the
283c797c
VS
457 // return value)
458 virtual wxSize GetStatusBarBorders() const = 0;
459
460 // get the border between the status bar fields
461 virtual wxCoord GetStatusBarBorderBetweenFields() const = 0;
462
463 // get the mergin between a field and its border
464 virtual wxSize GetStatusBarFieldMargins() const = 0;
9a6384ca 465#endif // wxUSE_STATUSBAR
24a23c35
VS
466
467 // get client area rectangle of top level window (i.e. subtract
468 // decorations from given rectangle)
469 virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const = 0;
71e03035 470
24a23c35
VS
471 // get size of whole top level window, given size of its client area size
472 virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0;
71e03035 473
e7dda1ff
VS
474 // get the minimal size of top level window
475 virtual wxSize GetFrameMinSize(int flags) const = 0;
476
24a23c35
VS
477 // get titlebar icon size
478 virtual wxSize GetFrameIconSize() const = 0;
71e03035 479
813edf09
VS
480 // returns one of wxHT_TOPLEVEL_XXX constants
481 virtual int HitTestFrame(const wxRect& rect,
482 const wxPoint& pt,
71e03035 483 int flags = 0) const = 0;
24a23c35 484
1e6feb95
VZ
485 // virtual dtor for any base class
486 virtual ~wxRenderer();
1e6feb95
VZ
487};
488
489// ----------------------------------------------------------------------------
490// wxDelegateRenderer: it is impossible to inherit from any of standard
491// renderers as their declarations are in private code, but you can use this
492// class to override only some of the Draw() functions - all the other ones
493// will be left to the original renderer
494// ----------------------------------------------------------------------------
495
496class WXDLLEXPORT wxDelegateRenderer : public wxRenderer
497{
498public:
499 wxDelegateRenderer(wxRenderer *renderer) : m_renderer(renderer) { }
500
501 virtual void DrawBackground(wxDC& dc,
502 const wxColour& col,
503 const wxRect& rect,
193e19cf
RR
504 int flags,
505 wxWindow *window = NULL )
506 { m_renderer->DrawBackground(dc, col, rect, flags, window ); }
147b8a4a
VZ
507 virtual void DrawButtonSurface(wxDC& dc,
508 const wxColour& col,
509 const wxRect& rect,
510 int flags)
511 { m_renderer->DrawButtonSurface(dc, col, rect, flags); }
974dc0de
JS
512 virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0)
513 { m_renderer->DrawFocusRect(win, dc, rect, flags); }
1e6feb95
VZ
514 virtual void DrawLabel(wxDC& dc,
515 const wxString& label,
516 const wxRect& rect,
517 int flags = 0,
518 int align = wxALIGN_LEFT | wxALIGN_TOP,
519 int indexAccel = -1,
520 wxRect *rectBounds = NULL)
521 { m_renderer->DrawLabel(dc, label, rect,
522 flags, align, indexAccel, rectBounds); }
523 virtual void DrawButtonLabel(wxDC& dc,
524 const wxString& label,
525 const wxBitmap& image,
526 const wxRect& rect,
527 int flags = 0,
528 int align = wxALIGN_LEFT | wxALIGN_TOP,
529 int indexAccel = -1,
530 wxRect *rectBounds = NULL)
531 { m_renderer->DrawButtonLabel(dc, label, image, rect,
532 flags, align, indexAccel, rectBounds); }
533 virtual void DrawBorder(wxDC& dc,
534 wxBorder border,
535 const wxRect& rect,
536 int flags = 0,
537 wxRect *rectIn = (wxRect *)NULL)
538 { m_renderer->DrawBorder(dc, border, rect, flags, rectIn); }
539 virtual void DrawTextBorder(wxDC& dc,
540 wxBorder border,
541 const wxRect& rect,
542 int flags = 0,
543 wxRect *rectIn = (wxRect *)NULL)
544 { m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); }
545 virtual void DrawButtonBorder(wxDC& dc,
546 const wxRect& rect,
547 int flags = 0,
548 wxRect *rectIn = (wxRect *)NULL)
549 { m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); }
550 virtual void DrawFrame(wxDC& dc,
551 const wxString& label,
552 const wxRect& rect,
553 int flags = 0,
554 int align = wxALIGN_LEFT,
555 int indexAccel = -1)
556 { m_renderer->DrawFrame(dc, label, rect, flags, align, indexAccel); }
557 virtual void DrawHorizontalLine(wxDC& dc,
558 wxCoord y, wxCoord x1, wxCoord x2)
559 { m_renderer->DrawHorizontalLine(dc, y, x1, x2); }
560 virtual void DrawVerticalLine(wxDC& dc,
561 wxCoord x, wxCoord y1, wxCoord y2)
562 { m_renderer->DrawVerticalLine(dc, x, y1, y2); }
563 virtual void DrawArrow(wxDC& dc,
564 wxDirection dir,
565 const wxRect& rect,
566 int flags = 0)
567 { m_renderer->DrawArrow(dc, dir, rect, flags); }
568 virtual void DrawScrollbarArrow(wxDC& dc,
569 wxDirection dir,
570 const wxRect& rect,
571 int flags = 0)
572 { m_renderer->DrawScrollbarArrow(dc, dir, rect, flags); }
573 virtual void DrawScrollbarThumb(wxDC& dc,
574 wxOrientation orient,
575 const wxRect& rect,
576 int flags = 0)
577 { m_renderer->DrawScrollbarThumb(dc, orient, rect, flags); }
578 virtual void DrawScrollbarShaft(wxDC& dc,
579 wxOrientation orient,
580 const wxRect& rect,
581 int flags = 0)
582 { m_renderer->DrawScrollbarShaft(dc, orient, rect, flags); }
583 virtual void DrawScrollCorner(wxDC& dc,
584 const wxRect& rect)
585 { m_renderer->DrawScrollCorner(dc, rect); }
586 virtual void DrawItem(wxDC& dc,
587 const wxString& label,
588 const wxRect& rect,
589 int flags = 0)
590 { m_renderer->DrawItem(dc, label, rect, flags); }
591 virtual void DrawCheckItem(wxDC& dc,
592 const wxString& label,
593 const wxBitmap& bitmap,
594 const wxRect& rect,
595 int flags = 0)
596 { m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); }
597 virtual void DrawCheckButton(wxDC& dc,
598 const wxString& label,
599 const wxBitmap& bitmap,
600 const wxRect& rect,
601 int flags = 0,
602 wxAlignment align = wxALIGN_LEFT,
603 int indexAccel = -1)
604 { m_renderer->DrawCheckButton(dc, label, bitmap, rect,
605 flags, align, indexAccel); }
606 virtual void DrawRadioButton(wxDC& dc,
607 const wxString& label,
608 const wxBitmap& bitmap,
609 const wxRect& rect,
610 int flags = 0,
611 wxAlignment align = wxALIGN_LEFT,
612 int indexAccel = -1)
613 { m_renderer->DrawRadioButton(dc, label, bitmap, rect,
614 flags, align, indexAccel); }
9a6384ca 615#if wxUSE_TOOLBAR
3216dbf5
VZ
616 virtual void DrawToolBarButton(wxDC& dc,
617 const wxString& label,
618 const wxBitmap& bitmap,
619 const wxRect& rect,
a8f4cabe 620 int flags = 0,
370efbe7
WS
621 long style = 0,
622 int tbarStyle = 0)
623 { m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); }
9a6384ca 624#endif // wxUSE_TOOLBAR
147b8a4a
VZ
625
626#if wxUSE_TEXTCTRL
1e6feb95
VZ
627 virtual void DrawTextLine(wxDC& dc,
628 const wxString& text,
629 const wxRect& rect,
630 int selStart = -1,
9979fbba
MB
631 int selEnd = -1,
632 int flags = 0)
633 { m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd, flags); }
1e6feb95
VZ
634 virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect)
635 { m_renderer->DrawLineWrapMark(dc, rect); }
147b8a4a 636#endif // wxUSE_TEXTCTRL
1e6feb95 637
147b8a4a 638#if wxUSE_NOTEBOOK
1e6feb95
VZ
639 virtual void DrawTab(wxDC& dc,
640 const wxRect& rect,
641 wxDirection dir,
642 const wxString& label,
643 const wxBitmap& bitmap = wxNullBitmap,
644 int flags = 0,
645 int accel = -1)
646 { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); }
147b8a4a 647#endif // wxUSE_NOTEBOOK
1e6feb95 648
9a6384ca
WS
649#if wxUSE_SLIDER
650
1e6feb95
VZ
651 virtual void DrawSliderShaft(wxDC& dc,
652 const wxRect& rect,
6766e5d1 653 int lenThumb,
1e6feb95
VZ
654 wxOrientation orient,
655 int flags = 0,
6766e5d1 656 long style = 0,
1e6feb95 657 wxRect *rectShaft = NULL)
6766e5d1 658 { m_renderer->DrawSliderShaft(dc, rect, lenThumb, orient, flags, style, rectShaft); }
1e6feb95
VZ
659 virtual void DrawSliderThumb(wxDC& dc,
660 const wxRect& rect,
661 wxOrientation orient,
6766e5d1
JS
662 int flags = 0,
663 long style = 0)
664 { m_renderer->DrawSliderThumb(dc, rect, orient, flags, style); }
1e6feb95
VZ
665 virtual void DrawSliderTicks(wxDC& dc,
666 const wxRect& rect,
6766e5d1 667 int lenThumb,
1e6feb95
VZ
668 wxOrientation orient,
669 int start,
670 int end,
61fef19b 671 int WXUNUSED(step) = 1,
6766e5d1
JS
672 int flags = 0,
673 long style = 0)
674 { m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient,
675 start, end, start, flags, style); }
9a6384ca 676#endif // wxUSE_SLIDER
1e6feb95 677
9a6384ca 678#if wxUSE_MENUS
1e6feb95
VZ
679 virtual void DrawMenuBarItem(wxDC& dc,
680 const wxRect& rect,
681 const wxString& label,
682 int flags = 0,
683 int indexAccel = -1)
684 { m_renderer->DrawMenuBarItem(dc, rect, label, flags, indexAccel); }
685 virtual void DrawMenuItem(wxDC& dc,
686 wxCoord y,
687 const wxMenuGeometryInfo& gi,
688 const wxString& label,
689 const wxString& accel,
690 const wxBitmap& bitmap = wxNullBitmap,
691 int flags = 0,
692 int indexAccel = -1)
693 { m_renderer->DrawMenuItem(dc, y, gi, label, accel,
694 bitmap, flags, indexAccel); }
695 virtual void DrawMenuSeparator(wxDC& dc,
696 wxCoord y,
697 const wxMenuGeometryInfo& geomInfo)
698 { m_renderer->DrawMenuSeparator(dc, y, geomInfo); }
9a6384ca 699#endif // wxUSE_MENUS
71e03035 700
9a6384ca 701#if wxUSE_STATUSBAR
71e03035
VZ
702 virtual void DrawStatusField(wxDC& dc,
703 const wxRect& rect,
704 const wxString& label,
e5aa044b 705 int flags = 0, int style = 0)
c2919ab3 706 { m_renderer->DrawStatusField(dc, rect, label, flags, style); }
9a6384ca 707#endif // wxUSE_STATUSBAR
71e03035 708
24a23c35
VS
709 virtual void DrawFrameTitleBar(wxDC& dc,
710 const wxRect& rect,
711 const wxString& title,
712 const wxIcon& icon,
713 int flags,
813edf09
VS
714 int specialButton = 0,
715 int specialButtonFlag = 0)
71e03035 716 { m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags,
813edf09 717 specialButton, specialButtonFlag); }
24a23c35
VS
718 virtual void DrawFrameBorder(wxDC& dc,
719 const wxRect& rect,
720 int flags)
721 { m_renderer->DrawFrameBorder(dc, rect, flags); }
722 virtual void DrawFrameBackground(wxDC& dc,
723 const wxRect& rect,
724 int flags)
725 { m_renderer->DrawFrameBackground(dc, rect, flags); }
726 virtual void DrawFrameTitle(wxDC& dc,
727 const wxRect& rect,
728 const wxString& title,
729 int flags)
730 { m_renderer->DrawFrameTitle(dc, rect, title, flags); }
731 virtual void DrawFrameIcon(wxDC& dc,
732 const wxRect& rect,
733 const wxIcon& icon,
734 int flags)
735 { m_renderer->DrawFrameIcon(dc, rect, icon, flags); }
736 virtual void DrawFrameButton(wxDC& dc,
737 wxCoord x, wxCoord y,
738 int button,
739 int flags = 0)
740 { m_renderer->DrawFrameButton(dc, x, y, button, flags); }
741
147b8a4a 742#if wxUSE_COMBOBOX
1e6feb95 743 virtual void GetComboBitmaps(wxBitmap *bmpNormal,
e4606ed9 744 wxBitmap *bmpFocus,
1e6feb95 745 wxBitmap *bmpPressed,
9979fbba 746 wxBitmap *bmpDisabled)
e4606ed9
VZ
747 { m_renderer->GetComboBitmaps(bmpNormal, bmpFocus,
748 bmpPressed, bmpDisabled); }
147b8a4a 749#endif // wxUSE_COMBOBOX
1e6feb95
VZ
750
751 virtual void AdjustSize(wxSize *size, const wxWindow *window)
752 { m_renderer->AdjustSize(size, window); }
753 virtual wxRect GetBorderDimensions(wxBorder border) const
754 { return m_renderer->GetBorderDimensions(border); }
755 virtual bool AreScrollbarsInsideBorder() const
756 { return m_renderer->AreScrollbarsInsideBorder(); }
757
9a6384ca 758#if wxUSE_SCROLLBAR
1e6feb95
VZ
759 virtual wxSize GetScrollbarArrowSize() const
760 { return m_renderer->GetScrollbarArrowSize(); }
9a6384ca
WS
761#endif // wxUSE_SCROLLBAR
762
1e6feb95
VZ
763 virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
764 { return m_renderer->GetListboxItemHeight(fontHeight); }
765 virtual wxSize GetCheckBitmapSize() const
766 { return m_renderer->GetCheckBitmapSize(); }
767 virtual wxSize GetRadioBitmapSize() const
768 { return m_renderer->GetRadioBitmapSize(); }
769 virtual wxCoord GetCheckItemMargin() const
770 { return m_renderer->GetCheckItemMargin(); }
771
dd267523 772#if wxUSE_TOOLBAR
3216dbf5
VZ
773 virtual wxSize GetToolBarButtonSize(wxCoord *separator) const
774 { return m_renderer->GetToolBarButtonSize(separator); }
775 virtual wxSize GetToolBarMargin() const
776 { return m_renderer->GetToolBarMargin(); }
dd267523 777#endif // wxUSE_TOOLBAR
3216dbf5 778
9a6384ca 779#if wxUSE_TEXTCTRL
3216dbf5
VZ
780 virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
781 const wxRect& rect) const
1e6feb95
VZ
782 { return m_renderer->GetTextTotalArea(text, rect); }
783 virtual wxRect GetTextClientArea(const wxTextCtrl *text,
784 const wxRect& rect,
3216dbf5 785 wxCoord *extraSpaceBeyond) const
1e6feb95 786 { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); }
9a6384ca 787#endif // wxUSE_TEXTCTRL
1e6feb95 788
c4036939 789#if wxUSE_NOTEBOOK
1e6feb95
VZ
790 virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); }
791 virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); }
c4036939 792#endif // wxUSE_NOTEBOOK
1e6feb95 793
9a6384ca 794#if wxUSE_SLIDER
1e6feb95
VZ
795 virtual wxCoord GetSliderDim() const
796 { return m_renderer->GetSliderDim(); }
797 virtual wxCoord GetSliderTickLen() const
798 { return m_renderer->GetSliderTickLen(); }
9a6384ca 799
1e6feb95 800 virtual wxRect GetSliderShaftRect(const wxRect& rect,
6766e5d1
JS
801 int lenThumb,
802 wxOrientation orient,
803 long style = 0) const
804 { return m_renderer->GetSliderShaftRect(rect, lenThumb, orient, style); }
1e6feb95 805 virtual wxSize GetSliderThumbSize(const wxRect& rect,
6766e5d1 806 int lenThumb,
1e6feb95 807 wxOrientation orient) const
6766e5d1 808 { return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); }
9a6384ca
WS
809#endif // wxUSE_SLIDER
810
1e6feb95
VZ
811 virtual wxSize GetProgressBarStep() const
812 { return m_renderer->GetProgressBarStep(); }
9a6384ca
WS
813
814#if wxUSE_MENUS
1e6feb95
VZ
815 virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const
816 { return m_renderer->GetMenuBarItemSize(sizeText); }
817 virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
818 const wxMenu& menu) const
819 { return m_renderer->GetMenuGeometry(win, menu); }
9a6384ca
WS
820#endif // wxUSE_MENUS
821
822#if wxUSE_STATUSBAR
283c797c
VS
823 virtual wxSize GetStatusBarBorders() const
824 { return m_renderer->GetStatusBarBorders(); }
825 virtual wxCoord GetStatusBarBorderBetweenFields() const
826 { return m_renderer->GetStatusBarBorderBetweenFields(); }
827 virtual wxSize GetStatusBarFieldMargins() const
828 { return m_renderer->GetStatusBarFieldMargins(); }
9a6384ca 829#endif // wxUSE_STATUSBAR
283c797c 830
24a23c35
VS
831 virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const
832 { return m_renderer->GetFrameClientArea(rect, flags); }
833 virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const
834 { return m_renderer->GetFrameTotalSize(clientSize, flags); }
e7dda1ff
VS
835 virtual wxSize GetFrameMinSize(int flags) const
836 { return m_renderer->GetFrameMinSize(flags); }
24a23c35
VS
837 virtual wxSize GetFrameIconSize() const
838 { return m_renderer->GetFrameIconSize(); }
813edf09
VS
839 virtual int HitTestFrame(const wxRect& rect,
840 const wxPoint& pt,
841 int flags) const
842 { return m_renderer->HitTestFrame(rect, pt, flags); }
24a23c35 843
c97c9952 844 virtual int DrawHeaderButton(wxWindow *win,
9c7f49f5
VZ
845 wxDC& dc,
846 const wxRect& rect,
249e3041 847 int flags = 0,
147b8a4a
VZ
848 wxHeaderSortIconType sortIcon = wxHDR_SORT_ICON_NONE,
849 wxHeaderButtonParams* params = NULL)
c97c9952 850 { return m_renderer->DrawHeaderButton(win, dc, rect, flags, sortIcon, params); }
9c7f49f5
VZ
851 virtual void DrawTreeItemButton(wxWindow *win,
852 wxDC& dc,
853 const wxRect& rect,
854 int flags = 0)
855 { m_renderer->DrawTreeItemButton(win, dc, rect, flags); }
856
1e6feb95
VZ
857protected:
858 wxRenderer *m_renderer;
859};
860
861// ----------------------------------------------------------------------------
862// wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
863// OnPaint()
864// ----------------------------------------------------------------------------
865
866class WXDLLEXPORT wxControlRenderer
867{
868public:
869 // create a renderer for this dc with this "fundamental" renderer
870 wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer);
871
872 // operations
873 void DrawLabel(const wxBitmap& bitmap = wxNullBitmap,
874 wxCoord marginX = 0, wxCoord marginY = 0);
875#if wxUSE_LISTBOX
876 void DrawItems(const wxListBox *listbox,
877 size_t itemFirst, size_t itemLast);
878#endif // wxUSE_LISTBOX
879#if wxUSE_CHECKLISTBOX
880 void DrawCheckItems(const wxCheckListBox *listbox,
881 size_t itemFirst, size_t itemLast);
882#endif // wxUSE_CHECKLISTBOX
883 void DrawButtonBorder();
884 // the line must be either horizontal or vertical
885 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
886 void DrawFrame();
887 void DrawBitmap(const wxBitmap& bitmap);
888 void DrawBackgroundBitmap();
889 void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld);
890#if wxUSE_GAUGE
891 void DrawProgressBar(const wxGauge *gauge);
892#endif // wxUSE_GAUGE
893
894 // accessors
895 wxWindow *GetWindow() const { return m_window; }
896 wxRenderer *GetRenderer() const { return m_renderer; }
897
898 wxDC& GetDC() { return m_dc; }
899
900 const wxRect& GetRect() const { return m_rect; }
901 wxRect& GetRect() { return m_rect; }
902
903 // static helpers
904 static void DrawBitmap(wxDC &dc,
905 const wxBitmap& bitmap,
906 const wxRect& rect,
907 int alignment = wxALIGN_CENTRE |
908 wxALIGN_CENTRE_VERTICAL,
909 wxStretch stretch = wxSTRETCH_NOT);
910
911private:
9a6384ca
WS
912
913#if wxUSE_LISTBOX
1e6feb95
VZ
914 // common part of DrawItems() and DrawCheckItems()
915 void DoDrawItems(const wxListBox *listbox,
916 size_t itemFirst, size_t itemLast,
a290fa5a 917 bool isCheckLbox = false);
9a6384ca 918#endif // wxUSE_LISTBOX
1e6feb95
VZ
919
920 wxWindow *m_window;
921 wxRenderer *m_renderer;
922 wxDC& m_dc;
923 wxRect m_rect;
924};
925
926#endif // _WX_UNIV_RENDERER_H_