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