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