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