]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/renderer.h
[ 1559479 ] wxImageComboBox
[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
dd267523 417#if wxUSE_TOOLBAR
3216dbf5
VZ
418 // get the standard size of a toolbar button and also return the size of
419 // a toolbar separator in the provided pointer
420 virtual wxSize GetToolBarButtonSize(wxCoord *separator) const = 0;
421
422 // get the margins between/around the toolbar buttons
423 virtual wxSize GetToolBarMargin() const = 0;
dd267523 424#endif // wxUSE_TOOLBAR
3216dbf5 425
9a6384ca 426#if wxUSE_TEXTCTRL
1e6feb95
VZ
427 // convert between text rectangle and client rectangle for text controls:
428 // the former is typicall smaller to leave margins around text
429 virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
3216dbf5 430 const wxRect& rectText) const = 0;
1e6feb95
VZ
431
432 // extra space is for line indicators
433 virtual wxRect GetTextClientArea(const wxTextCtrl *text,
434 const wxRect& rectTotal,
3216dbf5 435 wxCoord *extraSpaceBeyond) const = 0;
9a6384ca 436#endif // wxUSE_TEXTCTRL
1e6feb95 437
147b8a4a 438#if wxUSE_NOTEBOOK
1e6feb95
VZ
439 // get the overhang of a selected tab
440 virtual wxSize GetTabIndent() const = 0;
441
442 // get the padding around the text in a tab
443 virtual wxSize GetTabPadding() const = 0;
147b8a4a 444#endif // wxUSE_NOTEBOOK
1e6feb95 445
9a6384ca 446#if wxUSE_SLIDER
1e6feb95
VZ
447 // get the default size of the slider in lesser dimension (i.e. height of a
448 // horizontal slider or width of a vertical one)
449 virtual wxCoord GetSliderDim() const = 0;
450
451 // get the length of the slider ticks displayed along side slider
452 virtual wxCoord GetSliderTickLen() const = 0;
453
454 // get the slider shaft rect from the total slider rect
455 virtual wxRect GetSliderShaftRect(const wxRect& rect,
6766e5d1
JS
456 int lenThumb,
457 wxOrientation orient,
458 long style = 0) const = 0;
1e6feb95
VZ
459
460 // get the size of the slider thumb for the given total slider rect
461 virtual wxSize GetSliderThumbSize(const wxRect& rect,
6766e5d1 462 int lenThumb,
1e6feb95 463 wxOrientation orient) const = 0;
9a6384ca 464#endif // wxUSE_SLIDER
1e6feb95
VZ
465
466 // get the size of one progress bar step (in horz and vertical directions)
467 virtual wxSize GetProgressBarStep() const = 0;
468
9a6384ca 469#if wxUSE_MENUS
1e6feb95
VZ
470 // get the size of rectangle to use in the menubar for the given text rect
471 virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const = 0;
472
473 // get the struct storing all layout info needed to draw all menu items
474 // (this can't be calculated for each item separately as they should be
475 // aligned)
476 //
477 // the returned pointer must be deleted by the caller
478 virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
479 const wxMenu& menu) const = 0;
9a6384ca 480#endif // wxUSE_MENUS
71e03035 481
9a6384ca 482#if wxUSE_STATUSBAR
71e03035
VZ
483 // get the borders around the status bar fields (x and y fields of the
484 // return value) and also, optionally, the border between the fields
485 virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const = 0;
9a6384ca 486#endif // wxUSE_STATUSBAR
24a23c35
VS
487
488 // get client area rectangle of top level window (i.e. subtract
489 // decorations from given rectangle)
490 virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const = 0;
71e03035 491
24a23c35
VS
492 // get size of whole top level window, given size of its client area size
493 virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0;
71e03035 494
e7dda1ff
VS
495 // get the minimal size of top level window
496 virtual wxSize GetFrameMinSize(int flags) const = 0;
497
24a23c35
VS
498 // get titlebar icon size
499 virtual wxSize GetFrameIconSize() const = 0;
71e03035 500
813edf09
VS
501 // returns one of wxHT_TOPLEVEL_XXX constants
502 virtual int HitTestFrame(const wxRect& rect,
503 const wxPoint& pt,
71e03035 504 int flags = 0) const = 0;
24a23c35 505
1e6feb95
VZ
506 // virtual dtor for any base class
507 virtual ~wxRenderer();
1e6feb95
VZ
508};
509
510// ----------------------------------------------------------------------------
511// wxDelegateRenderer: it is impossible to inherit from any of standard
512// renderers as their declarations are in private code, but you can use this
513// class to override only some of the Draw() functions - all the other ones
514// will be left to the original renderer
515// ----------------------------------------------------------------------------
516
517class WXDLLEXPORT wxDelegateRenderer : public wxRenderer
518{
519public:
520 wxDelegateRenderer(wxRenderer *renderer) : m_renderer(renderer) { }
521
522 virtual void DrawBackground(wxDC& dc,
523 const wxColour& col,
524 const wxRect& rect,
193e19cf
RR
525 int flags,
526 wxWindow *window = NULL )
527 { m_renderer->DrawBackground(dc, col, rect, flags, window ); }
147b8a4a
VZ
528 virtual void DrawButtonSurface(wxDC& dc,
529 const wxColour& col,
530 const wxRect& rect,
531 int flags)
532 { m_renderer->DrawButtonSurface(dc, col, rect, flags); }
533 virtual void DrawFocusRect(wxDC& dc, const wxRect& rect)
534 { m_renderer->DrawFocusRect(dc, rect); }
1e6feb95
VZ
535 virtual void DrawLabel(wxDC& dc,
536 const wxString& label,
537 const wxRect& rect,
538 int flags = 0,
539 int align = wxALIGN_LEFT | wxALIGN_TOP,
540 int indexAccel = -1,
541 wxRect *rectBounds = NULL)
542 { m_renderer->DrawLabel(dc, label, rect,
543 flags, align, indexAccel, rectBounds); }
544 virtual void DrawButtonLabel(wxDC& dc,
545 const wxString& label,
546 const wxBitmap& image,
547 const wxRect& rect,
548 int flags = 0,
549 int align = wxALIGN_LEFT | wxALIGN_TOP,
550 int indexAccel = -1,
551 wxRect *rectBounds = NULL)
552 { m_renderer->DrawButtonLabel(dc, label, image, rect,
553 flags, align, indexAccel, rectBounds); }
554 virtual void DrawBorder(wxDC& dc,
555 wxBorder border,
556 const wxRect& rect,
557 int flags = 0,
558 wxRect *rectIn = (wxRect *)NULL)
559 { m_renderer->DrawBorder(dc, border, rect, flags, rectIn); }
560 virtual void DrawTextBorder(wxDC& dc,
561 wxBorder border,
562 const wxRect& rect,
563 int flags = 0,
564 wxRect *rectIn = (wxRect *)NULL)
565 { m_renderer->DrawTextBorder(dc, border, rect, flags, rectIn); }
566 virtual void DrawButtonBorder(wxDC& dc,
567 const wxRect& rect,
568 int flags = 0,
569 wxRect *rectIn = (wxRect *)NULL)
570 { m_renderer->DrawButtonBorder(dc, rect, flags, rectIn); }
571 virtual void DrawFrame(wxDC& dc,
572 const wxString& label,
573 const wxRect& rect,
574 int flags = 0,
575 int align = wxALIGN_LEFT,
576 int indexAccel = -1)
577 { m_renderer->DrawFrame(dc, label, rect, flags, align, indexAccel); }
578 virtual void DrawHorizontalLine(wxDC& dc,
579 wxCoord y, wxCoord x1, wxCoord x2)
580 { m_renderer->DrawHorizontalLine(dc, y, x1, x2); }
581 virtual void DrawVerticalLine(wxDC& dc,
582 wxCoord x, wxCoord y1, wxCoord y2)
583 { m_renderer->DrawVerticalLine(dc, x, y1, y2); }
584 virtual void DrawArrow(wxDC& dc,
585 wxDirection dir,
586 const wxRect& rect,
587 int flags = 0)
588 { m_renderer->DrawArrow(dc, dir, rect, flags); }
589 virtual void DrawScrollbarArrow(wxDC& dc,
590 wxDirection dir,
591 const wxRect& rect,
592 int flags = 0)
593 { m_renderer->DrawScrollbarArrow(dc, dir, rect, flags); }
594 virtual void DrawScrollbarThumb(wxDC& dc,
595 wxOrientation orient,
596 const wxRect& rect,
597 int flags = 0)
598 { m_renderer->DrawScrollbarThumb(dc, orient, rect, flags); }
599 virtual void DrawScrollbarShaft(wxDC& dc,
600 wxOrientation orient,
601 const wxRect& rect,
602 int flags = 0)
603 { m_renderer->DrawScrollbarShaft(dc, orient, rect, flags); }
604 virtual void DrawScrollCorner(wxDC& dc,
605 const wxRect& rect)
606 { m_renderer->DrawScrollCorner(dc, rect); }
607 virtual void DrawItem(wxDC& dc,
608 const wxString& label,
609 const wxRect& rect,
610 int flags = 0)
611 { m_renderer->DrawItem(dc, label, rect, flags); }
612 virtual void DrawCheckItem(wxDC& dc,
613 const wxString& label,
614 const wxBitmap& bitmap,
615 const wxRect& rect,
616 int flags = 0)
617 { m_renderer->DrawCheckItem(dc, label, bitmap, rect, flags); }
618 virtual void DrawCheckButton(wxDC& dc,
619 const wxString& label,
620 const wxBitmap& bitmap,
621 const wxRect& rect,
622 int flags = 0,
623 wxAlignment align = wxALIGN_LEFT,
624 int indexAccel = -1)
625 { m_renderer->DrawCheckButton(dc, label, bitmap, rect,
626 flags, align, indexAccel); }
627 virtual void DrawRadioButton(wxDC& dc,
628 const wxString& label,
629 const wxBitmap& bitmap,
630 const wxRect& rect,
631 int flags = 0,
632 wxAlignment align = wxALIGN_LEFT,
633 int indexAccel = -1)
634 { m_renderer->DrawRadioButton(dc, label, bitmap, rect,
635 flags, align, indexAccel); }
9a6384ca 636#if wxUSE_TOOLBAR
3216dbf5
VZ
637 virtual void DrawToolBarButton(wxDC& dc,
638 const wxString& label,
639 const wxBitmap& bitmap,
640 const wxRect& rect,
a8f4cabe 641 int flags = 0,
370efbe7
WS
642 long style = 0,
643 int tbarStyle = 0)
644 { m_renderer->DrawToolBarButton(dc, label, bitmap, rect, flags, style, tbarStyle); }
9a6384ca 645#endif // wxUSE_TOOLBAR
147b8a4a
VZ
646
647#if wxUSE_TEXTCTRL
1e6feb95
VZ
648 virtual void DrawTextLine(wxDC& dc,
649 const wxString& text,
650 const wxRect& rect,
651 int selStart = -1,
9979fbba
MB
652 int selEnd = -1,
653 int flags = 0)
654 { m_renderer->DrawTextLine(dc, text, rect, selStart, selEnd, flags); }
1e6feb95
VZ
655 virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect)
656 { m_renderer->DrawLineWrapMark(dc, rect); }
147b8a4a 657#endif // wxUSE_TEXTCTRL
1e6feb95 658
147b8a4a 659#if wxUSE_NOTEBOOK
1e6feb95
VZ
660 virtual void DrawTab(wxDC& dc,
661 const wxRect& rect,
662 wxDirection dir,
663 const wxString& label,
664 const wxBitmap& bitmap = wxNullBitmap,
665 int flags = 0,
666 int accel = -1)
667 { m_renderer->DrawTab(dc, rect, dir, label, bitmap, flags, accel); }
147b8a4a 668#endif // wxUSE_NOTEBOOK
1e6feb95 669
9a6384ca
WS
670#if wxUSE_SLIDER
671
1e6feb95
VZ
672 virtual void DrawSliderShaft(wxDC& dc,
673 const wxRect& rect,
6766e5d1 674 int lenThumb,
1e6feb95
VZ
675 wxOrientation orient,
676 int flags = 0,
6766e5d1 677 long style = 0,
1e6feb95 678 wxRect *rectShaft = NULL)
6766e5d1 679 { m_renderer->DrawSliderShaft(dc, rect, lenThumb, orient, flags, style, rectShaft); }
1e6feb95
VZ
680 virtual void DrawSliderThumb(wxDC& dc,
681 const wxRect& rect,
682 wxOrientation orient,
6766e5d1
JS
683 int flags = 0,
684 long style = 0)
685 { m_renderer->DrawSliderThumb(dc, rect, orient, flags, style); }
1e6feb95
VZ
686 virtual void DrawSliderTicks(wxDC& dc,
687 const wxRect& rect,
6766e5d1 688 int lenThumb,
1e6feb95
VZ
689 wxOrientation orient,
690 int start,
691 int end,
61fef19b 692 int WXUNUSED(step) = 1,
6766e5d1
JS
693 int flags = 0,
694 long style = 0)
695 { m_renderer->DrawSliderTicks(dc, rect, lenThumb, orient,
696 start, end, start, flags, style); }
9a6384ca 697#endif // wxUSE_SLIDER
1e6feb95 698
9a6384ca 699#if wxUSE_MENUS
1e6feb95
VZ
700 virtual void DrawMenuBarItem(wxDC& dc,
701 const wxRect& rect,
702 const wxString& label,
703 int flags = 0,
704 int indexAccel = -1)
705 { m_renderer->DrawMenuBarItem(dc, rect, label, flags, indexAccel); }
706 virtual void DrawMenuItem(wxDC& dc,
707 wxCoord y,
708 const wxMenuGeometryInfo& gi,
709 const wxString& label,
710 const wxString& accel,
711 const wxBitmap& bitmap = wxNullBitmap,
712 int flags = 0,
713 int indexAccel = -1)
714 { m_renderer->DrawMenuItem(dc, y, gi, label, accel,
715 bitmap, flags, indexAccel); }
716 virtual void DrawMenuSeparator(wxDC& dc,
717 wxCoord y,
718 const wxMenuGeometryInfo& geomInfo)
719 { m_renderer->DrawMenuSeparator(dc, y, geomInfo); }
9a6384ca 720#endif // wxUSE_MENUS
71e03035 721
9a6384ca 722#if wxUSE_STATUSBAR
71e03035
VZ
723 virtual void DrawStatusField(wxDC& dc,
724 const wxRect& rect,
725 const wxString& label,
e5aa044b 726 int flags = 0, int style = 0)
c2919ab3 727 { m_renderer->DrawStatusField(dc, rect, label, flags, style); }
9a6384ca 728#endif // wxUSE_STATUSBAR
71e03035 729
24a23c35
VS
730 virtual void DrawFrameTitleBar(wxDC& dc,
731 const wxRect& rect,
732 const wxString& title,
733 const wxIcon& icon,
734 int flags,
813edf09
VS
735 int specialButton = 0,
736 int specialButtonFlag = 0)
71e03035 737 { m_renderer->DrawFrameTitleBar(dc, rect, title, icon, flags,
813edf09 738 specialButton, specialButtonFlag); }
24a23c35
VS
739 virtual void DrawFrameBorder(wxDC& dc,
740 const wxRect& rect,
741 int flags)
742 { m_renderer->DrawFrameBorder(dc, rect, flags); }
743 virtual void DrawFrameBackground(wxDC& dc,
744 const wxRect& rect,
745 int flags)
746 { m_renderer->DrawFrameBackground(dc, rect, flags); }
747 virtual void DrawFrameTitle(wxDC& dc,
748 const wxRect& rect,
749 const wxString& title,
750 int flags)
751 { m_renderer->DrawFrameTitle(dc, rect, title, flags); }
752 virtual void DrawFrameIcon(wxDC& dc,
753 const wxRect& rect,
754 const wxIcon& icon,
755 int flags)
756 { m_renderer->DrawFrameIcon(dc, rect, icon, flags); }
757 virtual void DrawFrameButton(wxDC& dc,
758 wxCoord x, wxCoord y,
759 int button,
760 int flags = 0)
761 { m_renderer->DrawFrameButton(dc, x, y, button, flags); }
762
147b8a4a 763#if wxUSE_COMBOBOX
1e6feb95 764 virtual void GetComboBitmaps(wxBitmap *bmpNormal,
e4606ed9 765 wxBitmap *bmpFocus,
1e6feb95 766 wxBitmap *bmpPressed,
9979fbba 767 wxBitmap *bmpDisabled)
e4606ed9
VZ
768 { m_renderer->GetComboBitmaps(bmpNormal, bmpFocus,
769 bmpPressed, bmpDisabled); }
147b8a4a 770#endif // wxUSE_COMBOBOX
1e6feb95
VZ
771
772 virtual void AdjustSize(wxSize *size, const wxWindow *window)
773 { m_renderer->AdjustSize(size, window); }
774 virtual wxRect GetBorderDimensions(wxBorder border) const
775 { return m_renderer->GetBorderDimensions(border); }
776 virtual bool AreScrollbarsInsideBorder() const
777 { return m_renderer->AreScrollbarsInsideBorder(); }
778
9a6384ca 779#if wxUSE_SCROLLBAR
1e6feb95
VZ
780 virtual wxSize GetScrollbarArrowSize() const
781 { return m_renderer->GetScrollbarArrowSize(); }
782 virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
783 wxScrollBar::Element elem,
784 int thumbPos = -1) const
785 { return m_renderer->GetScrollbarRect(scrollbar, elem, thumbPos); }
786 virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar)
787 { return m_renderer->GetScrollbarSize(scrollbar); }
788 virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
789 const wxPoint& pt) const
790 { return m_renderer->HitTestScrollbar(scrollbar, pt); }
791 virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
792 int thumbPos = -1)
793 { return m_renderer->ScrollbarToPixel(scrollbar, thumbPos); }
794 virtual int PixelToScrollbar(const wxScrollBar *scrollbar,
795 wxCoord coord)
796 { return m_renderer->PixelToScrollbar(scrollbar, coord); }
9a6384ca
WS
797#endif // wxUSE_SCROLLBAR
798
1e6feb95
VZ
799 virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
800 { return m_renderer->GetListboxItemHeight(fontHeight); }
801 virtual wxSize GetCheckBitmapSize() const
802 { return m_renderer->GetCheckBitmapSize(); }
803 virtual wxSize GetRadioBitmapSize() const
804 { return m_renderer->GetRadioBitmapSize(); }
805 virtual wxCoord GetCheckItemMargin() const
806 { return m_renderer->GetCheckItemMargin(); }
807
dd267523 808#if wxUSE_TOOLBAR
3216dbf5
VZ
809 virtual wxSize GetToolBarButtonSize(wxCoord *separator) const
810 { return m_renderer->GetToolBarButtonSize(separator); }
811 virtual wxSize GetToolBarMargin() const
812 { return m_renderer->GetToolBarMargin(); }
dd267523 813#endif // wxUSE_TOOLBAR
3216dbf5 814
9a6384ca 815#if wxUSE_TEXTCTRL
3216dbf5
VZ
816 virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
817 const wxRect& rect) const
1e6feb95
VZ
818 { return m_renderer->GetTextTotalArea(text, rect); }
819 virtual wxRect GetTextClientArea(const wxTextCtrl *text,
820 const wxRect& rect,
3216dbf5 821 wxCoord *extraSpaceBeyond) const
1e6feb95 822 { return m_renderer->GetTextClientArea(text, rect, extraSpaceBeyond); }
9a6384ca 823#endif // wxUSE_TEXTCTRL
1e6feb95 824
c4036939 825#if wxUSE_NOTEBOOK
1e6feb95
VZ
826 virtual wxSize GetTabIndent() const { return m_renderer->GetTabIndent(); }
827 virtual wxSize GetTabPadding() const { return m_renderer->GetTabPadding(); }
c4036939 828#endif // wxUSE_NOTEBOOK
1e6feb95 829
9a6384ca 830#if wxUSE_SLIDER
1e6feb95
VZ
831 virtual wxCoord GetSliderDim() const
832 { return m_renderer->GetSliderDim(); }
833 virtual wxCoord GetSliderTickLen() const
834 { return m_renderer->GetSliderTickLen(); }
9a6384ca 835
1e6feb95 836 virtual wxRect GetSliderShaftRect(const wxRect& rect,
6766e5d1
JS
837 int lenThumb,
838 wxOrientation orient,
839 long style = 0) const
840 { return m_renderer->GetSliderShaftRect(rect, lenThumb, orient, style); }
1e6feb95 841 virtual wxSize GetSliderThumbSize(const wxRect& rect,
6766e5d1 842 int lenThumb,
1e6feb95 843 wxOrientation orient) const
6766e5d1 844 { return m_renderer->GetSliderThumbSize(rect, lenThumb, orient); }
9a6384ca
WS
845#endif // wxUSE_SLIDER
846
1e6feb95
VZ
847 virtual wxSize GetProgressBarStep() const
848 { return m_renderer->GetProgressBarStep(); }
9a6384ca
WS
849
850#if wxUSE_MENUS
1e6feb95
VZ
851 virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const
852 { return m_renderer->GetMenuBarItemSize(sizeText); }
853 virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
854 const wxMenu& menu) const
855 { return m_renderer->GetMenuGeometry(win, menu); }
9a6384ca
WS
856#endif // wxUSE_MENUS
857
858#if wxUSE_STATUSBAR
71e03035
VZ
859 virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const
860 { return m_renderer->GetStatusBarBorders(borderBetweenFields); }
9a6384ca 861#endif // wxUSE_STATUSBAR
24a23c35
VS
862 virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const
863 { return m_renderer->GetFrameClientArea(rect, flags); }
864 virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const
865 { return m_renderer->GetFrameTotalSize(clientSize, flags); }
e7dda1ff
VS
866 virtual wxSize GetFrameMinSize(int flags) const
867 { return m_renderer->GetFrameMinSize(flags); }
24a23c35
VS
868 virtual wxSize GetFrameIconSize() const
869 { return m_renderer->GetFrameIconSize(); }
813edf09
VS
870 virtual int HitTestFrame(const wxRect& rect,
871 const wxPoint& pt,
872 int flags) const
873 { return m_renderer->HitTestFrame(rect, pt, flags); }
24a23c35 874
9c7f49f5
VZ
875 virtual void DrawHeaderButton(wxWindow *win,
876 wxDC& dc,
877 const wxRect& rect,
249e3041 878 int flags = 0,
147b8a4a
VZ
879 wxHeaderSortIconType sortIcon = wxHDR_SORT_ICON_NONE,
880 wxHeaderButtonParams* params = NULL)
881 { m_renderer->DrawHeaderButton(win, dc, rect, flags, sortIcon, params); }
9c7f49f5
VZ
882 virtual void DrawTreeItemButton(wxWindow *win,
883 wxDC& dc,
884 const wxRect& rect,
885 int flags = 0)
886 { m_renderer->DrawTreeItemButton(win, dc, rect, flags); }
887
1e6feb95
VZ
888protected:
889 wxRenderer *m_renderer;
890};
891
892// ----------------------------------------------------------------------------
893// wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
894// OnPaint()
895// ----------------------------------------------------------------------------
896
897class WXDLLEXPORT wxControlRenderer
898{
899public:
900 // create a renderer for this dc with this "fundamental" renderer
901 wxControlRenderer(wxWindow *control, wxDC& dc, wxRenderer *renderer);
902
903 // operations
904 void DrawLabel(const wxBitmap& bitmap = wxNullBitmap,
905 wxCoord marginX = 0, wxCoord marginY = 0);
906#if wxUSE_LISTBOX
907 void DrawItems(const wxListBox *listbox,
908 size_t itemFirst, size_t itemLast);
909#endif // wxUSE_LISTBOX
910#if wxUSE_CHECKLISTBOX
911 void DrawCheckItems(const wxCheckListBox *listbox,
912 size_t itemFirst, size_t itemLast);
913#endif // wxUSE_CHECKLISTBOX
914 void DrawButtonBorder();
915 // the line must be either horizontal or vertical
916 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
917 void DrawFrame();
918 void DrawBitmap(const wxBitmap& bitmap);
919 void DrawBackgroundBitmap();
920 void DrawScrollbar(const wxScrollBar *scrollbar, int thumbPosOld);
921#if wxUSE_GAUGE
922 void DrawProgressBar(const wxGauge *gauge);
923#endif // wxUSE_GAUGE
924
925 // accessors
926 wxWindow *GetWindow() const { return m_window; }
927 wxRenderer *GetRenderer() const { return m_renderer; }
928
929 wxDC& GetDC() { return m_dc; }
930
931 const wxRect& GetRect() const { return m_rect; }
932 wxRect& GetRect() { return m_rect; }
933
934 // static helpers
935 static void DrawBitmap(wxDC &dc,
936 const wxBitmap& bitmap,
937 const wxRect& rect,
938 int alignment = wxALIGN_CENTRE |
939 wxALIGN_CENTRE_VERTICAL,
940 wxStretch stretch = wxSTRETCH_NOT);
941
942private:
9a6384ca
WS
943
944#if wxUSE_LISTBOX
1e6feb95
VZ
945 // common part of DrawItems() and DrawCheckItems()
946 void DoDrawItems(const wxListBox *listbox,
947 size_t itemFirst, size_t itemLast,
a290fa5a 948 bool isCheckLbox = false);
9a6384ca 949#endif // wxUSE_LISTBOX
1e6feb95
VZ
950
951 wxWindow *m_window;
952 wxRenderer *m_renderer;
953 wxDC& m_dc;
954 wxRect m_rect;
955};
956
957#endif // _WX_UNIV_RENDERER_H_