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