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