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 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_UNIV_RENDERER_H_
13 #define _WX_UNIV_RENDERER_H_
16 wxRenderer class is used to draw all wxWidgets controls. This is an ABC and
17 the look of the application is determined by the concrete derivation of
18 wxRenderer used in the program.
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
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).
31 #include "wx/renderer.h"
33 class WXDLLEXPORT wxWindow
;
34 class WXDLLEXPORT wxDC
;
35 class WXDLLEXPORT wxCheckListBox
;
38 class WXDLLEXPORT wxListBox
;
39 #endif // wxUSE_LISTBOX
42 class WXDLLEXPORT wxMenu
;
43 class WXDLLEXPORT wxMenuGeometryInfo
;
46 class WXDLLEXPORT wxScrollBar
;
49 class WXDLLEXPORT wxTextCtrl
;
53 class WXDLLEXPORT wxGauge
;
56 #include "wx/string.h"
57 #include "wx/gdicmn.h"
59 #include "wx/scrolbar.h" // for wxScrollBar::Element
61 // helper class used by wxMenu-related functions
62 class WXDLLEXPORT wxMenuGeometryInfo
65 // get the total size of the menu
66 virtual wxSize
GetSize() const = 0;
68 virtual ~wxMenuGeometryInfo();
71 // ----------------------------------------------------------------------------
72 // wxRenderer: abstract renderers interface
73 // ----------------------------------------------------------------------------
75 class WXDLLEXPORT wxRenderer
: public wxDelegateRendererNative
81 // draw the controls background
82 virtual void DrawBackground(wxDC
& dc
,
86 wxWindow
*window
= NULL
) = 0;
88 // draw the button surface
89 virtual void DrawButtonSurface(wxDC
& dc
,
95 // draw the focus rectangle around the label contained in the given rect
96 virtual void DrawFocusRect(wxDC
& dc
, const wxRect
& rect
) = 0;
98 // draw the label inside the given rectangle with the specified alignment
99 // and optionally emphasize the character with the given index
100 virtual void DrawLabel(wxDC
& dc
,
101 const wxString
& label
,
104 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
106 wxRect
*rectBounds
= NULL
) = 0;
108 // same but also draw a bitmap if it is valid
109 virtual void DrawButtonLabel(wxDC
& dc
,
110 const wxString
& label
,
111 const wxBitmap
& image
,
114 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
116 wxRect
*rectBounds
= NULL
) = 0;
119 // draw the border and optionally return the rectangle containing the
120 // region inside the border
121 virtual void DrawBorder(wxDC
& dc
,
125 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
127 // draw text control border (I hate to have a separate method for this but
128 // it is needed to accommodate GTK+)
129 virtual void DrawTextBorder(wxDC
& dc
,
133 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
135 // draw push button border and return the rectangle left for the label
136 virtual void DrawButtonBorder(wxDC
& dc
,
139 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
141 // draw a horizontal line
142 virtual void DrawHorizontalLine(wxDC
& dc
,
143 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
145 // draw a vertical line
146 virtual void DrawVerticalLine(wxDC
& dc
,
147 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
149 // draw a frame with the label (horizontal alignment can be specified)
150 virtual void DrawFrame(wxDC
& dc
,
151 const wxString
& label
,
154 int alignment
= wxALIGN_LEFT
,
155 int indexAccel
= -1) = 0;
157 // draw an arrow in the given direction
158 virtual void DrawArrow(wxDC
& dc
,
163 // draw a scrollbar arrow (may be the same as arrow but may be not)
164 virtual void DrawScrollbarArrow(wxDC
& dc
,
169 // draw the scrollbar thumb
170 virtual void DrawScrollbarThumb(wxDC
& dc
,
171 wxOrientation orient
,
175 // draw a (part of) scrollbar shaft
176 virtual void DrawScrollbarShaft(wxDC
& dc
,
177 wxOrientation orient
,
181 // draw the rectangle in the corner between two scrollbars
182 virtual void DrawScrollCorner(wxDC
& dc
,
183 const wxRect
& rect
) = 0;
185 // draw an item of a wxListBox
186 virtual void DrawItem(wxDC
& dc
,
187 const wxString
& label
,
191 // draw an item of a wxCheckListBox
192 virtual void DrawCheckItem(wxDC
& dc
,
193 const wxString
& label
,
194 const wxBitmap
& bitmap
,
198 // draw a checkbutton (bitmap may be invalid to use default one)
199 virtual void DrawCheckButton(wxDC
& dc
,
200 const wxString
& label
,
201 const wxBitmap
& bitmap
,
204 wxAlignment align
= wxALIGN_LEFT
,
205 int indexAccel
= -1) = 0;
207 // draw a radio button
208 virtual void DrawRadioButton(wxDC
& dc
,
209 const wxString
& label
,
210 const wxBitmap
& bitmap
,
213 wxAlignment align
= wxALIGN_LEFT
,
214 int indexAccel
= -1) = 0;
217 // draw a toolbar button (label may be empty, bitmap may be invalid, if
218 // both conditions are true this function draws a separator)
219 virtual void DrawToolBarButton(wxDC
& dc
,
220 const wxString
& label
,
221 const wxBitmap
& bitmap
,
225 int tbarStyle
= 0) = 0;
226 #endif // wxUSE_TOOLBAR
229 // draw a (part of) line in the text control
230 virtual void DrawTextLine(wxDC
& dc
,
231 const wxString
& text
,
237 // draw a line wrap indicator
238 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
239 #endif // wxUSE_TEXTCTRL
242 // draw a notebook tab
243 virtual void DrawTab(wxDC
& dc
,
246 const wxString
& label
,
247 const wxBitmap
& bitmap
= wxNullBitmap
,
249 int indexAccel
= -1) = 0;
250 #endif // wxUSE_NOTEBOOK
254 // draw the slider shaft
255 virtual void DrawSliderShaft(wxDC
& dc
,
258 wxOrientation orient
,
261 wxRect
*rectShaft
= NULL
) = 0;
263 // draw the slider thumb
264 virtual void DrawSliderThumb(wxDC
& dc
,
266 wxOrientation orient
,
270 // draw the slider ticks
271 virtual void DrawSliderTicks(wxDC
& dc
,
274 wxOrientation orient
,
280 #endif // wxUSE_SLIDER
283 // draw a menu bar item
284 virtual void DrawMenuBarItem(wxDC
& dc
,
286 const wxString
& label
,
288 int indexAccel
= -1) = 0;
290 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
292 // the geometryInfo is calculated by GetMenuGeometry() function from below
293 virtual void DrawMenuItem(wxDC
& dc
,
295 const wxMenuGeometryInfo
& geometryInfo
,
296 const wxString
& label
,
297 const wxString
& accel
,
298 const wxBitmap
& bitmap
= wxNullBitmap
,
300 int indexAccel
= -1) = 0;
302 // draw a menu bar separator
303 virtual void DrawMenuSeparator(wxDC
& dc
,
305 const wxMenuGeometryInfo
& geomInfo
) = 0;
306 #endif // wxUSE_MENUS
309 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
310 // interpreted specially and means "draw the status bar grip" here
311 virtual void DrawStatusField(wxDC
& dc
,
313 const wxString
& label
,
314 int flags
= 0, int style
= 0) = 0;
315 #endif // wxUSE_STATUSBAR
317 // draw complete frame/dialog titlebar
318 virtual void DrawFrameTitleBar(wxDC
& dc
,
320 const wxString
& title
,
323 int specialButton
= 0,
324 int specialButtonFlags
= 0) = 0;
326 // draw frame borders
327 virtual void DrawFrameBorder(wxDC
& dc
,
331 // draw frame titlebar background
332 virtual void DrawFrameBackground(wxDC
& dc
,
337 virtual void DrawFrameTitle(wxDC
& dc
,
339 const wxString
& title
,
343 virtual void DrawFrameIcon(wxDC
& dc
,
348 // draw frame buttons
349 virtual void DrawFrameButton(wxDC
& dc
,
350 wxCoord x
, wxCoord y
,
358 // return the bitmaps to use for combobox button
359 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
361 wxBitmap
*bmpPressed
,
362 wxBitmap
*bmpDisabled
) = 0;
363 #endif // wxUSE_COMBOBOX
365 // geometry functions
366 // ------------------
368 // get the dimensions of the border: rect.x/y contain the width/height of
369 // the left/top side, width/heigh - of the right/bottom one
370 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
372 // the scrollbars may be drawn either inside the window border or outside
373 // it - this function is used to decide how to draw them
374 virtual bool AreScrollbarsInsideBorder() const = 0;
376 // adjust the size of the control of the given class: for most controls,
377 // this just takes into account the border, but for some (buttons, for
378 // example) it is more complicated - the result being, in any case, that
379 // the control looks "nice" if it uses the adjusted rectangle
380 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
384 // get the size of a scrollbar arrow
385 virtual wxSize
GetScrollbarArrowSize() const = 0;
387 // gets the bounding box for a scrollbar element for the given (by default
388 // - current) thumb position
389 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
390 wxScrollBar::Element elem
,
391 int thumbPos
= -1) const = 0;
393 // returns the size of the scrollbar shaft excluding the arrows
394 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
396 // returns one of wxHT_SCROLLBAR_XXX constants
397 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
398 const wxPoint
& pt
) const = 0;
400 // translate the scrollbar position (in logical units) into physical
401 // coordinate (in pixels) and the other way round
402 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
403 int thumbPos
= -1) = 0;
404 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
407 #endif // wxUSE_SCROLLBAR
409 // get the height of a listbox item from the base font height
410 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
412 // get the size of a checkbox/radio button bitmap
413 virtual wxSize
GetCheckBitmapSize() const = 0;
414 virtual wxSize
GetRadioBitmapSize() const = 0;
415 virtual wxCoord
GetCheckItemMargin() const = 0;
417 // get the standard size of a toolbar button and also return the size of
418 // a toolbar separator in the provided pointer
419 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
421 // get the margins between/around the toolbar buttons
422 virtual wxSize
GetToolBarMargin() const = 0;
425 // convert between text rectangle and client rectangle for text controls:
426 // the former is typicall smaller to leave margins around text
427 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
428 const wxRect
& rectText
) const = 0;
430 // extra space is for line indicators
431 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
432 const wxRect
& rectTotal
,
433 wxCoord
*extraSpaceBeyond
) const = 0;
434 #endif // wxUSE_TEXTCTRL
437 // get the overhang of a selected tab
438 virtual wxSize
GetTabIndent() const = 0;
440 // get the padding around the text in a tab
441 virtual wxSize
GetTabPadding() const = 0;
442 #endif // wxUSE_NOTEBOOK
445 // get the default size of the slider in lesser dimension (i.e. height of a
446 // horizontal slider or width of a vertical one)
447 virtual wxCoord
GetSliderDim() const = 0;
449 // get the length of the slider ticks displayed along side slider
450 virtual wxCoord
GetSliderTickLen() const = 0;
452 // get the slider shaft rect from the total slider rect
453 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
455 wxOrientation orient
,
456 long style
= 0) const = 0;
458 // get the size of the slider thumb for the given total slider rect
459 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
461 wxOrientation orient
) const = 0;
462 #endif // wxUSE_SLIDER
464 // get the size of one progress bar step (in horz and vertical directions)
465 virtual wxSize
GetProgressBarStep() const = 0;
468 // get the size of rectangle to use in the menubar for the given text rect
469 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
471 // get the struct storing all layout info needed to draw all menu items
472 // (this can't be calculated for each item separately as they should be
475 // the returned pointer must be deleted by the caller
476 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
477 const wxMenu
& menu
) const = 0;
478 #endif // wxUSE_MENUS
481 // get the borders around the status bar fields (x and y fields of the
482 // return value) and also, optionally, the border between the fields
483 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
484 #endif // wxUSE_STATUSBAR
486 // get client area rectangle of top level window (i.e. subtract
487 // decorations from given rectangle)
488 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
490 // get size of whole top level window, given size of its client area size
491 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
493 // get the minimal size of top level window
494 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
496 // get titlebar icon size
497 virtual wxSize
GetFrameIconSize() const = 0;
499 // returns one of wxHT_TOPLEVEL_XXX constants
500 virtual int HitTestFrame(const wxRect
& rect
,
502 int flags
= 0) const = 0;
504 // virtual dtor for any base class
505 virtual ~wxRenderer();
508 // ----------------------------------------------------------------------------
509 // wxDelegateRenderer: it is impossible to inherit from any of standard
510 // renderers as their declarations are in private code, but you can use this
511 // class to override only some of the Draw() functions - all the other ones
512 // will be left to the original renderer
513 // ----------------------------------------------------------------------------
515 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
518 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
520 virtual void DrawBackground(wxDC
& dc
,
524 wxWindow
*window
= NULL
)
525 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
526 virtual void DrawButtonSurface(wxDC
& dc
,
530 { m_renderer
->DrawButtonSurface(dc
, col
, rect
, flags
); }
531 virtual void DrawFocusRect(wxDC
& dc
, const wxRect
& rect
)
532 { m_renderer
->DrawFocusRect(dc
, rect
); }
533 virtual void DrawLabel(wxDC
& dc
,
534 const wxString
& label
,
537 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
539 wxRect
*rectBounds
= NULL
)
540 { m_renderer
->DrawLabel(dc
, label
, rect
,
541 flags
, align
, indexAccel
, rectBounds
); }
542 virtual void DrawButtonLabel(wxDC
& dc
,
543 const wxString
& label
,
544 const wxBitmap
& image
,
547 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
549 wxRect
*rectBounds
= NULL
)
550 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
551 flags
, align
, indexAccel
, rectBounds
); }
552 virtual void DrawBorder(wxDC
& dc
,
556 wxRect
*rectIn
= (wxRect
*)NULL
)
557 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
558 virtual void DrawTextBorder(wxDC
& dc
,
562 wxRect
*rectIn
= (wxRect
*)NULL
)
563 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
564 virtual void DrawButtonBorder(wxDC
& dc
,
567 wxRect
*rectIn
= (wxRect
*)NULL
)
568 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
569 virtual void DrawFrame(wxDC
& dc
,
570 const wxString
& label
,
573 int align
= wxALIGN_LEFT
,
575 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
576 virtual void DrawHorizontalLine(wxDC
& dc
,
577 wxCoord y
, wxCoord x1
, wxCoord x2
)
578 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
579 virtual void DrawVerticalLine(wxDC
& dc
,
580 wxCoord x
, wxCoord y1
, wxCoord y2
)
581 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
582 virtual void DrawArrow(wxDC
& dc
,
586 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
587 virtual void DrawScrollbarArrow(wxDC
& dc
,
591 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
592 virtual void DrawScrollbarThumb(wxDC
& dc
,
593 wxOrientation orient
,
596 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
597 virtual void DrawScrollbarShaft(wxDC
& dc
,
598 wxOrientation orient
,
601 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
602 virtual void DrawScrollCorner(wxDC
& dc
,
604 { m_renderer
->DrawScrollCorner(dc
, rect
); }
605 virtual void DrawItem(wxDC
& dc
,
606 const wxString
& label
,
609 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
610 virtual void DrawCheckItem(wxDC
& dc
,
611 const wxString
& label
,
612 const wxBitmap
& bitmap
,
615 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
616 virtual void DrawCheckButton(wxDC
& dc
,
617 const wxString
& label
,
618 const wxBitmap
& bitmap
,
621 wxAlignment align
= wxALIGN_LEFT
,
623 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
624 flags
, align
, indexAccel
); }
625 virtual void DrawRadioButton(wxDC
& dc
,
626 const wxString
& label
,
627 const wxBitmap
& bitmap
,
630 wxAlignment align
= wxALIGN_LEFT
,
632 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
633 flags
, align
, indexAccel
); }
635 virtual void DrawToolBarButton(wxDC
& dc
,
636 const wxString
& label
,
637 const wxBitmap
& bitmap
,
642 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
643 #endif // wxUSE_TOOLBAR
646 virtual void DrawTextLine(wxDC
& dc
,
647 const wxString
& text
,
652 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
653 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
654 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
655 #endif // wxUSE_TEXTCTRL
658 virtual void DrawTab(wxDC
& dc
,
661 const wxString
& label
,
662 const wxBitmap
& bitmap
= wxNullBitmap
,
665 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
666 #endif // wxUSE_NOTEBOOK
670 virtual void DrawSliderShaft(wxDC
& dc
,
673 wxOrientation orient
,
676 wxRect
*rectShaft
= NULL
)
677 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
678 virtual void DrawSliderThumb(wxDC
& dc
,
680 wxOrientation orient
,
683 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
684 virtual void DrawSliderTicks(wxDC
& dc
,
687 wxOrientation orient
,
690 int WXUNUSED(step
) = 1,
693 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
694 start
, end
, start
, flags
, style
); }
695 #endif // wxUSE_SLIDER
698 virtual void DrawMenuBarItem(wxDC
& dc
,
700 const wxString
& label
,
703 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
704 virtual void DrawMenuItem(wxDC
& dc
,
706 const wxMenuGeometryInfo
& gi
,
707 const wxString
& label
,
708 const wxString
& accel
,
709 const wxBitmap
& bitmap
= wxNullBitmap
,
712 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
713 bitmap
, flags
, indexAccel
); }
714 virtual void DrawMenuSeparator(wxDC
& dc
,
716 const wxMenuGeometryInfo
& geomInfo
)
717 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
718 #endif // wxUSE_MENUS
721 virtual void DrawStatusField(wxDC
& dc
,
723 const wxString
& label
,
724 int flags
= 0, int style
= 0)
725 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
726 #endif // wxUSE_STATUSBAR
728 virtual void DrawFrameTitleBar(wxDC
& dc
,
730 const wxString
& title
,
733 int specialButton
= 0,
734 int specialButtonFlag
= 0)
735 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
736 specialButton
, specialButtonFlag
); }
737 virtual void DrawFrameBorder(wxDC
& dc
,
740 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
741 virtual void DrawFrameBackground(wxDC
& dc
,
744 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
745 virtual void DrawFrameTitle(wxDC
& dc
,
747 const wxString
& title
,
749 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
750 virtual void DrawFrameIcon(wxDC
& dc
,
754 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
755 virtual void DrawFrameButton(wxDC
& dc
,
756 wxCoord x
, wxCoord y
,
759 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
762 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
764 wxBitmap
*bmpPressed
,
765 wxBitmap
*bmpDisabled
)
766 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
767 bmpPressed
, bmpDisabled
); }
768 #endif // wxUSE_COMBOBOX
770 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
771 { m_renderer
->AdjustSize(size
, window
); }
772 virtual wxRect
GetBorderDimensions(wxBorder border
) const
773 { return m_renderer
->GetBorderDimensions(border
); }
774 virtual bool AreScrollbarsInsideBorder() const
775 { return m_renderer
->AreScrollbarsInsideBorder(); }
778 virtual wxSize
GetScrollbarArrowSize() const
779 { return m_renderer
->GetScrollbarArrowSize(); }
780 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
781 wxScrollBar::Element elem
,
782 int thumbPos
= -1) const
783 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
784 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
785 { return m_renderer
->GetScrollbarSize(scrollbar
); }
786 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
787 const wxPoint
& pt
) const
788 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
789 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
791 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
792 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
794 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
795 #endif // wxUSE_SCROLLBAR
797 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
798 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
799 virtual wxSize
GetCheckBitmapSize() const
800 { return m_renderer
->GetCheckBitmapSize(); }
801 virtual wxSize
GetRadioBitmapSize() const
802 { return m_renderer
->GetRadioBitmapSize(); }
803 virtual wxCoord
GetCheckItemMargin() const
804 { return m_renderer
->GetCheckItemMargin(); }
806 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
807 { return m_renderer
->GetToolBarButtonSize(separator
); }
808 virtual wxSize
GetToolBarMargin() const
809 { return m_renderer
->GetToolBarMargin(); }
812 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
813 const wxRect
& rect
) const
814 { return m_renderer
->GetTextTotalArea(text
, rect
); }
815 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
817 wxCoord
*extraSpaceBeyond
) const
818 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
819 #endif // wxUSE_TEXTCTRL
822 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
823 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
824 #endif // wxUSE_NOTEBOOK
827 virtual wxCoord
GetSliderDim() const
828 { return m_renderer
->GetSliderDim(); }
829 virtual wxCoord
GetSliderTickLen() const
830 { return m_renderer
->GetSliderTickLen(); }
832 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
834 wxOrientation orient
,
835 long style
= 0) const
836 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
837 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
839 wxOrientation orient
) const
840 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
841 #endif // wxUSE_SLIDER
843 virtual wxSize
GetProgressBarStep() const
844 { return m_renderer
->GetProgressBarStep(); }
847 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
848 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
849 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
850 const wxMenu
& menu
) const
851 { return m_renderer
->GetMenuGeometry(win
, menu
); }
852 #endif // wxUSE_MENUS
855 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
856 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
857 #endif // wxUSE_STATUSBAR
858 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
859 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
860 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
861 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
862 virtual wxSize
GetFrameMinSize(int flags
) const
863 { return m_renderer
->GetFrameMinSize(flags
); }
864 virtual wxSize
GetFrameIconSize() const
865 { return m_renderer
->GetFrameIconSize(); }
866 virtual int HitTestFrame(const wxRect
& rect
,
869 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
871 virtual void DrawHeaderButton(wxWindow
*win
,
875 wxHeaderSortIconType sortIcon
= wxHDR_SORT_ICON_NONE
,
876 wxHeaderButtonParams
* params
= NULL
)
877 { m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
, sortIcon
, params
); }
878 virtual void DrawTreeItemButton(wxWindow
*win
,
882 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
885 wxRenderer
*m_renderer
;
888 // ----------------------------------------------------------------------------
889 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
891 // ----------------------------------------------------------------------------
893 class WXDLLEXPORT wxControlRenderer
896 // create a renderer for this dc with this "fundamental" renderer
897 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
900 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
901 wxCoord marginX
= 0, wxCoord marginY
= 0);
903 void DrawItems(const wxListBox
*listbox
,
904 size_t itemFirst
, size_t itemLast
);
905 #endif // wxUSE_LISTBOX
906 #if wxUSE_CHECKLISTBOX
907 void DrawCheckItems(const wxCheckListBox
*listbox
,
908 size_t itemFirst
, size_t itemLast
);
909 #endif // wxUSE_CHECKLISTBOX
910 void DrawButtonBorder();
911 // the line must be either horizontal or vertical
912 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
914 void DrawBitmap(const wxBitmap
& bitmap
);
915 void DrawBackgroundBitmap();
916 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
918 void DrawProgressBar(const wxGauge
*gauge
);
919 #endif // wxUSE_GAUGE
922 wxWindow
*GetWindow() const { return m_window
; }
923 wxRenderer
*GetRenderer() const { return m_renderer
; }
925 wxDC
& GetDC() { return m_dc
; }
927 const wxRect
& GetRect() const { return m_rect
; }
928 wxRect
& GetRect() { return m_rect
; }
931 static void DrawBitmap(wxDC
&dc
,
932 const wxBitmap
& bitmap
,
934 int alignment
= wxALIGN_CENTRE
|
935 wxALIGN_CENTRE_VERTICAL
,
936 wxStretch stretch
= wxSTRETCH_NOT
);
941 // common part of DrawItems() and DrawCheckItems()
942 void DoDrawItems(const wxListBox
*listbox
,
943 size_t itemFirst
, size_t itemLast
,
944 bool isCheckLbox
= false);
945 #endif // wxUSE_LISTBOX
948 wxRenderer
*m_renderer
;
953 #endif // _WX_UNIV_RENDERER_H_