1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/renderer.h
3 // Purpose: wxRenderer class declaration
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
13 wxRenderer class is used to draw all wxWidgets controls. This is an ABC and
14 the look of the application is determined by the concrete derivation of
15 wxRenderer used in the program.
17 It also contains a few static methods which may be used by the concrete
18 renderers and provide the functionality which is often similar or identical
19 in all renderers (using inheritance here would be more restrictive as the
20 given concrete renderer may need an arbitrary subset of the base class
23 Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and
24 includes the latters functionality (which it may delegate to the generic
25 implementation of the latter or reimplement itself).
28 #ifndef _WX_UNIV_RENDERER_H_
29 #define _WX_UNIV_RENDERER_H_
31 #include "wx/renderer.h"
33 class WXDLLEXPORT wxDC
;
34 class WXDLLEXPORT wxCheckListBox
;
35 class WXDLLEXPORT wxListBox
;
36 class WXDLLEXPORT wxMenu
;
37 class WXDLLEXPORT wxMenuGeometryInfo
;
38 class WXDLLEXPORT wxScrollBar
;
39 class WXDLLEXPORT wxTextCtrl
;
40 class WXDLLEXPORT wxWindow
;
42 class WXDLLEXPORT wxGauge
;
45 #include "wx/string.h"
46 #include "wx/gdicmn.h"
48 #include "wx/scrolbar.h" // for wxScrollBar::Element
50 // helper class used by wxMenu-related functions
51 class WXDLLEXPORT wxMenuGeometryInfo
54 // get the total size of the menu
55 virtual wxSize
GetSize() const = 0;
57 virtual ~wxMenuGeometryInfo();
60 // ----------------------------------------------------------------------------
61 // wxRenderer: abstract renderers interface
62 // ----------------------------------------------------------------------------
64 class WXDLLEXPORT wxRenderer
: public wxDelegateRendererNative
70 // draw the controls background
71 virtual void DrawBackground(wxDC
& dc
,
75 wxWindow
*window
= NULL
) = 0;
77 // draw the button surface
78 virtual void DrawButtonSurface(wxDC
& dc
,
82 { DrawBackground( dc
, col
, rect
, flags
); }
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
,
91 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
93 wxRect
*rectBounds
= NULL
) = 0;
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
,
101 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
103 wxRect
*rectBounds
= NULL
) = 0;
105 // draw the border and optionally return the rectangle containing the
106 // region inside the border
107 virtual void DrawBorder(wxDC
& dc
,
111 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
113 // draw text control border (I hate to have a separate method for this but
114 // it is needed to accommodate GTK+)
115 virtual void DrawTextBorder(wxDC
& dc
,
119 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
121 // draw push button border and return the rectangle left for the label
122 virtual void DrawButtonBorder(wxDC
& dc
,
125 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
127 // draw a horizontal line
128 virtual void DrawHorizontalLine(wxDC
& dc
,
129 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
131 // draw a vertical line
132 virtual void DrawVerticalLine(wxDC
& dc
,
133 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
135 // draw a frame with the label (horizontal alignment can be specified)
136 virtual void DrawFrame(wxDC
& dc
,
137 const wxString
& label
,
140 int alignment
= wxALIGN_LEFT
,
141 int indexAccel
= -1) = 0;
143 // draw an arrow in the given direction
144 virtual void DrawArrow(wxDC
& dc
,
149 // draw a scrollbar arrow (may be the same as arrow but may be not)
150 virtual void DrawScrollbarArrow(wxDC
& dc
,
155 // draw the scrollbar thumb
156 virtual void DrawScrollbarThumb(wxDC
& dc
,
157 wxOrientation orient
,
161 // draw a (part of) scrollbar shaft
162 virtual void DrawScrollbarShaft(wxDC
& dc
,
163 wxOrientation orient
,
167 // draw the rectangle in the corner between two scrollbars
168 virtual void DrawScrollCorner(wxDC
& dc
,
169 const wxRect
& rect
) = 0;
171 // draw an item of a wxListBox
172 virtual void DrawItem(wxDC
& dc
,
173 const wxString
& label
,
177 // draw an item of a wxCheckListBox
178 virtual void DrawCheckItem(wxDC
& dc
,
179 const wxString
& label
,
180 const wxBitmap
& bitmap
,
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
,
190 wxAlignment align
= wxALIGN_LEFT
,
191 int indexAccel
= -1) = 0;
193 // draw a radio button
194 virtual void DrawRadioButton(wxDC
& dc
,
195 const wxString
& label
,
196 const wxBitmap
& bitmap
,
199 wxAlignment align
= wxALIGN_LEFT
,
200 int indexAccel
= -1) = 0;
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
,
211 // draw a (part of) line in the text control
212 virtual void DrawTextLine(wxDC
& dc
,
213 const wxString
& text
,
219 // draw a line wrap indicator
220 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
222 // draw a notebook tab
223 virtual void DrawTab(wxDC
& dc
,
226 const wxString
& label
,
227 const wxBitmap
& bitmap
= wxNullBitmap
,
229 int indexAccel
= -1) = 0;
231 // draw the slider shaft
232 virtual void DrawSliderShaft(wxDC
& dc
,
235 wxOrientation orient
,
238 wxRect
*rectShaft
= NULL
) = 0;
240 // draw the slider thumb
241 virtual void DrawSliderThumb(wxDC
& dc
,
243 wxOrientation orient
,
247 // draw the slider ticks
248 virtual void DrawSliderTicks(wxDC
& dc
,
251 wxOrientation orient
,
258 // draw a menu bar item
259 virtual void DrawMenuBarItem(wxDC
& dc
,
261 const wxString
& label
,
263 int indexAccel
= -1) = 0;
265 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
267 // the geometryInfo is calculated by GetMenuGeometry() function from below
268 virtual void DrawMenuItem(wxDC
& dc
,
270 const wxMenuGeometryInfo
& geometryInfo
,
271 const wxString
& label
,
272 const wxString
& accel
,
273 const wxBitmap
& bitmap
= wxNullBitmap
,
275 int indexAccel
= -1) = 0;
277 // draw a menu bar separator
278 virtual void DrawMenuSeparator(wxDC
& dc
,
280 const wxMenuGeometryInfo
& geomInfo
) = 0;
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
,
286 const wxString
& label
,
287 int flags
= 0, int style
= 0) = 0;
289 // draw complete frame/dialog titlebar
290 virtual void DrawFrameTitleBar(wxDC
& dc
,
292 const wxString
& title
,
295 int specialButton
= 0,
296 int specialButtonFlags
= 0) = 0;
298 // draw frame borders
299 virtual void DrawFrameBorder(wxDC
& dc
,
303 // draw frame titlebar background
304 virtual void DrawFrameBackground(wxDC
& dc
,
309 virtual void DrawFrameTitle(wxDC
& dc
,
311 const wxString
& title
,
315 virtual void DrawFrameIcon(wxDC
& dc
,
320 // draw frame buttons
321 virtual void DrawFrameButton(wxDC
& dc
,
322 wxCoord x
, wxCoord y
,
329 // return the bitmaps to use for combobox button
330 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
332 wxBitmap
*bmpPressed
,
333 wxBitmap
*bmpDisabled
) = 0;
335 // geometry functions
336 // ------------------
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;
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;
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;
352 // get the size of a scrollbar arrow
353 virtual wxSize
GetScrollbarArrowSize() const = 0;
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;
361 // returns the size of the scrollbar shaft excluding the arrows
362 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
364 // returns one of wxHT_SCROLLBAR_XXX constants
365 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
366 const wxPoint
& pt
) const = 0;
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
,
375 // get the height of a listbox item from the base font height
376 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
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;
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;
387 // get the margins between/around the toolbar buttons
388 virtual wxSize
GetToolBarMargin() const = 0;
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
,
393 const wxRect
& rectText
) const = 0;
395 // extra space is for line indicators
396 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
397 const wxRect
& rectTotal
,
398 wxCoord
*extraSpaceBeyond
) const = 0;
400 // get the overhang of a selected tab
401 virtual wxSize
GetTabIndent() const = 0;
403 // get the padding around the text in a tab
404 virtual wxSize
GetTabPadding() const = 0;
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;
410 // get the length of the slider ticks displayed along side slider
411 virtual wxCoord
GetSliderTickLen() const = 0;
413 // get the slider shaft rect from the total slider rect
414 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
416 wxOrientation orient
,
417 long style
= 0) const = 0;
419 // get the size of the slider thumb for the given total slider rect
420 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
422 wxOrientation orient
) const = 0;
424 // get the size of one progress bar step (in horz and vertical directions)
425 virtual wxSize
GetProgressBarStep() const = 0;
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;
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
434 // the returned pointer must be deleted by the caller
435 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
436 const wxMenu
& menu
) const = 0;
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;
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;
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;
449 // get the minimal size of top level window
450 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
452 // get titlebar icon size
453 virtual wxSize
GetFrameIconSize() const = 0;
455 // returns one of wxHT_TOPLEVEL_XXX constants
456 virtual int HitTestFrame(const wxRect
& rect
,
458 int flags
= 0) const = 0;
460 // virtual dtor for any base class
461 virtual ~wxRenderer();
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
);
471 // standard text line drawing: just use DrawText() and highlight the
473 static void StandardDrawTextLine(wxDC
& dc
,
474 const wxString
& text
,
476 int selStart
, int selEnd
,
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
,
485 const wxSize
& sizeArrow
);
486 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
488 const wxSize
& sizeArrow
);
489 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
491 const wxSize
& sizeArrow
);
492 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
494 const wxSize
& sizeArrow
);
495 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
496 const wxSize
& sizeArrow
);
497 static void StandardScrollBarThumbSize(wxCoord lenBar
,
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 // ----------------------------------------------------------------------------
512 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
515 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
517 virtual void DrawBackground(wxDC
& dc
,
521 wxWindow
*window
= NULL
)
522 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
523 virtual void DrawLabel(wxDC
& dc
,
524 const wxString
& label
,
527 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
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
,
537 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
539 wxRect
*rectBounds
= NULL
)
540 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
541 flags
, align
, indexAccel
, rectBounds
); }
542 virtual void DrawBorder(wxDC
& dc
,
546 wxRect
*rectIn
= (wxRect
*)NULL
)
547 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
548 virtual void DrawTextBorder(wxDC
& dc
,
552 wxRect
*rectIn
= (wxRect
*)NULL
)
553 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
554 virtual void DrawButtonBorder(wxDC
& dc
,
557 wxRect
*rectIn
= (wxRect
*)NULL
)
558 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
559 virtual void DrawFrame(wxDC
& dc
,
560 const wxString
& label
,
563 int align
= wxALIGN_LEFT
,
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
,
576 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
577 virtual void DrawScrollbarArrow(wxDC
& dc
,
581 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
582 virtual void DrawScrollbarThumb(wxDC
& dc
,
583 wxOrientation orient
,
586 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
587 virtual void DrawScrollbarShaft(wxDC
& dc
,
588 wxOrientation orient
,
591 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
592 virtual void DrawScrollCorner(wxDC
& dc
,
594 { m_renderer
->DrawScrollCorner(dc
, rect
); }
595 virtual void DrawItem(wxDC
& dc
,
596 const wxString
& label
,
599 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
600 virtual void DrawCheckItem(wxDC
& dc
,
601 const wxString
& label
,
602 const wxBitmap
& bitmap
,
605 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
606 virtual void DrawCheckButton(wxDC
& dc
,
607 const wxString
& label
,
608 const wxBitmap
& bitmap
,
611 wxAlignment align
= wxALIGN_LEFT
,
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
,
620 wxAlignment align
= wxALIGN_LEFT
,
622 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
623 flags
, align
, indexAccel
); }
624 virtual void DrawToolBarButton(wxDC
& dc
,
625 const wxString
& label
,
626 const wxBitmap
& bitmap
,
630 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
); }
631 virtual void DrawTextLine(wxDC
& dc
,
632 const wxString
& text
,
637 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
638 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
639 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
641 virtual void DrawTab(wxDC
& dc
,
644 const wxString
& label
,
645 const wxBitmap
& bitmap
= wxNullBitmap
,
648 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
650 virtual void DrawSliderShaft(wxDC
& dc
,
653 wxOrientation orient
,
656 wxRect
*rectShaft
= NULL
)
657 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
658 virtual void DrawSliderThumb(wxDC
& dc
,
660 wxOrientation orient
,
663 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
664 virtual void DrawSliderTicks(wxDC
& dc
,
667 wxOrientation orient
,
670 int WXUNUSED(step
) = 1,
673 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
674 start
, end
, start
, flags
, style
); }
676 virtual void DrawMenuBarItem(wxDC
& dc
,
678 const wxString
& label
,
681 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
682 virtual void DrawMenuItem(wxDC
& dc
,
684 const wxMenuGeometryInfo
& gi
,
685 const wxString
& label
,
686 const wxString
& accel
,
687 const wxBitmap
& bitmap
= wxNullBitmap
,
690 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
691 bitmap
, flags
, indexAccel
); }
692 virtual void DrawMenuSeparator(wxDC
& dc
,
694 const wxMenuGeometryInfo
& geomInfo
)
695 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
697 virtual void DrawStatusField(wxDC
& dc
,
699 const wxString
& label
,
700 int flags
= 0, int style
= 0)
701 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
703 virtual void DrawFrameTitleBar(wxDC
& dc
,
705 const wxString
& title
,
708 int specialButton
= 0,
709 int specialButtonFlag
= 0)
710 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
711 specialButton
, specialButtonFlag
); }
712 virtual void DrawFrameBorder(wxDC
& dc
,
715 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
716 virtual void DrawFrameBackground(wxDC
& dc
,
719 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
720 virtual void DrawFrameTitle(wxDC
& dc
,
722 const wxString
& title
,
724 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
725 virtual void DrawFrameIcon(wxDC
& dc
,
729 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
730 virtual void DrawFrameButton(wxDC
& dc
,
731 wxCoord x
, wxCoord y
,
734 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
736 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
738 wxBitmap
*bmpPressed
,
739 wxBitmap
*bmpDisabled
)
740 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
741 bmpPressed
, bmpDisabled
); }
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(); }
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
,
763 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
764 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
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(); }
776 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
777 { return m_renderer
->GetToolBarButtonSize(separator
); }
778 virtual wxSize
GetToolBarMargin() const
779 { return m_renderer
->GetToolBarMargin(); }
781 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
782 const wxRect
& rect
) const
783 { return m_renderer
->GetTextTotalArea(text
, rect
); }
784 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
786 wxCoord
*extraSpaceBeyond
) const
787 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
789 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
790 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
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
,
798 wxOrientation orient
,
799 long style
= 0) const
800 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
801 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
803 wxOrientation orient
) const
804 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
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
); }
812 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
813 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
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
); }
818 virtual wxSize
GetFrameMinSize(int flags
) const
819 { return m_renderer
->GetFrameMinSize(flags
); }
820 virtual wxSize
GetFrameIconSize() const
821 { return m_renderer
->GetFrameIconSize(); }
822 virtual int HitTestFrame(const wxRect
& rect
,
825 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
827 virtual void DrawHeaderButton(wxWindow
*win
,
831 { m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
); }
832 virtual void DrawTreeItemButton(wxWindow
*win
,
836 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
839 wxRenderer
*m_renderer
;
842 // ----------------------------------------------------------------------------
843 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
845 // ----------------------------------------------------------------------------
847 class WXDLLEXPORT wxControlRenderer
850 // create a renderer for this dc with this "fundamental" renderer
851 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
854 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
855 wxCoord marginX
= 0, wxCoord marginY
= 0);
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
);
868 void DrawBitmap(const wxBitmap
& bitmap
);
869 void DrawBackgroundBitmap();
870 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
872 void DrawProgressBar(const wxGauge
*gauge
);
873 #endif // wxUSE_GAUGE
876 wxWindow
*GetWindow() const { return m_window
; }
877 wxRenderer
*GetRenderer() const { return m_renderer
; }
879 wxDC
& GetDC() { return m_dc
; }
881 const wxRect
& GetRect() const { return m_rect
; }
882 wxRect
& GetRect() { return m_rect
; }
885 static void DrawBitmap(wxDC
&dc
,
886 const wxBitmap
& bitmap
,
888 int alignment
= wxALIGN_CENTRE
|
889 wxALIGN_CENTRE_VERTICAL
,
890 wxStretch stretch
= wxSTRETCH_NOT
);
893 // common part of DrawItems() and DrawCheckItems()
894 void DoDrawItems(const wxListBox
*listbox
,
895 size_t itemFirst
, size_t itemLast
,
896 bool isCheckLbox
= false);
899 wxRenderer
*m_renderer
;
904 #endif // _WX_UNIV_RENDERER_H_