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 WXDLLIMPEXP_FWD_CORE wxWindow
;
34 class WXDLLIMPEXP_FWD_CORE wxDC
;
35 class WXDLLIMPEXP_FWD_CORE wxCheckListBox
;
38 class WXDLLIMPEXP_FWD_CORE wxListBox
;
39 #endif // wxUSE_LISTBOX
42 class WXDLLIMPEXP_FWD_CORE wxMenu
;
43 class WXDLLIMPEXP_FWD_CORE wxMenuGeometryInfo
;
46 class WXDLLIMPEXP_FWD_CORE wxScrollBar
;
49 class WXDLLIMPEXP_FWD_CORE wxTextCtrl
;
53 class WXDLLIMPEXP_FWD_CORE wxGauge
;
56 #include "wx/string.h"
57 #include "wx/gdicmn.h"
60 // helper class used by wxMenu-related functions
61 class WXDLLIMPEXP_CORE wxMenuGeometryInfo
64 // get the total size of the menu
65 virtual wxSize
GetSize() const = 0;
67 virtual ~wxMenuGeometryInfo();
70 // ----------------------------------------------------------------------------
71 // wxRenderer: abstract renderers interface
72 // ----------------------------------------------------------------------------
74 class WXDLLIMPEXP_CORE wxRenderer
: public wxDelegateRendererNative
80 // draw the controls background
81 virtual void DrawBackground(wxDC
& dc
,
85 wxWindow
*window
= NULL
) = 0;
87 // draw the button surface
88 virtual void DrawButtonSurface(wxDC
& dc
,
93 // draw the label inside the given rectangle with the specified alignment
94 // and optionally emphasize the character with the given index
95 virtual void DrawLabel(wxDC
& dc
,
96 const wxString
& label
,
99 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
101 wxRect
*rectBounds
= NULL
) = 0;
103 // same but also draw a bitmap if it is valid
104 virtual void DrawButtonLabel(wxDC
& dc
,
105 const wxString
& label
,
106 const wxBitmap
& image
,
109 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
111 wxRect
*rectBounds
= NULL
) = 0;
114 // draw the border and optionally return the rectangle containing the
115 // region inside the border
116 virtual void DrawBorder(wxDC
& dc
,
120 wxRect
*rectIn
= NULL
) = 0;
122 // draw text control border (I hate to have a separate method for this but
123 // it is needed to accommodate GTK+)
124 virtual void DrawTextBorder(wxDC
& dc
,
128 wxRect
*rectIn
= NULL
) = 0;
130 // draw push button border and return the rectangle left for the label
131 virtual void DrawButtonBorder(wxDC
& dc
,
134 wxRect
*rectIn
= NULL
) = 0;
136 // draw a horizontal line
137 virtual void DrawHorizontalLine(wxDC
& dc
,
138 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
140 // draw a vertical line
141 virtual void DrawVerticalLine(wxDC
& dc
,
142 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
144 // draw a frame with the label (horizontal alignment can be specified)
145 virtual void DrawFrame(wxDC
& dc
,
146 const wxString
& label
,
149 int alignment
= wxALIGN_LEFT
,
150 int indexAccel
= -1) = 0;
152 // draw an arrow in the given direction
153 virtual void DrawArrow(wxDC
& dc
,
158 // draw a scrollbar arrow (may be the same as arrow but may be not)
159 virtual void DrawScrollbarArrow(wxDC
& dc
,
164 // draw the scrollbar thumb
165 virtual void DrawScrollbarThumb(wxDC
& dc
,
166 wxOrientation orient
,
170 // draw a (part of) scrollbar shaft
171 virtual void DrawScrollbarShaft(wxDC
& dc
,
172 wxOrientation orient
,
176 // draw the rectangle in the corner between two scrollbars
177 virtual void DrawScrollCorner(wxDC
& dc
,
178 const wxRect
& rect
) = 0;
180 // draw an item of a wxListBox
181 virtual void DrawItem(wxDC
& dc
,
182 const wxString
& label
,
186 // draw an item of a wxCheckListBox
187 virtual void DrawCheckItem(wxDC
& dc
,
188 const wxString
& label
,
189 const wxBitmap
& bitmap
,
193 // draw a checkbutton (bitmap may be invalid to use default one)
194 virtual void DrawCheckButton(wxDC
& dc
,
195 const wxString
& label
,
196 const wxBitmap
& bitmap
,
199 wxAlignment align
= wxALIGN_LEFT
,
200 int indexAccel
= -1) = 0;
202 // draw a radio button
203 virtual void DrawRadioButton(wxDC
& dc
,
204 const wxString
& label
,
205 const wxBitmap
& bitmap
,
208 wxAlignment align
= wxALIGN_LEFT
,
209 int indexAccel
= -1) = 0;
212 // draw a toolbar button (label may be empty, bitmap may be invalid, if
213 // both conditions are true this function draws a separator)
214 virtual void DrawToolBarButton(wxDC
& dc
,
215 const wxString
& label
,
216 const wxBitmap
& bitmap
,
220 int tbarStyle
= 0) = 0;
221 #endif // wxUSE_TOOLBAR
224 // draw a (part of) line in the text control
225 virtual void DrawTextLine(wxDC
& dc
,
226 const wxString
& text
,
232 // draw a line wrap indicator
233 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
234 #endif // wxUSE_TEXTCTRL
237 // draw a notebook tab
238 virtual void DrawTab(wxDC
& dc
,
241 const wxString
& label
,
242 const wxBitmap
& bitmap
= wxNullBitmap
,
244 int indexAccel
= -1) = 0;
245 #endif // wxUSE_NOTEBOOK
249 // draw the slider shaft
250 virtual void DrawSliderShaft(wxDC
& dc
,
253 wxOrientation orient
,
256 wxRect
*rectShaft
= NULL
) = 0;
258 // draw the slider thumb
259 virtual void DrawSliderThumb(wxDC
& dc
,
261 wxOrientation orient
,
265 // draw the slider ticks
266 virtual void DrawSliderTicks(wxDC
& dc
,
269 wxOrientation orient
,
275 #endif // wxUSE_SLIDER
278 // draw a menu bar item
279 virtual void DrawMenuBarItem(wxDC
& dc
,
281 const wxString
& label
,
283 int indexAccel
= -1) = 0;
285 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
287 // the geometryInfo is calculated by GetMenuGeometry() function from below
288 virtual void DrawMenuItem(wxDC
& dc
,
290 const wxMenuGeometryInfo
& geometryInfo
,
291 const wxString
& label
,
292 const wxString
& accel
,
293 const wxBitmap
& bitmap
= wxNullBitmap
,
295 int indexAccel
= -1) = 0;
297 // draw a menu bar separator
298 virtual void DrawMenuSeparator(wxDC
& dc
,
300 const wxMenuGeometryInfo
& geomInfo
) = 0;
301 #endif // wxUSE_MENUS
304 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
305 // interpreted specially and means "draw the status bar grip" here
306 virtual void DrawStatusField(wxDC
& dc
,
308 const wxString
& label
,
309 int flags
= 0, int style
= 0) = 0;
310 #endif // wxUSE_STATUSBAR
312 // draw complete frame/dialog titlebar
313 virtual void DrawFrameTitleBar(wxDC
& dc
,
315 const wxString
& title
,
318 int specialButton
= 0,
319 int specialButtonFlags
= 0) = 0;
321 // draw frame borders
322 virtual void DrawFrameBorder(wxDC
& dc
,
326 // draw frame titlebar background
327 virtual void DrawFrameBackground(wxDC
& dc
,
332 virtual void DrawFrameTitle(wxDC
& dc
,
334 const wxString
& title
,
338 virtual void DrawFrameIcon(wxDC
& dc
,
343 // draw frame buttons
344 virtual void DrawFrameButton(wxDC
& dc
,
345 wxCoord x
, wxCoord y
,
353 // return the bitmaps to use for combobox button
354 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
356 wxBitmap
*bmpPressed
,
357 wxBitmap
*bmpDisabled
) = 0;
358 #endif // wxUSE_COMBOBOX
360 // geometry functions
361 // ------------------
363 // get the dimensions of the border: rect.x/y contain the width/height of
364 // the left/top side, width/heigh - of the right/bottom one
365 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
367 // the scrollbars may be drawn either inside the window border or outside
368 // it - this function is used to decide how to draw them
369 virtual bool AreScrollbarsInsideBorder() const = 0;
371 // adjust the size of the control of the given class: for most controls,
372 // this just takes into account the border, but for some (buttons, for
373 // example) it is more complicated - the result being, in any case, that
374 // the control looks "nice" if it uses the adjusted rectangle
375 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
378 // get the size of a scrollbar arrow
379 virtual wxSize
GetScrollbarArrowSize() const = 0;
380 #endif // wxUSE_SCROLLBAR
382 // get the height of a listbox item from the base font height
383 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
385 // get the size of a checkbox/radio button bitmap
386 virtual wxSize
GetCheckBitmapSize() const = 0;
387 virtual wxSize
GetRadioBitmapSize() const = 0;
388 virtual wxCoord
GetCheckItemMargin() const = 0;
391 // get the standard size of a toolbar button and also return the size of
392 // a toolbar separator in the provided pointer
393 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
395 // get the margins between/around the toolbar buttons
396 virtual wxSize
GetToolBarMargin() const = 0;
397 #endif // wxUSE_TOOLBAR
400 // convert between text rectangle and client rectangle for text controls:
401 // the former is typicall smaller to leave margins around text
402 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
403 const wxRect
& rectText
) const = 0;
405 // extra space is for line indicators
406 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
407 const wxRect
& rectTotal
,
408 wxCoord
*extraSpaceBeyond
) const = 0;
409 #endif // wxUSE_TEXTCTRL
412 // get the overhang of a selected tab
413 virtual wxSize
GetTabIndent() const = 0;
415 // get the padding around the text in a tab
416 virtual wxSize
GetTabPadding() const = 0;
417 #endif // wxUSE_NOTEBOOK
420 // get the default size of the slider in lesser dimension (i.e. height of a
421 // horizontal slider or width of a vertical one)
422 virtual wxCoord
GetSliderDim() const = 0;
424 // get the length of the slider ticks displayed along side slider
425 virtual wxCoord
GetSliderTickLen() const = 0;
427 // get the slider shaft rect from the total slider rect
428 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
430 wxOrientation orient
,
431 long style
= 0) const = 0;
433 // get the size of the slider thumb for the given total slider rect
434 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
436 wxOrientation orient
) const = 0;
437 #endif // wxUSE_SLIDER
439 // get the size of one progress bar step (in horz and vertical directions)
440 virtual wxSize
GetProgressBarStep() const = 0;
443 // get the size of rectangle to use in the menubar for the given text rect
444 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
446 // get the struct storing all layout info needed to draw all menu items
447 // (this can't be calculated for each item separately as they should be
450 // the returned pointer must be deleted by the caller
451 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
452 const wxMenu
& menu
) const = 0;
453 #endif // wxUSE_MENUS
456 // get the borders around the status bar fields (x and y fields of the
458 virtual wxSize
GetStatusBarBorders() const = 0;
460 // get the border between the status bar fields
461 virtual wxCoord
GetStatusBarBorderBetweenFields() const = 0;
463 // get the mergin between a field and its border
464 virtual wxSize
GetStatusBarFieldMargins() const = 0;
465 #endif // wxUSE_STATUSBAR
467 // get client area rectangle of top level window (i.e. subtract
468 // decorations from given rectangle)
469 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
471 // get size of whole top level window, given size of its client area size
472 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
474 // get the minimal size of top level window
475 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
477 // get titlebar icon size
478 virtual wxSize
GetFrameIconSize() const = 0;
480 // returns one of wxHT_TOPLEVEL_XXX constants
481 virtual int HitTestFrame(const wxRect
& rect
,
483 int flags
= 0) const = 0;
485 // virtual dtor for any base class
486 virtual ~wxRenderer();
489 // ----------------------------------------------------------------------------
490 // wxDelegateRenderer: it is impossible to inherit from any of standard
491 // renderers as their declarations are in private code, but you can use this
492 // class to override only some of the Draw() functions - all the other ones
493 // will be left to the original renderer
494 // ----------------------------------------------------------------------------
496 class WXDLLIMPEXP_CORE wxDelegateRenderer
: public wxRenderer
499 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
501 virtual void DrawBackground(wxDC
& dc
,
505 wxWindow
*window
= NULL
)
506 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
507 virtual void DrawButtonSurface(wxDC
& dc
,
511 { m_renderer
->DrawButtonSurface(dc
, col
, rect
, flags
); }
512 virtual void DrawFocusRect(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
= 0)
513 { m_renderer
->DrawFocusRect(win
, dc
, rect
, flags
); }
514 virtual void DrawLabel(wxDC
& dc
,
515 const wxString
& label
,
518 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
520 wxRect
*rectBounds
= NULL
)
521 { m_renderer
->DrawLabel(dc
, label
, rect
,
522 flags
, align
, indexAccel
, rectBounds
); }
523 virtual void DrawButtonLabel(wxDC
& dc
,
524 const wxString
& label
,
525 const wxBitmap
& image
,
528 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
530 wxRect
*rectBounds
= NULL
)
531 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
532 flags
, align
, indexAccel
, rectBounds
); }
533 virtual void DrawBorder(wxDC
& dc
,
537 wxRect
*rectIn
= NULL
)
538 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
539 virtual void DrawTextBorder(wxDC
& dc
,
543 wxRect
*rectIn
= NULL
)
544 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
545 virtual void DrawButtonBorder(wxDC
& dc
,
548 wxRect
*rectIn
= NULL
)
549 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
550 virtual void DrawFrame(wxDC
& dc
,
551 const wxString
& label
,
554 int align
= wxALIGN_LEFT
,
556 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
557 virtual void DrawHorizontalLine(wxDC
& dc
,
558 wxCoord y
, wxCoord x1
, wxCoord x2
)
559 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
560 virtual void DrawVerticalLine(wxDC
& dc
,
561 wxCoord x
, wxCoord y1
, wxCoord y2
)
562 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
563 virtual void DrawArrow(wxDC
& dc
,
567 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
568 virtual void DrawScrollbarArrow(wxDC
& dc
,
572 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
573 virtual void DrawScrollbarThumb(wxDC
& dc
,
574 wxOrientation orient
,
577 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
578 virtual void DrawScrollbarShaft(wxDC
& dc
,
579 wxOrientation orient
,
582 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
583 virtual void DrawScrollCorner(wxDC
& dc
,
585 { m_renderer
->DrawScrollCorner(dc
, rect
); }
586 virtual void DrawItem(wxDC
& dc
,
587 const wxString
& label
,
590 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
591 virtual void DrawCheckItem(wxDC
& dc
,
592 const wxString
& label
,
593 const wxBitmap
& bitmap
,
596 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
597 virtual void DrawCheckButton(wxDC
& dc
,
598 const wxString
& label
,
599 const wxBitmap
& bitmap
,
602 wxAlignment align
= wxALIGN_LEFT
,
604 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
605 flags
, align
, indexAccel
); }
606 virtual void DrawRadioButton(wxDC
& dc
,
607 const wxString
& label
,
608 const wxBitmap
& bitmap
,
611 wxAlignment align
= wxALIGN_LEFT
,
613 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
614 flags
, align
, indexAccel
); }
616 virtual void DrawToolBarButton(wxDC
& dc
,
617 const wxString
& label
,
618 const wxBitmap
& bitmap
,
623 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
624 #endif // wxUSE_TOOLBAR
627 virtual void DrawTextLine(wxDC
& dc
,
628 const wxString
& text
,
633 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
634 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
635 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
636 #endif // wxUSE_TEXTCTRL
639 virtual void DrawTab(wxDC
& dc
,
642 const wxString
& label
,
643 const wxBitmap
& bitmap
= wxNullBitmap
,
646 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
647 #endif // wxUSE_NOTEBOOK
651 virtual void DrawSliderShaft(wxDC
& dc
,
654 wxOrientation orient
,
657 wxRect
*rectShaft
= NULL
)
658 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
659 virtual void DrawSliderThumb(wxDC
& dc
,
661 wxOrientation orient
,
664 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
665 virtual void DrawSliderTicks(wxDC
& dc
,
668 wxOrientation orient
,
671 int WXUNUSED(step
) = 1,
674 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
675 start
, end
, start
, flags
, style
); }
676 #endif // wxUSE_SLIDER
679 virtual void DrawMenuBarItem(wxDC
& dc
,
681 const wxString
& label
,
684 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
685 virtual void DrawMenuItem(wxDC
& dc
,
687 const wxMenuGeometryInfo
& gi
,
688 const wxString
& label
,
689 const wxString
& accel
,
690 const wxBitmap
& bitmap
= wxNullBitmap
,
693 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
694 bitmap
, flags
, indexAccel
); }
695 virtual void DrawMenuSeparator(wxDC
& dc
,
697 const wxMenuGeometryInfo
& geomInfo
)
698 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
699 #endif // wxUSE_MENUS
702 virtual void DrawStatusField(wxDC
& dc
,
704 const wxString
& label
,
705 int flags
= 0, int style
= 0)
706 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
707 #endif // wxUSE_STATUSBAR
709 virtual void DrawFrameTitleBar(wxDC
& dc
,
711 const wxString
& title
,
714 int specialButton
= 0,
715 int specialButtonFlag
= 0)
716 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
717 specialButton
, specialButtonFlag
); }
718 virtual void DrawFrameBorder(wxDC
& dc
,
721 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
722 virtual void DrawFrameBackground(wxDC
& dc
,
725 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
726 virtual void DrawFrameTitle(wxDC
& dc
,
728 const wxString
& title
,
730 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
731 virtual void DrawFrameIcon(wxDC
& dc
,
735 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
736 virtual void DrawFrameButton(wxDC
& dc
,
737 wxCoord x
, wxCoord y
,
740 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
743 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
745 wxBitmap
*bmpPressed
,
746 wxBitmap
*bmpDisabled
)
747 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
748 bmpPressed
, bmpDisabled
); }
749 #endif // wxUSE_COMBOBOX
751 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
752 { m_renderer
->AdjustSize(size
, window
); }
753 virtual wxRect
GetBorderDimensions(wxBorder border
) const
754 { return m_renderer
->GetBorderDimensions(border
); }
755 virtual bool AreScrollbarsInsideBorder() const
756 { return m_renderer
->AreScrollbarsInsideBorder(); }
759 virtual wxSize
GetScrollbarArrowSize() const
760 { return m_renderer
->GetScrollbarArrowSize(); }
761 #endif // wxUSE_SCROLLBAR
763 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
764 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
765 virtual wxSize
GetCheckBitmapSize() const
766 { return m_renderer
->GetCheckBitmapSize(); }
767 virtual wxSize
GetRadioBitmapSize() const
768 { return m_renderer
->GetRadioBitmapSize(); }
769 virtual wxCoord
GetCheckItemMargin() const
770 { return m_renderer
->GetCheckItemMargin(); }
773 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
774 { return m_renderer
->GetToolBarButtonSize(separator
); }
775 virtual wxSize
GetToolBarMargin() const
776 { return m_renderer
->GetToolBarMargin(); }
777 #endif // wxUSE_TOOLBAR
780 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
781 const wxRect
& rect
) const
782 { return m_renderer
->GetTextTotalArea(text
, rect
); }
783 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
785 wxCoord
*extraSpaceBeyond
) const
786 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
787 #endif // wxUSE_TEXTCTRL
790 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
791 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
792 #endif // wxUSE_NOTEBOOK
795 virtual wxCoord
GetSliderDim() const
796 { return m_renderer
->GetSliderDim(); }
797 virtual wxCoord
GetSliderTickLen() const
798 { return m_renderer
->GetSliderTickLen(); }
800 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
802 wxOrientation orient
,
803 long style
= 0) const
804 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
805 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
807 wxOrientation orient
) const
808 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
809 #endif // wxUSE_SLIDER
811 virtual wxSize
GetProgressBarStep() const
812 { return m_renderer
->GetProgressBarStep(); }
815 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
816 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
817 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
818 const wxMenu
& menu
) const
819 { return m_renderer
->GetMenuGeometry(win
, menu
); }
820 #endif // wxUSE_MENUS
823 virtual wxSize
GetStatusBarBorders() const
824 { return m_renderer
->GetStatusBarBorders(); }
825 virtual wxCoord
GetStatusBarBorderBetweenFields() const
826 { return m_renderer
->GetStatusBarBorderBetweenFields(); }
827 virtual wxSize
GetStatusBarFieldMargins() const
828 { return m_renderer
->GetStatusBarFieldMargins(); }
829 #endif // wxUSE_STATUSBAR
831 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
832 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
833 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
834 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
835 virtual wxSize
GetFrameMinSize(int flags
) const
836 { return m_renderer
->GetFrameMinSize(flags
); }
837 virtual wxSize
GetFrameIconSize() const
838 { return m_renderer
->GetFrameIconSize(); }
839 virtual int HitTestFrame(const wxRect
& rect
,
842 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
844 virtual int DrawHeaderButton(wxWindow
*win
,
848 wxHeaderSortIconType sortIcon
= wxHDR_SORT_ICON_NONE
,
849 wxHeaderButtonParams
* params
= NULL
)
850 { return m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
, sortIcon
, params
); }
851 virtual void DrawTreeItemButton(wxWindow
*win
,
855 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
858 wxRenderer
*m_renderer
;
861 // ----------------------------------------------------------------------------
862 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
864 // ----------------------------------------------------------------------------
866 class WXDLLIMPEXP_CORE wxControlRenderer
869 // create a renderer for this dc with this "fundamental" renderer
870 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
874 void DrawButtonLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
875 wxCoord marginX
= 0, wxCoord marginY
= 0);
877 void DrawItems(const wxListBox
*listbox
,
878 size_t itemFirst
, size_t itemLast
);
879 #endif // wxUSE_LISTBOX
880 #if wxUSE_CHECKLISTBOX
881 void DrawCheckItems(const wxCheckListBox
*listbox
,
882 size_t itemFirst
, size_t itemLast
);
883 #endif // wxUSE_CHECKLISTBOX
884 void DrawButtonBorder();
885 // the line must be either horizontal or vertical
886 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
888 void DrawBitmap(const wxBitmap
& bitmap
);
889 void DrawBackgroundBitmap();
890 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
892 void DrawProgressBar(const wxGauge
*gauge
);
893 #endif // wxUSE_GAUGE
896 wxWindow
*GetWindow() const { return m_window
; }
897 wxRenderer
*GetRenderer() const { return m_renderer
; }
899 wxDC
& GetDC() { return m_dc
; }
901 const wxRect
& GetRect() const { return m_rect
; }
902 wxRect
& GetRect() { return m_rect
; }
905 static void DrawBitmap(wxDC
&dc
,
906 const wxBitmap
& bitmap
,
908 int alignment
= wxALIGN_CENTRE
|
909 wxALIGN_CENTRE_VERTICAL
,
910 wxStretch stretch
= wxSTRETCH_NOT
);
915 // common part of DrawItems() and DrawCheckItems()
916 void DoDrawItems(const wxListBox
*listbox
,
917 size_t itemFirst
, size_t itemLast
,
918 bool isCheckLbox
= false);
919 #endif // wxUSE_LISTBOX
922 wxRenderer
*m_renderer
;
927 #endif // _WX_UNIV_RENDERER_H_