1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/renderer.h
3 // Purpose: wxRenderer class declaration
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_UNIV_RENDERER_H_
12 #define _WX_UNIV_RENDERER_H_
15 wxRenderer class is used to draw all wxWidgets controls. This is an ABC and
16 the look of the application is determined by the concrete derivation of
17 wxRenderer used in the program.
19 It also contains a few static methods which may be used by the concrete
20 renderers and provide the functionality which is often similar or identical
21 in all renderers (using inheritance here would be more restrictive as the
22 given concrete renderer may need an arbitrary subset of the base class
25 Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and
26 includes the latters functionality (which it may delegate to the generic
27 implementation of the latter or reimplement itself).
30 #include "wx/renderer.h"
32 class WXDLLIMPEXP_FWD_CORE wxWindow
;
33 class WXDLLIMPEXP_FWD_CORE wxDC
;
34 class WXDLLIMPEXP_FWD_CORE wxCheckListBox
;
37 class WXDLLIMPEXP_FWD_CORE wxListBox
;
38 #endif // wxUSE_LISTBOX
41 class WXDLLIMPEXP_FWD_CORE wxMenu
;
42 class WXDLLIMPEXP_FWD_CORE wxMenuGeometryInfo
;
45 class WXDLLIMPEXP_FWD_CORE wxScrollBar
;
48 class WXDLLIMPEXP_FWD_CORE wxTextCtrl
;
52 class WXDLLIMPEXP_FWD_CORE wxGauge
;
55 #include "wx/string.h"
56 #include "wx/gdicmn.h"
59 // helper class used by wxMenu-related functions
60 class WXDLLIMPEXP_CORE wxMenuGeometryInfo
63 // get the total size of the menu
64 virtual wxSize
GetSize() const = 0;
66 virtual ~wxMenuGeometryInfo();
69 // ----------------------------------------------------------------------------
70 // wxRenderer: abstract renderers interface
71 // ----------------------------------------------------------------------------
73 class WXDLLIMPEXP_CORE wxRenderer
: public wxDelegateRendererNative
79 // draw the controls background
80 virtual void DrawBackground(wxDC
& dc
,
84 wxWindow
*window
= NULL
) = 0;
86 // draw the button surface
87 virtual void DrawButtonSurface(wxDC
& dc
,
92 // draw the label inside the given rectangle with the specified alignment
93 // and optionally emphasize the character with the given index
94 virtual void DrawLabel(wxDC
& dc
,
95 const wxString
& label
,
98 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
100 wxRect
*rectBounds
= NULL
) = 0;
102 // same but also draw a bitmap if it is valid
103 virtual void DrawButtonLabel(wxDC
& dc
,
104 const wxString
& label
,
105 const wxBitmap
& image
,
108 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
110 wxRect
*rectBounds
= NULL
) = 0;
113 // draw the border and optionally return the rectangle containing the
114 // region inside the border
115 virtual void DrawBorder(wxDC
& dc
,
119 wxRect
*rectIn
= NULL
) = 0;
121 // draw text control border (I hate to have a separate method for this but
122 // it is needed to accommodate GTK+)
123 virtual void DrawTextBorder(wxDC
& dc
,
127 wxRect
*rectIn
= NULL
) = 0;
129 // draw push button border and return the rectangle left for the label
130 virtual void DrawButtonBorder(wxDC
& dc
,
133 wxRect
*rectIn
= NULL
) = 0;
135 // draw a horizontal line
136 virtual void DrawHorizontalLine(wxDC
& dc
,
137 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
139 // draw a vertical line
140 virtual void DrawVerticalLine(wxDC
& dc
,
141 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
143 // draw a frame with the label (horizontal alignment can be specified)
144 virtual void DrawFrame(wxDC
& dc
,
145 const wxString
& label
,
148 int alignment
= wxALIGN_LEFT
,
149 int indexAccel
= -1) = 0;
151 // draw an arrow in the given direction
152 virtual void DrawArrow(wxDC
& dc
,
157 // draw a scrollbar arrow (may be the same as arrow but may be not)
158 virtual void DrawScrollbarArrow(wxDC
& dc
,
163 // draw the scrollbar thumb
164 virtual void DrawScrollbarThumb(wxDC
& dc
,
165 wxOrientation orient
,
169 // draw a (part of) scrollbar shaft
170 virtual void DrawScrollbarShaft(wxDC
& dc
,
171 wxOrientation orient
,
175 // draw the rectangle in the corner between two scrollbars
176 virtual void DrawScrollCorner(wxDC
& dc
,
177 const wxRect
& rect
) = 0;
179 // draw an item of a wxListBox
180 virtual void DrawItem(wxDC
& dc
,
181 const wxString
& label
,
185 // draw an item of a wxCheckListBox
186 virtual void DrawCheckItem(wxDC
& dc
,
187 const wxString
& label
,
188 const wxBitmap
& bitmap
,
192 // draw a checkbutton (bitmap may be invalid to use default one)
193 virtual void DrawCheckButton(wxDC
& dc
,
194 const wxString
& label
,
195 const wxBitmap
& bitmap
,
198 wxAlignment align
= wxALIGN_LEFT
,
199 int indexAccel
= -1) = 0;
201 // draw a radio button
202 virtual void DrawRadioButton(wxDC
& dc
,
203 const wxString
& label
,
204 const wxBitmap
& bitmap
,
207 wxAlignment align
= wxALIGN_LEFT
,
208 int indexAccel
= -1) = 0;
211 // draw a toolbar button (label may be empty, bitmap may be invalid, if
212 // both conditions are true this function draws a separator)
213 virtual void DrawToolBarButton(wxDC
& dc
,
214 const wxString
& label
,
215 const wxBitmap
& bitmap
,
219 int tbarStyle
= 0) = 0;
220 #endif // wxUSE_TOOLBAR
223 // draw a (part of) line in the text control
224 virtual void DrawTextLine(wxDC
& dc
,
225 const wxString
& text
,
231 // draw a line wrap indicator
232 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
233 #endif // wxUSE_TEXTCTRL
236 // draw a notebook tab
237 virtual void DrawTab(wxDC
& dc
,
240 const wxString
& label
,
241 const wxBitmap
& bitmap
= wxNullBitmap
,
243 int indexAccel
= -1) = 0;
244 #endif // wxUSE_NOTEBOOK
248 // draw the slider shaft
249 virtual void DrawSliderShaft(wxDC
& dc
,
252 wxOrientation orient
,
255 wxRect
*rectShaft
= NULL
) = 0;
257 // draw the slider thumb
258 virtual void DrawSliderThumb(wxDC
& dc
,
260 wxOrientation orient
,
264 // draw the slider ticks
265 virtual void DrawSliderTicks(wxDC
& dc
,
268 wxOrientation orient
,
274 #endif // wxUSE_SLIDER
277 // draw a menu bar item
278 virtual void DrawMenuBarItem(wxDC
& dc
,
280 const wxString
& label
,
282 int indexAccel
= -1) = 0;
284 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
286 // the geometryInfo is calculated by GetMenuGeometry() function from below
287 virtual void DrawMenuItem(wxDC
& dc
,
289 const wxMenuGeometryInfo
& geometryInfo
,
290 const wxString
& label
,
291 const wxString
& accel
,
292 const wxBitmap
& bitmap
= wxNullBitmap
,
294 int indexAccel
= -1) = 0;
296 // draw a menu bar separator
297 virtual void DrawMenuSeparator(wxDC
& dc
,
299 const wxMenuGeometryInfo
& geomInfo
) = 0;
300 #endif // wxUSE_MENUS
303 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
304 // interpreted specially and means "draw the status bar grip" here
305 virtual void DrawStatusField(wxDC
& dc
,
307 const wxString
& label
,
308 int flags
= 0, int style
= 0) = 0;
309 #endif // wxUSE_STATUSBAR
311 // draw complete frame/dialog titlebar
312 virtual void DrawFrameTitleBar(wxDC
& dc
,
314 const wxString
& title
,
317 int specialButton
= 0,
318 int specialButtonFlags
= 0) = 0;
320 // draw frame borders
321 virtual void DrawFrameBorder(wxDC
& dc
,
325 // draw frame titlebar background
326 virtual void DrawFrameBackground(wxDC
& dc
,
331 virtual void DrawFrameTitle(wxDC
& dc
,
333 const wxString
& title
,
337 virtual void DrawFrameIcon(wxDC
& dc
,
342 // draw frame buttons
343 virtual void DrawFrameButton(wxDC
& dc
,
344 wxCoord x
, wxCoord y
,
352 // return the bitmaps to use for combobox button
353 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
355 wxBitmap
*bmpPressed
,
356 wxBitmap
*bmpDisabled
) = 0;
357 #endif // wxUSE_COMBOBOX
359 // geometry functions
360 // ------------------
362 // get the dimensions of the border: rect.x/y contain the width/height of
363 // the left/top side, width/heigh - of the right/bottom one
364 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
366 // the scrollbars may be drawn either inside the window border or outside
367 // it - this function is used to decide how to draw them
368 virtual bool AreScrollbarsInsideBorder() const = 0;
370 // adjust the size of the control of the given class: for most controls,
371 // this just takes into account the border, but for some (buttons, for
372 // example) it is more complicated - the result being, in any case, that
373 // the control looks "nice" if it uses the adjusted rectangle
374 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
377 // get the size of a scrollbar arrow
378 virtual wxSize
GetScrollbarArrowSize() const = 0;
379 #endif // wxUSE_SCROLLBAR
381 // get the height of a listbox item from the base font height
382 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
384 // get the size of a checkbox/radio button bitmap
385 virtual wxSize
GetCheckBitmapSize() const = 0;
386 virtual wxSize
GetRadioBitmapSize() const = 0;
387 virtual wxCoord
GetCheckItemMargin() const = 0;
390 // get the standard size of a toolbar button and also return the size of
391 // a toolbar separator in the provided pointer
392 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
394 // get the margins between/around the toolbar buttons
395 virtual wxSize
GetToolBarMargin() const = 0;
396 #endif // wxUSE_TOOLBAR
399 // convert between text rectangle and client rectangle for text controls:
400 // the former is typicall smaller to leave margins around text
401 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
402 const wxRect
& rectText
) const = 0;
404 // extra space is for line indicators
405 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
406 const wxRect
& rectTotal
,
407 wxCoord
*extraSpaceBeyond
) const = 0;
408 #endif // wxUSE_TEXTCTRL
411 // get the overhang of a selected tab
412 virtual wxSize
GetTabIndent() const = 0;
414 // get the padding around the text in a tab
415 virtual wxSize
GetTabPadding() const = 0;
416 #endif // wxUSE_NOTEBOOK
419 // get the default size of the slider in lesser dimension (i.e. height of a
420 // horizontal slider or width of a vertical one)
421 virtual wxCoord
GetSliderDim() const = 0;
423 // get the length of the slider ticks displayed along side slider
424 virtual wxCoord
GetSliderTickLen() const = 0;
426 // get the slider shaft rect from the total slider rect
427 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
429 wxOrientation orient
,
430 long style
= 0) const = 0;
432 // get the size of the slider thumb for the given total slider rect
433 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
435 wxOrientation orient
) const = 0;
436 #endif // wxUSE_SLIDER
438 // get the size of one progress bar step (in horz and vertical directions)
439 virtual wxSize
GetProgressBarStep() const = 0;
442 // get the size of rectangle to use in the menubar for the given text rect
443 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
445 // get the struct storing all layout info needed to draw all menu items
446 // (this can't be calculated for each item separately as they should be
449 // the returned pointer must be deleted by the caller
450 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
451 const wxMenu
& menu
) const = 0;
452 #endif // wxUSE_MENUS
455 // get the borders around the status bar fields (x and y fields of the
457 virtual wxSize
GetStatusBarBorders() const = 0;
459 // get the border between the status bar fields
460 virtual wxCoord
GetStatusBarBorderBetweenFields() const = 0;
462 // get the mergin between a field and its border
463 virtual wxSize
GetStatusBarFieldMargins() const = 0;
464 #endif // wxUSE_STATUSBAR
466 // get client area rectangle of top level window (i.e. subtract
467 // decorations from given rectangle)
468 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
470 // get size of whole top level window, given size of its client area size
471 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
473 // get the minimal size of top level window
474 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
476 // get titlebar icon size
477 virtual wxSize
GetFrameIconSize() const = 0;
479 // returns one of wxHT_TOPLEVEL_XXX constants
480 virtual int HitTestFrame(const wxRect
& rect
,
482 int flags
= 0) const = 0;
484 // virtual dtor for any base class
485 virtual ~wxRenderer();
488 // ----------------------------------------------------------------------------
489 // wxDelegateRenderer: it is impossible to inherit from any of standard
490 // renderers as their declarations are in private code, but you can use this
491 // class to override only some of the Draw() functions - all the other ones
492 // will be left to the original renderer
493 // ----------------------------------------------------------------------------
495 class WXDLLIMPEXP_CORE wxDelegateRenderer
: public wxRenderer
498 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
500 virtual void DrawBackground(wxDC
& dc
,
504 wxWindow
*window
= NULL
)
505 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
506 virtual void DrawButtonSurface(wxDC
& dc
,
510 { m_renderer
->DrawButtonSurface(dc
, col
, rect
, flags
); }
511 virtual void DrawFocusRect(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
= 0)
512 { m_renderer
->DrawFocusRect(win
, dc
, rect
, flags
); }
513 virtual void DrawLabel(wxDC
& dc
,
514 const wxString
& label
,
517 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
519 wxRect
*rectBounds
= NULL
)
520 { m_renderer
->DrawLabel(dc
, label
, rect
,
521 flags
, align
, indexAccel
, rectBounds
); }
522 virtual void DrawButtonLabel(wxDC
& dc
,
523 const wxString
& label
,
524 const wxBitmap
& image
,
527 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
529 wxRect
*rectBounds
= NULL
)
530 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
531 flags
, align
, indexAccel
, rectBounds
); }
532 virtual void DrawBorder(wxDC
& dc
,
536 wxRect
*rectIn
= NULL
)
537 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
538 virtual void DrawTextBorder(wxDC
& dc
,
542 wxRect
*rectIn
= NULL
)
543 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
544 virtual void DrawButtonBorder(wxDC
& dc
,
547 wxRect
*rectIn
= NULL
)
548 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
549 virtual void DrawFrame(wxDC
& dc
,
550 const wxString
& label
,
553 int align
= wxALIGN_LEFT
,
555 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
556 virtual void DrawHorizontalLine(wxDC
& dc
,
557 wxCoord y
, wxCoord x1
, wxCoord x2
)
558 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
559 virtual void DrawVerticalLine(wxDC
& dc
,
560 wxCoord x
, wxCoord y1
, wxCoord y2
)
561 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
562 virtual void DrawArrow(wxDC
& dc
,
566 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
567 virtual void DrawScrollbarArrow(wxDC
& dc
,
571 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
572 virtual void DrawScrollbarThumb(wxDC
& dc
,
573 wxOrientation orient
,
576 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
577 virtual void DrawScrollbarShaft(wxDC
& dc
,
578 wxOrientation orient
,
581 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
582 virtual void DrawScrollCorner(wxDC
& dc
,
584 { m_renderer
->DrawScrollCorner(dc
, rect
); }
585 virtual void DrawItem(wxDC
& dc
,
586 const wxString
& label
,
589 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
590 virtual void DrawCheckItem(wxDC
& dc
,
591 const wxString
& label
,
592 const wxBitmap
& bitmap
,
595 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
596 virtual void DrawCheckButton(wxDC
& dc
,
597 const wxString
& label
,
598 const wxBitmap
& bitmap
,
601 wxAlignment align
= wxALIGN_LEFT
,
603 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
604 flags
, align
, indexAccel
); }
605 virtual void DrawRadioButton(wxDC
& dc
,
606 const wxString
& label
,
607 const wxBitmap
& bitmap
,
610 wxAlignment align
= wxALIGN_LEFT
,
612 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
613 flags
, align
, indexAccel
); }
615 virtual void DrawToolBarButton(wxDC
& dc
,
616 const wxString
& label
,
617 const wxBitmap
& bitmap
,
622 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
623 #endif // wxUSE_TOOLBAR
626 virtual void DrawTextLine(wxDC
& dc
,
627 const wxString
& text
,
632 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
633 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
634 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
635 #endif // wxUSE_TEXTCTRL
638 virtual void DrawTab(wxDC
& dc
,
641 const wxString
& label
,
642 const wxBitmap
& bitmap
= wxNullBitmap
,
645 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
646 #endif // wxUSE_NOTEBOOK
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
); }
675 #endif // wxUSE_SLIDER
678 virtual void DrawMenuBarItem(wxDC
& dc
,
680 const wxString
& label
,
683 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
684 virtual void DrawMenuItem(wxDC
& dc
,
686 const wxMenuGeometryInfo
& gi
,
687 const wxString
& label
,
688 const wxString
& accel
,
689 const wxBitmap
& bitmap
= wxNullBitmap
,
692 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
693 bitmap
, flags
, indexAccel
); }
694 virtual void DrawMenuSeparator(wxDC
& dc
,
696 const wxMenuGeometryInfo
& geomInfo
)
697 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
698 #endif // wxUSE_MENUS
701 virtual void DrawStatusField(wxDC
& dc
,
703 const wxString
& label
,
704 int flags
= 0, int style
= 0)
705 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
706 #endif // wxUSE_STATUSBAR
708 virtual void DrawFrameTitleBar(wxDC
& dc
,
710 const wxString
& title
,
713 int specialButton
= 0,
714 int specialButtonFlag
= 0)
715 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
716 specialButton
, specialButtonFlag
); }
717 virtual void DrawFrameBorder(wxDC
& dc
,
720 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
721 virtual void DrawFrameBackground(wxDC
& dc
,
724 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
725 virtual void DrawFrameTitle(wxDC
& dc
,
727 const wxString
& title
,
729 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
730 virtual void DrawFrameIcon(wxDC
& dc
,
734 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
735 virtual void DrawFrameButton(wxDC
& dc
,
736 wxCoord x
, wxCoord y
,
739 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
742 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
744 wxBitmap
*bmpPressed
,
745 wxBitmap
*bmpDisabled
)
746 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
747 bmpPressed
, bmpDisabled
); }
748 #endif // wxUSE_COMBOBOX
750 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
751 { m_renderer
->AdjustSize(size
, window
); }
752 virtual wxRect
GetBorderDimensions(wxBorder border
) const
753 { return m_renderer
->GetBorderDimensions(border
); }
754 virtual bool AreScrollbarsInsideBorder() const
755 { return m_renderer
->AreScrollbarsInsideBorder(); }
758 virtual wxSize
GetScrollbarArrowSize() const
759 { return m_renderer
->GetScrollbarArrowSize(); }
760 #endif // wxUSE_SCROLLBAR
762 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
763 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
764 virtual wxSize
GetCheckBitmapSize() const
765 { return m_renderer
->GetCheckBitmapSize(); }
766 virtual wxSize
GetRadioBitmapSize() const
767 { return m_renderer
->GetRadioBitmapSize(); }
768 virtual wxCoord
GetCheckItemMargin() const
769 { return m_renderer
->GetCheckItemMargin(); }
772 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
773 { return m_renderer
->GetToolBarButtonSize(separator
); }
774 virtual wxSize
GetToolBarMargin() const
775 { return m_renderer
->GetToolBarMargin(); }
776 #endif // wxUSE_TOOLBAR
779 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
780 const wxRect
& rect
) const
781 { return m_renderer
->GetTextTotalArea(text
, rect
); }
782 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
784 wxCoord
*extraSpaceBeyond
) const
785 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
786 #endif // wxUSE_TEXTCTRL
789 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
790 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
791 #endif // wxUSE_NOTEBOOK
794 virtual wxCoord
GetSliderDim() const
795 { return m_renderer
->GetSliderDim(); }
796 virtual wxCoord
GetSliderTickLen() const
797 { return m_renderer
->GetSliderTickLen(); }
799 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
801 wxOrientation orient
,
802 long style
= 0) const
803 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
804 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
806 wxOrientation orient
) const
807 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
808 #endif // wxUSE_SLIDER
810 virtual wxSize
GetProgressBarStep() const
811 { return m_renderer
->GetProgressBarStep(); }
814 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
815 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
816 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
817 const wxMenu
& menu
) const
818 { return m_renderer
->GetMenuGeometry(win
, menu
); }
819 #endif // wxUSE_MENUS
822 virtual wxSize
GetStatusBarBorders() const
823 { return m_renderer
->GetStatusBarBorders(); }
824 virtual wxCoord
GetStatusBarBorderBetweenFields() const
825 { return m_renderer
->GetStatusBarBorderBetweenFields(); }
826 virtual wxSize
GetStatusBarFieldMargins() const
827 { return m_renderer
->GetStatusBarFieldMargins(); }
828 #endif // wxUSE_STATUSBAR
830 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
831 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
832 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
833 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
834 virtual wxSize
GetFrameMinSize(int flags
) const
835 { return m_renderer
->GetFrameMinSize(flags
); }
836 virtual wxSize
GetFrameIconSize() const
837 { return m_renderer
->GetFrameIconSize(); }
838 virtual int HitTestFrame(const wxRect
& rect
,
841 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
843 virtual int DrawHeaderButton(wxWindow
*win
,
847 wxHeaderSortIconType sortIcon
= wxHDR_SORT_ICON_NONE
,
848 wxHeaderButtonParams
* params
= NULL
)
849 { return m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
, sortIcon
, params
); }
850 virtual void DrawTreeItemButton(wxWindow
*win
,
854 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
857 wxRenderer
*m_renderer
;
860 // ----------------------------------------------------------------------------
861 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
863 // ----------------------------------------------------------------------------
865 class WXDLLIMPEXP_CORE wxControlRenderer
868 // create a renderer for this dc with this "fundamental" renderer
869 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
873 void DrawButtonLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
874 wxCoord marginX
= 0, wxCoord marginY
= 0);
876 void DrawItems(const wxListBox
*listbox
,
877 size_t itemFirst
, size_t itemLast
);
878 #endif // wxUSE_LISTBOX
879 #if wxUSE_CHECKLISTBOX
880 void DrawCheckItems(const wxCheckListBox
*listbox
,
881 size_t itemFirst
, size_t itemLast
);
882 #endif // wxUSE_CHECKLISTBOX
883 void DrawButtonBorder();
884 // the line must be either horizontal or vertical
885 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
887 void DrawBitmap(const wxBitmap
& bitmap
);
888 void DrawBackgroundBitmap();
889 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
891 void DrawProgressBar(const wxGauge
*gauge
);
892 #endif // wxUSE_GAUGE
895 wxWindow
*GetWindow() const { return m_window
; }
896 wxRenderer
*GetRenderer() const { return m_renderer
; }
898 wxDC
& GetDC() { return m_dc
; }
900 const wxRect
& GetRect() const { return m_rect
; }
901 wxRect
& GetRect() { return m_rect
; }
904 static void DrawBitmap(wxDC
&dc
,
905 const wxBitmap
& bitmap
,
907 int alignment
= wxALIGN_CENTRE
|
908 wxALIGN_CENTRE_VERTICAL
,
909 wxStretch stretch
= wxSTRETCH_NOT
);
914 // common part of DrawItems() and DrawCheckItems()
915 void DoDrawItems(const wxListBox
*listbox
,
916 size_t itemFirst
, size_t itemLast
,
917 bool isCheckLbox
= false);
918 #endif // wxUSE_LISTBOX
921 wxRenderer
*m_renderer
;
926 #endif // _WX_UNIV_RENDERER_H_