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