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 WXDLLEXPORT 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 WXDLLEXPORT 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
,
94 // draw the focus rectangle around the label contained in the given rect
96 // only wxCONTROL_SELECTED makes sense in flags here
97 virtual void DrawFocusRect(wxDC
& dc
, const wxRect
& rect
, int flags
= 0) = 0;
99 // draw the label inside the given rectangle with the specified alignment
100 // and optionally emphasize the character with the given index
101 virtual void DrawLabel(wxDC
& dc
,
102 const wxString
& label
,
105 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
107 wxRect
*rectBounds
= NULL
) = 0;
109 // same but also draw a bitmap if it is valid
110 virtual void DrawButtonLabel(wxDC
& dc
,
111 const wxString
& label
,
112 const wxBitmap
& image
,
115 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
117 wxRect
*rectBounds
= NULL
) = 0;
120 // draw the border and optionally return the rectangle containing the
121 // region inside the border
122 virtual void DrawBorder(wxDC
& dc
,
126 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
128 // draw text control border (I hate to have a separate method for this but
129 // it is needed to accommodate GTK+)
130 virtual void DrawTextBorder(wxDC
& dc
,
134 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
136 // draw push button border and return the rectangle left for the label
137 virtual void DrawButtonBorder(wxDC
& dc
,
140 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
142 // draw a horizontal line
143 virtual void DrawHorizontalLine(wxDC
& dc
,
144 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
146 // draw a vertical line
147 virtual void DrawVerticalLine(wxDC
& dc
,
148 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
150 // draw a frame with the label (horizontal alignment can be specified)
151 virtual void DrawFrame(wxDC
& dc
,
152 const wxString
& label
,
155 int alignment
= wxALIGN_LEFT
,
156 int indexAccel
= -1) = 0;
158 // draw an arrow in the given direction
159 virtual void DrawArrow(wxDC
& dc
,
164 // draw a scrollbar arrow (may be the same as arrow but may be not)
165 virtual void DrawScrollbarArrow(wxDC
& dc
,
170 // draw the scrollbar thumb
171 virtual void DrawScrollbarThumb(wxDC
& dc
,
172 wxOrientation orient
,
176 // draw a (part of) scrollbar shaft
177 virtual void DrawScrollbarShaft(wxDC
& dc
,
178 wxOrientation orient
,
182 // draw the rectangle in the corner between two scrollbars
183 virtual void DrawScrollCorner(wxDC
& dc
,
184 const wxRect
& rect
) = 0;
186 // draw an item of a wxListBox
187 virtual void DrawItem(wxDC
& dc
,
188 const wxString
& label
,
192 // draw an item of a wxCheckListBox
193 virtual void DrawCheckItem(wxDC
& dc
,
194 const wxString
& label
,
195 const wxBitmap
& bitmap
,
199 // draw a checkbutton (bitmap may be invalid to use default one)
200 virtual void DrawCheckButton(wxDC
& dc
,
201 const wxString
& label
,
202 const wxBitmap
& bitmap
,
205 wxAlignment align
= wxALIGN_LEFT
,
206 int indexAccel
= -1) = 0;
208 // draw a radio button
209 virtual void DrawRadioButton(wxDC
& dc
,
210 const wxString
& label
,
211 const wxBitmap
& bitmap
,
214 wxAlignment align
= wxALIGN_LEFT
,
215 int indexAccel
= -1) = 0;
218 // draw a toolbar button (label may be empty, bitmap may be invalid, if
219 // both conditions are true this function draws a separator)
220 virtual void DrawToolBarButton(wxDC
& dc
,
221 const wxString
& label
,
222 const wxBitmap
& bitmap
,
226 int tbarStyle
= 0) = 0;
227 #endif // wxUSE_TOOLBAR
230 // draw a (part of) line in the text control
231 virtual void DrawTextLine(wxDC
& dc
,
232 const wxString
& text
,
238 // draw a line wrap indicator
239 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
240 #endif // wxUSE_TEXTCTRL
243 // draw a notebook tab
244 virtual void DrawTab(wxDC
& dc
,
247 const wxString
& label
,
248 const wxBitmap
& bitmap
= wxNullBitmap
,
250 int indexAccel
= -1) = 0;
251 #endif // wxUSE_NOTEBOOK
255 // draw the slider shaft
256 virtual void DrawSliderShaft(wxDC
& dc
,
259 wxOrientation orient
,
262 wxRect
*rectShaft
= NULL
) = 0;
264 // draw the slider thumb
265 virtual void DrawSliderThumb(wxDC
& dc
,
267 wxOrientation orient
,
271 // draw the slider ticks
272 virtual void DrawSliderTicks(wxDC
& dc
,
275 wxOrientation orient
,
281 #endif // wxUSE_SLIDER
284 // draw a menu bar item
285 virtual void DrawMenuBarItem(wxDC
& dc
,
287 const wxString
& label
,
289 int indexAccel
= -1) = 0;
291 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
293 // the geometryInfo is calculated by GetMenuGeometry() function from below
294 virtual void DrawMenuItem(wxDC
& dc
,
296 const wxMenuGeometryInfo
& geometryInfo
,
297 const wxString
& label
,
298 const wxString
& accel
,
299 const wxBitmap
& bitmap
= wxNullBitmap
,
301 int indexAccel
= -1) = 0;
303 // draw a menu bar separator
304 virtual void DrawMenuSeparator(wxDC
& dc
,
306 const wxMenuGeometryInfo
& geomInfo
) = 0;
307 #endif // wxUSE_MENUS
310 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
311 // interpreted specially and means "draw the status bar grip" here
312 virtual void DrawStatusField(wxDC
& dc
,
314 const wxString
& label
,
315 int flags
= 0, int style
= 0) = 0;
316 #endif // wxUSE_STATUSBAR
318 // draw complete frame/dialog titlebar
319 virtual void DrawFrameTitleBar(wxDC
& dc
,
321 const wxString
& title
,
324 int specialButton
= 0,
325 int specialButtonFlags
= 0) = 0;
327 // draw frame borders
328 virtual void DrawFrameBorder(wxDC
& dc
,
332 // draw frame titlebar background
333 virtual void DrawFrameBackground(wxDC
& dc
,
338 virtual void DrawFrameTitle(wxDC
& dc
,
340 const wxString
& title
,
344 virtual void DrawFrameIcon(wxDC
& dc
,
349 // draw frame buttons
350 virtual void DrawFrameButton(wxDC
& dc
,
351 wxCoord x
, wxCoord y
,
359 // return the bitmaps to use for combobox button
360 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
362 wxBitmap
*bmpPressed
,
363 wxBitmap
*bmpDisabled
) = 0;
364 #endif // wxUSE_COMBOBOX
366 // geometry functions
367 // ------------------
369 // get the dimensions of the border: rect.x/y contain the width/height of
370 // the left/top side, width/heigh - of the right/bottom one
371 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
373 // the scrollbars may be drawn either inside the window border or outside
374 // it - this function is used to decide how to draw them
375 virtual bool AreScrollbarsInsideBorder() const = 0;
377 // adjust the size of the control of the given class: for most controls,
378 // this just takes into account the border, but for some (buttons, for
379 // example) it is more complicated - the result being, in any case, that
380 // the control looks "nice" if it uses the adjusted rectangle
381 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
384 // get the size of a scrollbar arrow
385 virtual wxSize
GetScrollbarArrowSize() const = 0;
386 #endif // wxUSE_SCROLLBAR
388 // get the height of a listbox item from the base font height
389 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
391 // get the size of a checkbox/radio button bitmap
392 virtual wxSize
GetCheckBitmapSize() const = 0;
393 virtual wxSize
GetRadioBitmapSize() const = 0;
394 virtual wxCoord
GetCheckItemMargin() const = 0;
397 // get the standard size of a toolbar button and also return the size of
398 // a toolbar separator in the provided pointer
399 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
401 // get the margins between/around the toolbar buttons
402 virtual wxSize
GetToolBarMargin() const = 0;
403 #endif // wxUSE_TOOLBAR
406 // convert between text rectangle and client rectangle for text controls:
407 // the former is typicall smaller to leave margins around text
408 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
409 const wxRect
& rectText
) const = 0;
411 // extra space is for line indicators
412 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
413 const wxRect
& rectTotal
,
414 wxCoord
*extraSpaceBeyond
) const = 0;
415 #endif // wxUSE_TEXTCTRL
418 // get the overhang of a selected tab
419 virtual wxSize
GetTabIndent() const = 0;
421 // get the padding around the text in a tab
422 virtual wxSize
GetTabPadding() const = 0;
423 #endif // wxUSE_NOTEBOOK
426 // get the default size of the slider in lesser dimension (i.e. height of a
427 // horizontal slider or width of a vertical one)
428 virtual wxCoord
GetSliderDim() const = 0;
430 // get the length of the slider ticks displayed along side slider
431 virtual wxCoord
GetSliderTickLen() const = 0;
433 // get the slider shaft rect from the total slider rect
434 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
436 wxOrientation orient
,
437 long style
= 0) const = 0;
439 // get the size of the slider thumb for the given total slider rect
440 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
442 wxOrientation orient
) const = 0;
443 #endif // wxUSE_SLIDER
445 // get the size of one progress bar step (in horz and vertical directions)
446 virtual wxSize
GetProgressBarStep() const = 0;
449 // get the size of rectangle to use in the menubar for the given text rect
450 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
452 // get the struct storing all layout info needed to draw all menu items
453 // (this can't be calculated for each item separately as they should be
456 // the returned pointer must be deleted by the caller
457 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
458 const wxMenu
& menu
) const = 0;
459 #endif // wxUSE_MENUS
462 // get the borders around the status bar fields (x and y fields of the
464 virtual wxSize
GetStatusBarBorders() const = 0;
466 // get the border between the status bar fields
467 virtual wxCoord
GetStatusBarBorderBetweenFields() const = 0;
469 // get the mergin between a field and its border
470 virtual wxSize
GetStatusBarFieldMargins() const = 0;
471 #endif // wxUSE_STATUSBAR
473 // get client area rectangle of top level window (i.e. subtract
474 // decorations from given rectangle)
475 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
477 // get size of whole top level window, given size of its client area size
478 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
480 // get the minimal size of top level window
481 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
483 // get titlebar icon size
484 virtual wxSize
GetFrameIconSize() const = 0;
486 // returns one of wxHT_TOPLEVEL_XXX constants
487 virtual int HitTestFrame(const wxRect
& rect
,
489 int flags
= 0) const = 0;
491 // virtual dtor for any base class
492 virtual ~wxRenderer();
495 // ----------------------------------------------------------------------------
496 // wxDelegateRenderer: it is impossible to inherit from any of standard
497 // renderers as their declarations are in private code, but you can use this
498 // class to override only some of the Draw() functions - all the other ones
499 // will be left to the original renderer
500 // ----------------------------------------------------------------------------
502 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
505 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
507 virtual void DrawBackground(wxDC
& dc
,
511 wxWindow
*window
= NULL
)
512 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
513 virtual void DrawButtonSurface(wxDC
& dc
,
517 { m_renderer
->DrawButtonSurface(dc
, col
, rect
, flags
); }
518 virtual void DrawFocusRect(wxDC
& dc
, const wxRect
& rect
, int flags
= 0)
519 { m_renderer
->DrawFocusRect(dc
, rect
, flags
); }
520 virtual void DrawLabel(wxDC
& dc
,
521 const wxString
& label
,
524 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
526 wxRect
*rectBounds
= NULL
)
527 { m_renderer
->DrawLabel(dc
, label
, rect
,
528 flags
, align
, indexAccel
, rectBounds
); }
529 virtual void DrawButtonLabel(wxDC
& dc
,
530 const wxString
& label
,
531 const wxBitmap
& image
,
534 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
536 wxRect
*rectBounds
= NULL
)
537 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
538 flags
, align
, indexAccel
, rectBounds
); }
539 virtual void DrawBorder(wxDC
& dc
,
543 wxRect
*rectIn
= (wxRect
*)NULL
)
544 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
545 virtual void DrawTextBorder(wxDC
& dc
,
549 wxRect
*rectIn
= (wxRect
*)NULL
)
550 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
551 virtual void DrawButtonBorder(wxDC
& dc
,
554 wxRect
*rectIn
= (wxRect
*)NULL
)
555 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
556 virtual void DrawFrame(wxDC
& dc
,
557 const wxString
& label
,
560 int align
= wxALIGN_LEFT
,
562 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
563 virtual void DrawHorizontalLine(wxDC
& dc
,
564 wxCoord y
, wxCoord x1
, wxCoord x2
)
565 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
566 virtual void DrawVerticalLine(wxDC
& dc
,
567 wxCoord x
, wxCoord y1
, wxCoord y2
)
568 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
569 virtual void DrawArrow(wxDC
& dc
,
573 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
574 virtual void DrawScrollbarArrow(wxDC
& dc
,
578 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
579 virtual void DrawScrollbarThumb(wxDC
& dc
,
580 wxOrientation orient
,
583 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
584 virtual void DrawScrollbarShaft(wxDC
& dc
,
585 wxOrientation orient
,
588 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
589 virtual void DrawScrollCorner(wxDC
& dc
,
591 { m_renderer
->DrawScrollCorner(dc
, rect
); }
592 virtual void DrawItem(wxDC
& dc
,
593 const wxString
& label
,
596 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
597 virtual void DrawCheckItem(wxDC
& dc
,
598 const wxString
& label
,
599 const wxBitmap
& bitmap
,
602 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
603 virtual void DrawCheckButton(wxDC
& dc
,
604 const wxString
& label
,
605 const wxBitmap
& bitmap
,
608 wxAlignment align
= wxALIGN_LEFT
,
610 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
611 flags
, align
, indexAccel
); }
612 virtual void DrawRadioButton(wxDC
& dc
,
613 const wxString
& label
,
614 const wxBitmap
& bitmap
,
617 wxAlignment align
= wxALIGN_LEFT
,
619 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
620 flags
, align
, indexAccel
); }
622 virtual void DrawToolBarButton(wxDC
& dc
,
623 const wxString
& label
,
624 const wxBitmap
& bitmap
,
629 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
630 #endif // wxUSE_TOOLBAR
633 virtual void DrawTextLine(wxDC
& dc
,
634 const wxString
& text
,
639 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
640 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
641 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
642 #endif // wxUSE_TEXTCTRL
645 virtual void DrawTab(wxDC
& dc
,
648 const wxString
& label
,
649 const wxBitmap
& bitmap
= wxNullBitmap
,
652 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
653 #endif // wxUSE_NOTEBOOK
657 virtual void DrawSliderShaft(wxDC
& dc
,
660 wxOrientation orient
,
663 wxRect
*rectShaft
= NULL
)
664 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
665 virtual void DrawSliderThumb(wxDC
& dc
,
667 wxOrientation orient
,
670 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
671 virtual void DrawSliderTicks(wxDC
& dc
,
674 wxOrientation orient
,
677 int WXUNUSED(step
) = 1,
680 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
681 start
, end
, start
, flags
, style
); }
682 #endif // wxUSE_SLIDER
685 virtual void DrawMenuBarItem(wxDC
& dc
,
687 const wxString
& label
,
690 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
691 virtual void DrawMenuItem(wxDC
& dc
,
693 const wxMenuGeometryInfo
& gi
,
694 const wxString
& label
,
695 const wxString
& accel
,
696 const wxBitmap
& bitmap
= wxNullBitmap
,
699 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
700 bitmap
, flags
, indexAccel
); }
701 virtual void DrawMenuSeparator(wxDC
& dc
,
703 const wxMenuGeometryInfo
& geomInfo
)
704 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
705 #endif // wxUSE_MENUS
708 virtual void DrawStatusField(wxDC
& dc
,
710 const wxString
& label
,
711 int flags
= 0, int style
= 0)
712 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
713 #endif // wxUSE_STATUSBAR
715 virtual void DrawFrameTitleBar(wxDC
& dc
,
717 const wxString
& title
,
720 int specialButton
= 0,
721 int specialButtonFlag
= 0)
722 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
723 specialButton
, specialButtonFlag
); }
724 virtual void DrawFrameBorder(wxDC
& dc
,
727 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
728 virtual void DrawFrameBackground(wxDC
& dc
,
731 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
732 virtual void DrawFrameTitle(wxDC
& dc
,
734 const wxString
& title
,
736 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
737 virtual void DrawFrameIcon(wxDC
& dc
,
741 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
742 virtual void DrawFrameButton(wxDC
& dc
,
743 wxCoord x
, wxCoord y
,
746 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
749 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
751 wxBitmap
*bmpPressed
,
752 wxBitmap
*bmpDisabled
)
753 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
754 bmpPressed
, bmpDisabled
); }
755 #endif // wxUSE_COMBOBOX
757 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
758 { m_renderer
->AdjustSize(size
, window
); }
759 virtual wxRect
GetBorderDimensions(wxBorder border
) const
760 { return m_renderer
->GetBorderDimensions(border
); }
761 virtual bool AreScrollbarsInsideBorder() const
762 { return m_renderer
->AreScrollbarsInsideBorder(); }
765 virtual wxSize
GetScrollbarArrowSize() const
766 { return m_renderer
->GetScrollbarArrowSize(); }
767 #endif // wxUSE_SCROLLBAR
769 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
770 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
771 virtual wxSize
GetCheckBitmapSize() const
772 { return m_renderer
->GetCheckBitmapSize(); }
773 virtual wxSize
GetRadioBitmapSize() const
774 { return m_renderer
->GetRadioBitmapSize(); }
775 virtual wxCoord
GetCheckItemMargin() const
776 { return m_renderer
->GetCheckItemMargin(); }
779 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
780 { return m_renderer
->GetToolBarButtonSize(separator
); }
781 virtual wxSize
GetToolBarMargin() const
782 { return m_renderer
->GetToolBarMargin(); }
783 #endif // wxUSE_TOOLBAR
786 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
787 const wxRect
& rect
) const
788 { return m_renderer
->GetTextTotalArea(text
, rect
); }
789 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
791 wxCoord
*extraSpaceBeyond
) const
792 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
793 #endif // wxUSE_TEXTCTRL
796 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
797 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
798 #endif // wxUSE_NOTEBOOK
801 virtual wxCoord
GetSliderDim() const
802 { return m_renderer
->GetSliderDim(); }
803 virtual wxCoord
GetSliderTickLen() const
804 { return m_renderer
->GetSliderTickLen(); }
806 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
808 wxOrientation orient
,
809 long style
= 0) const
810 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
811 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
813 wxOrientation orient
) const
814 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
815 #endif // wxUSE_SLIDER
817 virtual wxSize
GetProgressBarStep() const
818 { return m_renderer
->GetProgressBarStep(); }
821 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
822 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
823 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
824 const wxMenu
& menu
) const
825 { return m_renderer
->GetMenuGeometry(win
, menu
); }
826 #endif // wxUSE_MENUS
829 virtual wxSize
GetStatusBarBorders() const
830 { return m_renderer
->GetStatusBarBorders(); }
831 virtual wxCoord
GetStatusBarBorderBetweenFields() const
832 { return m_renderer
->GetStatusBarBorderBetweenFields(); }
833 virtual wxSize
GetStatusBarFieldMargins() const
834 { return m_renderer
->GetStatusBarFieldMargins(); }
835 #endif // wxUSE_STATUSBAR
837 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
838 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
839 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
840 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
841 virtual wxSize
GetFrameMinSize(int flags
) const
842 { return m_renderer
->GetFrameMinSize(flags
); }
843 virtual wxSize
GetFrameIconSize() const
844 { return m_renderer
->GetFrameIconSize(); }
845 virtual int HitTestFrame(const wxRect
& rect
,
848 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
850 virtual int DrawHeaderButton(wxWindow
*win
,
854 wxHeaderSortIconType sortIcon
= wxHDR_SORT_ICON_NONE
,
855 wxHeaderButtonParams
* params
= NULL
)
856 { return m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
, sortIcon
, params
); }
857 virtual void DrawTreeItemButton(wxWindow
*win
,
861 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
864 wxRenderer
*m_renderer
;
867 // ----------------------------------------------------------------------------
868 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
870 // ----------------------------------------------------------------------------
872 class WXDLLEXPORT wxControlRenderer
875 // create a renderer for this dc with this "fundamental" renderer
876 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
879 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
880 wxCoord marginX
= 0, wxCoord marginY
= 0);
882 void DrawItems(const wxListBox
*listbox
,
883 size_t itemFirst
, size_t itemLast
);
884 #endif // wxUSE_LISTBOX
885 #if wxUSE_CHECKLISTBOX
886 void DrawCheckItems(const wxCheckListBox
*listbox
,
887 size_t itemFirst
, size_t itemLast
);
888 #endif // wxUSE_CHECKLISTBOX
889 void DrawButtonBorder();
890 // the line must be either horizontal or vertical
891 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
893 void DrawBitmap(const wxBitmap
& bitmap
);
894 void DrawBackgroundBitmap();
895 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
897 void DrawProgressBar(const wxGauge
*gauge
);
898 #endif // wxUSE_GAUGE
901 wxWindow
*GetWindow() const { return m_window
; }
902 wxRenderer
*GetRenderer() const { return m_renderer
; }
904 wxDC
& GetDC() { return m_dc
; }
906 const wxRect
& GetRect() const { return m_rect
; }
907 wxRect
& GetRect() { return m_rect
; }
910 static void DrawBitmap(wxDC
&dc
,
911 const wxBitmap
& bitmap
,
913 int alignment
= wxALIGN_CENTRE
|
914 wxALIGN_CENTRE_VERTICAL
,
915 wxStretch stretch
= wxSTRETCH_NOT
);
920 // common part of DrawItems() and DrawCheckItems()
921 void DoDrawItems(const wxListBox
*listbox
,
922 size_t itemFirst
, size_t itemLast
,
923 bool isCheckLbox
= false);
924 #endif // wxUSE_LISTBOX
927 wxRenderer
*m_renderer
;
932 #endif // _WX_UNIV_RENDERER_H_