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
97 // only wxCONTROL_SELECTED makes sense in flags here
98 virtual void DrawFocusRect(wxDC
& dc
, const wxRect
& rect
, int flags
= 0) = 0;
100 // draw the label inside the given rectangle with the specified alignment
101 // and optionally emphasize the character with the given index
102 virtual void DrawLabel(wxDC
& dc
,
103 const wxString
& label
,
106 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
108 wxRect
*rectBounds
= NULL
) = 0;
110 // same but also draw a bitmap if it is valid
111 virtual void DrawButtonLabel(wxDC
& dc
,
112 const wxString
& label
,
113 const wxBitmap
& image
,
116 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
118 wxRect
*rectBounds
= NULL
) = 0;
121 // draw the border and optionally return the rectangle containing the
122 // region inside the border
123 virtual void DrawBorder(wxDC
& dc
,
127 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
129 // draw text control border (I hate to have a separate method for this but
130 // it is needed to accommodate GTK+)
131 virtual void DrawTextBorder(wxDC
& dc
,
135 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
137 // draw push button border and return the rectangle left for the label
138 virtual void DrawButtonBorder(wxDC
& dc
,
141 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
143 // draw a horizontal line
144 virtual void DrawHorizontalLine(wxDC
& dc
,
145 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
147 // draw a vertical line
148 virtual void DrawVerticalLine(wxDC
& dc
,
149 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
151 // draw a frame with the label (horizontal alignment can be specified)
152 virtual void DrawFrame(wxDC
& dc
,
153 const wxString
& label
,
156 int alignment
= wxALIGN_LEFT
,
157 int indexAccel
= -1) = 0;
159 // draw an arrow in the given direction
160 virtual void DrawArrow(wxDC
& dc
,
165 // draw a scrollbar arrow (may be the same as arrow but may be not)
166 virtual void DrawScrollbarArrow(wxDC
& dc
,
171 // draw the scrollbar thumb
172 virtual void DrawScrollbarThumb(wxDC
& dc
,
173 wxOrientation orient
,
177 // draw a (part of) scrollbar shaft
178 virtual void DrawScrollbarShaft(wxDC
& dc
,
179 wxOrientation orient
,
183 // draw the rectangle in the corner between two scrollbars
184 virtual void DrawScrollCorner(wxDC
& dc
,
185 const wxRect
& rect
) = 0;
187 // draw an item of a wxListBox
188 virtual void DrawItem(wxDC
& dc
,
189 const wxString
& label
,
193 // draw an item of a wxCheckListBox
194 virtual void DrawCheckItem(wxDC
& dc
,
195 const wxString
& label
,
196 const wxBitmap
& bitmap
,
200 // draw a checkbutton (bitmap may be invalid to use default one)
201 virtual void DrawCheckButton(wxDC
& dc
,
202 const wxString
& label
,
203 const wxBitmap
& bitmap
,
206 wxAlignment align
= wxALIGN_LEFT
,
207 int indexAccel
= -1) = 0;
209 // draw a radio button
210 virtual void DrawRadioButton(wxDC
& dc
,
211 const wxString
& label
,
212 const wxBitmap
& bitmap
,
215 wxAlignment align
= wxALIGN_LEFT
,
216 int indexAccel
= -1) = 0;
219 // draw a toolbar button (label may be empty, bitmap may be invalid, if
220 // both conditions are true this function draws a separator)
221 virtual void DrawToolBarButton(wxDC
& dc
,
222 const wxString
& label
,
223 const wxBitmap
& bitmap
,
227 int tbarStyle
= 0) = 0;
228 #endif // wxUSE_TOOLBAR
231 // draw a (part of) line in the text control
232 virtual void DrawTextLine(wxDC
& dc
,
233 const wxString
& text
,
239 // draw a line wrap indicator
240 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
241 #endif // wxUSE_TEXTCTRL
244 // draw a notebook tab
245 virtual void DrawTab(wxDC
& dc
,
248 const wxString
& label
,
249 const wxBitmap
& bitmap
= wxNullBitmap
,
251 int indexAccel
= -1) = 0;
252 #endif // wxUSE_NOTEBOOK
256 // draw the slider shaft
257 virtual void DrawSliderShaft(wxDC
& dc
,
260 wxOrientation orient
,
263 wxRect
*rectShaft
= NULL
) = 0;
265 // draw the slider thumb
266 virtual void DrawSliderThumb(wxDC
& dc
,
268 wxOrientation orient
,
272 // draw the slider ticks
273 virtual void DrawSliderTicks(wxDC
& dc
,
276 wxOrientation orient
,
282 #endif // wxUSE_SLIDER
285 // draw a menu bar item
286 virtual void DrawMenuBarItem(wxDC
& dc
,
288 const wxString
& label
,
290 int indexAccel
= -1) = 0;
292 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
294 // the geometryInfo is calculated by GetMenuGeometry() function from below
295 virtual void DrawMenuItem(wxDC
& dc
,
297 const wxMenuGeometryInfo
& geometryInfo
,
298 const wxString
& label
,
299 const wxString
& accel
,
300 const wxBitmap
& bitmap
= wxNullBitmap
,
302 int indexAccel
= -1) = 0;
304 // draw a menu bar separator
305 virtual void DrawMenuSeparator(wxDC
& dc
,
307 const wxMenuGeometryInfo
& geomInfo
) = 0;
308 #endif // wxUSE_MENUS
311 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
312 // interpreted specially and means "draw the status bar grip" here
313 virtual void DrawStatusField(wxDC
& dc
,
315 const wxString
& label
,
316 int flags
= 0, int style
= 0) = 0;
317 #endif // wxUSE_STATUSBAR
319 // draw complete frame/dialog titlebar
320 virtual void DrawFrameTitleBar(wxDC
& dc
,
322 const wxString
& title
,
325 int specialButton
= 0,
326 int specialButtonFlags
= 0) = 0;
328 // draw frame borders
329 virtual void DrawFrameBorder(wxDC
& dc
,
333 // draw frame titlebar background
334 virtual void DrawFrameBackground(wxDC
& dc
,
339 virtual void DrawFrameTitle(wxDC
& dc
,
341 const wxString
& title
,
345 virtual void DrawFrameIcon(wxDC
& dc
,
350 // draw frame buttons
351 virtual void DrawFrameButton(wxDC
& dc
,
352 wxCoord x
, wxCoord y
,
360 // return the bitmaps to use for combobox button
361 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
363 wxBitmap
*bmpPressed
,
364 wxBitmap
*bmpDisabled
) = 0;
365 #endif // wxUSE_COMBOBOX
367 // geometry functions
368 // ------------------
370 // get the dimensions of the border: rect.x/y contain the width/height of
371 // the left/top side, width/heigh - of the right/bottom one
372 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
374 // the scrollbars may be drawn either inside the window border or outside
375 // it - this function is used to decide how to draw them
376 virtual bool AreScrollbarsInsideBorder() const = 0;
378 // adjust the size of the control of the given class: for most controls,
379 // this just takes into account the border, but for some (buttons, for
380 // example) it is more complicated - the result being, in any case, that
381 // the control looks "nice" if it uses the adjusted rectangle
382 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
386 // get the size of a scrollbar arrow
387 virtual wxSize
GetScrollbarArrowSize() const = 0;
389 // gets the bounding box for a scrollbar element for the given (by default
390 // - current) thumb position
391 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
392 wxScrollBar::Element elem
,
393 int thumbPos
= -1) const = 0;
395 // returns the size of the scrollbar shaft excluding the arrows
396 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
398 // returns one of wxHT_SCROLLBAR_XXX constants
399 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
400 const wxPoint
& pt
) const = 0;
402 // translate the scrollbar position (in logical units) into physical
403 // coordinate (in pixels) and the other way round
404 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
405 int thumbPos
= -1) = 0;
406 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
409 #endif // wxUSE_SCROLLBAR
411 // get the height of a listbox item from the base font height
412 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
414 // get the size of a checkbox/radio button bitmap
415 virtual wxSize
GetCheckBitmapSize() const = 0;
416 virtual wxSize
GetRadioBitmapSize() const = 0;
417 virtual wxCoord
GetCheckItemMargin() const = 0;
420 // get the standard size of a toolbar button and also return the size of
421 // a toolbar separator in the provided pointer
422 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
424 // get the margins between/around the toolbar buttons
425 virtual wxSize
GetToolBarMargin() const = 0;
426 #endif // wxUSE_TOOLBAR
429 // convert between text rectangle and client rectangle for text controls:
430 // the former is typicall smaller to leave margins around text
431 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
432 const wxRect
& rectText
) const = 0;
434 // extra space is for line indicators
435 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
436 const wxRect
& rectTotal
,
437 wxCoord
*extraSpaceBeyond
) const = 0;
438 #endif // wxUSE_TEXTCTRL
441 // get the overhang of a selected tab
442 virtual wxSize
GetTabIndent() const = 0;
444 // get the padding around the text in a tab
445 virtual wxSize
GetTabPadding() const = 0;
446 #endif // wxUSE_NOTEBOOK
449 // get the default size of the slider in lesser dimension (i.e. height of a
450 // horizontal slider or width of a vertical one)
451 virtual wxCoord
GetSliderDim() const = 0;
453 // get the length of the slider ticks displayed along side slider
454 virtual wxCoord
GetSliderTickLen() const = 0;
456 // get the slider shaft rect from the total slider rect
457 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
459 wxOrientation orient
,
460 long style
= 0) const = 0;
462 // get the size of the slider thumb for the given total slider rect
463 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
465 wxOrientation orient
) const = 0;
466 #endif // wxUSE_SLIDER
468 // get the size of one progress bar step (in horz and vertical directions)
469 virtual wxSize
GetProgressBarStep() const = 0;
472 // get the size of rectangle to use in the menubar for the given text rect
473 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
475 // get the struct storing all layout info needed to draw all menu items
476 // (this can't be calculated for each item separately as they should be
479 // the returned pointer must be deleted by the caller
480 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
481 const wxMenu
& menu
) const = 0;
482 #endif // wxUSE_MENUS
485 // get the borders around the status bar fields (x and y fields of the
487 virtual wxSize
GetStatusBarBorders() const = 0;
489 // get the border between the status bar fields
490 virtual wxCoord
GetStatusBarBorderBetweenFields() const = 0;
492 // get the mergin between a field and its border
493 virtual wxSize
GetStatusBarFieldMargins() const = 0;
494 #endif // wxUSE_STATUSBAR
496 // get client area rectangle of top level window (i.e. subtract
497 // decorations from given rectangle)
498 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
500 // get size of whole top level window, given size of its client area size
501 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
503 // get the minimal size of top level window
504 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
506 // get titlebar icon size
507 virtual wxSize
GetFrameIconSize() const = 0;
509 // returns one of wxHT_TOPLEVEL_XXX constants
510 virtual int HitTestFrame(const wxRect
& rect
,
512 int flags
= 0) const = 0;
514 // virtual dtor for any base class
515 virtual ~wxRenderer();
518 // ----------------------------------------------------------------------------
519 // wxDelegateRenderer: it is impossible to inherit from any of standard
520 // renderers as their declarations are in private code, but you can use this
521 // class to override only some of the Draw() functions - all the other ones
522 // will be left to the original renderer
523 // ----------------------------------------------------------------------------
525 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
528 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
530 virtual void DrawBackground(wxDC
& dc
,
534 wxWindow
*window
= NULL
)
535 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
536 virtual void DrawButtonSurface(wxDC
& dc
,
540 { m_renderer
->DrawButtonSurface(dc
, col
, rect
, flags
); }
541 virtual void DrawFocusRect(wxDC
& dc
, const wxRect
& rect
, int flags
= 0)
542 { m_renderer
->DrawFocusRect(dc
, rect
, flags
); }
543 virtual void DrawLabel(wxDC
& dc
,
544 const wxString
& label
,
547 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
549 wxRect
*rectBounds
= NULL
)
550 { m_renderer
->DrawLabel(dc
, label
, rect
,
551 flags
, align
, indexAccel
, rectBounds
); }
552 virtual void DrawButtonLabel(wxDC
& dc
,
553 const wxString
& label
,
554 const wxBitmap
& image
,
557 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
559 wxRect
*rectBounds
= NULL
)
560 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
561 flags
, align
, indexAccel
, rectBounds
); }
562 virtual void DrawBorder(wxDC
& dc
,
566 wxRect
*rectIn
= (wxRect
*)NULL
)
567 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
568 virtual void DrawTextBorder(wxDC
& dc
,
572 wxRect
*rectIn
= (wxRect
*)NULL
)
573 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
574 virtual void DrawButtonBorder(wxDC
& dc
,
577 wxRect
*rectIn
= (wxRect
*)NULL
)
578 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
579 virtual void DrawFrame(wxDC
& dc
,
580 const wxString
& label
,
583 int align
= wxALIGN_LEFT
,
585 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
586 virtual void DrawHorizontalLine(wxDC
& dc
,
587 wxCoord y
, wxCoord x1
, wxCoord x2
)
588 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
589 virtual void DrawVerticalLine(wxDC
& dc
,
590 wxCoord x
, wxCoord y1
, wxCoord y2
)
591 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
592 virtual void DrawArrow(wxDC
& dc
,
596 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
597 virtual void DrawScrollbarArrow(wxDC
& dc
,
601 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
602 virtual void DrawScrollbarThumb(wxDC
& dc
,
603 wxOrientation orient
,
606 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
607 virtual void DrawScrollbarShaft(wxDC
& dc
,
608 wxOrientation orient
,
611 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
612 virtual void DrawScrollCorner(wxDC
& dc
,
614 { m_renderer
->DrawScrollCorner(dc
, rect
); }
615 virtual void DrawItem(wxDC
& dc
,
616 const wxString
& label
,
619 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
620 virtual void DrawCheckItem(wxDC
& dc
,
621 const wxString
& label
,
622 const wxBitmap
& bitmap
,
625 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
626 virtual void DrawCheckButton(wxDC
& dc
,
627 const wxString
& label
,
628 const wxBitmap
& bitmap
,
631 wxAlignment align
= wxALIGN_LEFT
,
633 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
634 flags
, align
, indexAccel
); }
635 virtual void DrawRadioButton(wxDC
& dc
,
636 const wxString
& label
,
637 const wxBitmap
& bitmap
,
640 wxAlignment align
= wxALIGN_LEFT
,
642 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
643 flags
, align
, indexAccel
); }
645 virtual void DrawToolBarButton(wxDC
& dc
,
646 const wxString
& label
,
647 const wxBitmap
& bitmap
,
652 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
653 #endif // wxUSE_TOOLBAR
656 virtual void DrawTextLine(wxDC
& dc
,
657 const wxString
& text
,
662 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
663 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
664 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
665 #endif // wxUSE_TEXTCTRL
668 virtual void DrawTab(wxDC
& dc
,
671 const wxString
& label
,
672 const wxBitmap
& bitmap
= wxNullBitmap
,
675 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
676 #endif // wxUSE_NOTEBOOK
680 virtual void DrawSliderShaft(wxDC
& dc
,
683 wxOrientation orient
,
686 wxRect
*rectShaft
= NULL
)
687 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
688 virtual void DrawSliderThumb(wxDC
& dc
,
690 wxOrientation orient
,
693 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
694 virtual void DrawSliderTicks(wxDC
& dc
,
697 wxOrientation orient
,
700 int WXUNUSED(step
) = 1,
703 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
704 start
, end
, start
, flags
, style
); }
705 #endif // wxUSE_SLIDER
708 virtual void DrawMenuBarItem(wxDC
& dc
,
710 const wxString
& label
,
713 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
714 virtual void DrawMenuItem(wxDC
& dc
,
716 const wxMenuGeometryInfo
& gi
,
717 const wxString
& label
,
718 const wxString
& accel
,
719 const wxBitmap
& bitmap
= wxNullBitmap
,
722 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
723 bitmap
, flags
, indexAccel
); }
724 virtual void DrawMenuSeparator(wxDC
& dc
,
726 const wxMenuGeometryInfo
& geomInfo
)
727 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
728 #endif // wxUSE_MENUS
731 virtual void DrawStatusField(wxDC
& dc
,
733 const wxString
& label
,
734 int flags
= 0, int style
= 0)
735 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
736 #endif // wxUSE_STATUSBAR
738 virtual void DrawFrameTitleBar(wxDC
& dc
,
740 const wxString
& title
,
743 int specialButton
= 0,
744 int specialButtonFlag
= 0)
745 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
746 specialButton
, specialButtonFlag
); }
747 virtual void DrawFrameBorder(wxDC
& dc
,
750 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
751 virtual void DrawFrameBackground(wxDC
& dc
,
754 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
755 virtual void DrawFrameTitle(wxDC
& dc
,
757 const wxString
& title
,
759 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
760 virtual void DrawFrameIcon(wxDC
& dc
,
764 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
765 virtual void DrawFrameButton(wxDC
& dc
,
766 wxCoord x
, wxCoord y
,
769 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
772 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
774 wxBitmap
*bmpPressed
,
775 wxBitmap
*bmpDisabled
)
776 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
777 bmpPressed
, bmpDisabled
); }
778 #endif // wxUSE_COMBOBOX
780 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
781 { m_renderer
->AdjustSize(size
, window
); }
782 virtual wxRect
GetBorderDimensions(wxBorder border
) const
783 { return m_renderer
->GetBorderDimensions(border
); }
784 virtual bool AreScrollbarsInsideBorder() const
785 { return m_renderer
->AreScrollbarsInsideBorder(); }
788 virtual wxSize
GetScrollbarArrowSize() const
789 { return m_renderer
->GetScrollbarArrowSize(); }
790 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
791 wxScrollBar::Element elem
,
792 int thumbPos
= -1) const
793 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
794 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
795 { return m_renderer
->GetScrollbarSize(scrollbar
); }
796 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
797 const wxPoint
& pt
) const
798 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
799 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
801 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
802 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
804 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
805 #endif // wxUSE_SCROLLBAR
807 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
808 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
809 virtual wxSize
GetCheckBitmapSize() const
810 { return m_renderer
->GetCheckBitmapSize(); }
811 virtual wxSize
GetRadioBitmapSize() const
812 { return m_renderer
->GetRadioBitmapSize(); }
813 virtual wxCoord
GetCheckItemMargin() const
814 { return m_renderer
->GetCheckItemMargin(); }
817 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
818 { return m_renderer
->GetToolBarButtonSize(separator
); }
819 virtual wxSize
GetToolBarMargin() const
820 { return m_renderer
->GetToolBarMargin(); }
821 #endif // wxUSE_TOOLBAR
824 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
825 const wxRect
& rect
) const
826 { return m_renderer
->GetTextTotalArea(text
, rect
); }
827 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
829 wxCoord
*extraSpaceBeyond
) const
830 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
831 #endif // wxUSE_TEXTCTRL
834 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
835 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
836 #endif // wxUSE_NOTEBOOK
839 virtual wxCoord
GetSliderDim() const
840 { return m_renderer
->GetSliderDim(); }
841 virtual wxCoord
GetSliderTickLen() const
842 { return m_renderer
->GetSliderTickLen(); }
844 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
846 wxOrientation orient
,
847 long style
= 0) const
848 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
849 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
851 wxOrientation orient
) const
852 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
853 #endif // wxUSE_SLIDER
855 virtual wxSize
GetProgressBarStep() const
856 { return m_renderer
->GetProgressBarStep(); }
859 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
860 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
861 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
862 const wxMenu
& menu
) const
863 { return m_renderer
->GetMenuGeometry(win
, menu
); }
864 #endif // wxUSE_MENUS
867 virtual wxSize
GetStatusBarBorders() const
868 { return m_renderer
->GetStatusBarBorders(); }
869 virtual wxCoord
GetStatusBarBorderBetweenFields() const
870 { return m_renderer
->GetStatusBarBorderBetweenFields(); }
871 virtual wxSize
GetStatusBarFieldMargins() const
872 { return m_renderer
->GetStatusBarFieldMargins(); }
873 #endif // wxUSE_STATUSBAR
875 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
876 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
877 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
878 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
879 virtual wxSize
GetFrameMinSize(int flags
) const
880 { return m_renderer
->GetFrameMinSize(flags
); }
881 virtual wxSize
GetFrameIconSize() const
882 { return m_renderer
->GetFrameIconSize(); }
883 virtual int HitTestFrame(const wxRect
& rect
,
886 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
888 virtual void DrawHeaderButton(wxWindow
*win
,
892 wxHeaderSortIconType sortIcon
= wxHDR_SORT_ICON_NONE
,
893 wxHeaderButtonParams
* params
= NULL
)
894 { m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
, sortIcon
, params
); }
895 virtual void DrawTreeItemButton(wxWindow
*win
,
899 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
902 wxRenderer
*m_renderer
;
905 // ----------------------------------------------------------------------------
906 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
908 // ----------------------------------------------------------------------------
910 class WXDLLEXPORT wxControlRenderer
913 // create a renderer for this dc with this "fundamental" renderer
914 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
917 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
918 wxCoord marginX
= 0, wxCoord marginY
= 0);
920 void DrawItems(const wxListBox
*listbox
,
921 size_t itemFirst
, size_t itemLast
);
922 #endif // wxUSE_LISTBOX
923 #if wxUSE_CHECKLISTBOX
924 void DrawCheckItems(const wxCheckListBox
*listbox
,
925 size_t itemFirst
, size_t itemLast
);
926 #endif // wxUSE_CHECKLISTBOX
927 void DrawButtonBorder();
928 // the line must be either horizontal or vertical
929 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
931 void DrawBitmap(const wxBitmap
& bitmap
);
932 void DrawBackgroundBitmap();
933 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
935 void DrawProgressBar(const wxGauge
*gauge
);
936 #endif // wxUSE_GAUGE
939 wxWindow
*GetWindow() const { return m_window
; }
940 wxRenderer
*GetRenderer() const { return m_renderer
; }
942 wxDC
& GetDC() { return m_dc
; }
944 const wxRect
& GetRect() const { return m_rect
; }
945 wxRect
& GetRect() { return m_rect
; }
948 static void DrawBitmap(wxDC
&dc
,
949 const wxBitmap
& bitmap
,
951 int alignment
= wxALIGN_CENTRE
|
952 wxALIGN_CENTRE_VERTICAL
,
953 wxStretch stretch
= wxSTRETCH_NOT
);
958 // common part of DrawItems() and DrawCheckItems()
959 void DoDrawItems(const wxListBox
*listbox
,
960 size_t itemFirst
, size_t itemLast
,
961 bool isCheckLbox
= false);
962 #endif // wxUSE_LISTBOX
965 wxRenderer
*m_renderer
;
970 #endif // _WX_UNIV_RENDERER_H_