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;
211 // draw a radio button sans label or bitmap, for wxRenderer API compat.
212 virtual void DrawRadioButton(wxDC
& dc
,
215 wxAlignment align
= wxALIGN_LEFT
)
216 { DrawRadioButton(dc
, wxEmptyString
, wxNullBitmap
, rect
, flags
, align
); }
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;
385 // get the size of a scrollbar arrow
386 virtual wxSize
GetScrollbarArrowSize() const = 0;
387 #endif // wxUSE_SCROLLBAR
389 // get the height of a listbox item from the base font height
390 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
392 // get the size of a checkbox/radio button bitmap
393 virtual wxSize
GetCheckBitmapSize() const = 0;
394 virtual wxSize
GetRadioBitmapSize() const = 0;
395 virtual wxCoord
GetCheckItemMargin() const = 0;
398 // get the standard size of a toolbar button and also return the size of
399 // a toolbar separator in the provided pointer
400 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
402 // get the margins between/around the toolbar buttons
403 virtual wxSize
GetToolBarMargin() const = 0;
404 #endif // wxUSE_TOOLBAR
407 // convert between text rectangle and client rectangle for text controls:
408 // the former is typicall smaller to leave margins around text
409 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
410 const wxRect
& rectText
) const = 0;
412 // extra space is for line indicators
413 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
414 const wxRect
& rectTotal
,
415 wxCoord
*extraSpaceBeyond
) const = 0;
416 #endif // wxUSE_TEXTCTRL
419 // get the overhang of a selected tab
420 virtual wxSize
GetTabIndent() const = 0;
422 // get the padding around the text in a tab
423 virtual wxSize
GetTabPadding() const = 0;
424 #endif // wxUSE_NOTEBOOK
427 // get the default size of the slider in lesser dimension (i.e. height of a
428 // horizontal slider or width of a vertical one)
429 virtual wxCoord
GetSliderDim() const = 0;
431 // get the length of the slider ticks displayed along side slider
432 virtual wxCoord
GetSliderTickLen() const = 0;
434 // get the slider shaft rect from the total slider rect
435 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
437 wxOrientation orient
,
438 long style
= 0) const = 0;
440 // get the size of the slider thumb for the given total slider rect
441 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
443 wxOrientation orient
) const = 0;
444 #endif // wxUSE_SLIDER
446 // get the size of one progress bar step (in horz and vertical directions)
447 virtual wxSize
GetProgressBarStep() const = 0;
450 // get the size of rectangle to use in the menubar for the given text rect
451 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
453 // get the struct storing all layout info needed to draw all menu items
454 // (this can't be calculated for each item separately as they should be
457 // the returned pointer must be deleted by the caller
458 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
459 const wxMenu
& menu
) const = 0;
460 #endif // wxUSE_MENUS
463 // get the borders around the status bar fields (x and y fields of the
465 virtual wxSize
GetStatusBarBorders() const = 0;
467 // get the border between the status bar fields
468 virtual wxCoord
GetStatusBarBorderBetweenFields() const = 0;
470 // get the mergin between a field and its border
471 virtual wxSize
GetStatusBarFieldMargins() const = 0;
472 #endif // wxUSE_STATUSBAR
474 // get client area rectangle of top level window (i.e. subtract
475 // decorations from given rectangle)
476 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
478 // get size of whole top level window, given size of its client area size
479 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
481 // get the minimal size of top level window
482 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
484 // get titlebar icon size
485 virtual wxSize
GetFrameIconSize() const = 0;
487 // returns one of wxHT_TOPLEVEL_XXX constants
488 virtual int HitTestFrame(const wxRect
& rect
,
490 int flags
= 0) const = 0;
492 // virtual dtor for any base class
493 virtual ~wxRenderer();
496 // ----------------------------------------------------------------------------
497 // wxDelegateRenderer: it is impossible to inherit from any of standard
498 // renderers as their declarations are in private code, but you can use this
499 // class to override only some of the Draw() functions - all the other ones
500 // will be left to the original renderer
501 // ----------------------------------------------------------------------------
503 class WXDLLIMPEXP_CORE wxDelegateRenderer
: public wxRenderer
506 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
508 virtual void DrawBackground(wxDC
& dc
,
512 wxWindow
*window
= NULL
)
513 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
514 virtual void DrawButtonSurface(wxDC
& dc
,
518 { m_renderer
->DrawButtonSurface(dc
, col
, rect
, flags
); }
519 virtual void DrawFocusRect(wxWindow
* win
, wxDC
& dc
, const wxRect
& rect
, int flags
= 0)
520 { m_renderer
->DrawFocusRect(win
, dc
, rect
, flags
); }
521 virtual void DrawLabel(wxDC
& dc
,
522 const wxString
& label
,
525 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
527 wxRect
*rectBounds
= NULL
)
528 { m_renderer
->DrawLabel(dc
, label
, rect
,
529 flags
, align
, indexAccel
, rectBounds
); }
530 virtual void DrawButtonLabel(wxDC
& dc
,
531 const wxString
& label
,
532 const wxBitmap
& image
,
535 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
537 wxRect
*rectBounds
= NULL
)
538 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
539 flags
, align
, indexAccel
, rectBounds
); }
540 virtual void DrawBorder(wxDC
& dc
,
544 wxRect
*rectIn
= NULL
)
545 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
546 virtual void DrawTextBorder(wxDC
& dc
,
550 wxRect
*rectIn
= NULL
)
551 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
552 virtual void DrawButtonBorder(wxDC
& dc
,
555 wxRect
*rectIn
= NULL
)
556 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
557 virtual void DrawFrame(wxDC
& dc
,
558 const wxString
& label
,
561 int align
= wxALIGN_LEFT
,
563 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
564 virtual void DrawHorizontalLine(wxDC
& dc
,
565 wxCoord y
, wxCoord x1
, wxCoord x2
)
566 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
567 virtual void DrawVerticalLine(wxDC
& dc
,
568 wxCoord x
, wxCoord y1
, wxCoord y2
)
569 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
570 virtual void DrawArrow(wxDC
& dc
,
574 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
575 virtual void DrawScrollbarArrow(wxDC
& dc
,
579 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
580 virtual void DrawScrollbarThumb(wxDC
& dc
,
581 wxOrientation orient
,
584 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
585 virtual void DrawScrollbarShaft(wxDC
& dc
,
586 wxOrientation orient
,
589 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
590 virtual void DrawScrollCorner(wxDC
& dc
,
592 { m_renderer
->DrawScrollCorner(dc
, rect
); }
593 virtual void DrawItem(wxDC
& dc
,
594 const wxString
& label
,
597 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
598 virtual void DrawCheckItem(wxDC
& dc
,
599 const wxString
& label
,
600 const wxBitmap
& bitmap
,
603 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
604 virtual void DrawCheckButton(wxDC
& dc
,
605 const wxString
& label
,
606 const wxBitmap
& bitmap
,
609 wxAlignment align
= wxALIGN_LEFT
,
611 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
612 flags
, align
, indexAccel
); }
613 virtual void DrawRadioButton(wxDC
& dc
,
614 const wxString
& label
,
615 const wxBitmap
& bitmap
,
618 wxAlignment align
= wxALIGN_LEFT
,
620 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
621 flags
, align
, indexAccel
); }
623 virtual void DrawToolBarButton(wxDC
& dc
,
624 const wxString
& label
,
625 const wxBitmap
& bitmap
,
630 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
631 #endif // wxUSE_TOOLBAR
634 virtual void DrawTextLine(wxDC
& dc
,
635 const wxString
& text
,
640 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
641 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
642 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
643 #endif // wxUSE_TEXTCTRL
646 virtual void DrawTab(wxDC
& dc
,
649 const wxString
& label
,
650 const wxBitmap
& bitmap
= wxNullBitmap
,
653 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
654 #endif // wxUSE_NOTEBOOK
658 virtual void DrawSliderShaft(wxDC
& dc
,
661 wxOrientation orient
,
664 wxRect
*rectShaft
= NULL
)
665 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
666 virtual void DrawSliderThumb(wxDC
& dc
,
668 wxOrientation orient
,
671 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
672 virtual void DrawSliderTicks(wxDC
& dc
,
675 wxOrientation orient
,
678 int WXUNUSED(step
) = 1,
681 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
682 start
, end
, start
, flags
, style
); }
683 #endif // wxUSE_SLIDER
686 virtual void DrawMenuBarItem(wxDC
& dc
,
688 const wxString
& label
,
691 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
692 virtual void DrawMenuItem(wxDC
& dc
,
694 const wxMenuGeometryInfo
& gi
,
695 const wxString
& label
,
696 const wxString
& accel
,
697 const wxBitmap
& bitmap
= wxNullBitmap
,
700 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
701 bitmap
, flags
, indexAccel
); }
702 virtual void DrawMenuSeparator(wxDC
& dc
,
704 const wxMenuGeometryInfo
& geomInfo
)
705 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
706 #endif // wxUSE_MENUS
709 virtual void DrawStatusField(wxDC
& dc
,
711 const wxString
& label
,
712 int flags
= 0, int style
= 0)
713 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
714 #endif // wxUSE_STATUSBAR
716 virtual void DrawFrameTitleBar(wxDC
& dc
,
718 const wxString
& title
,
721 int specialButton
= 0,
722 int specialButtonFlag
= 0)
723 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
724 specialButton
, specialButtonFlag
); }
725 virtual void DrawFrameBorder(wxDC
& dc
,
728 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
729 virtual void DrawFrameBackground(wxDC
& dc
,
732 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
733 virtual void DrawFrameTitle(wxDC
& dc
,
735 const wxString
& title
,
737 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
738 virtual void DrawFrameIcon(wxDC
& dc
,
742 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
743 virtual void DrawFrameButton(wxDC
& dc
,
744 wxCoord x
, wxCoord y
,
747 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
750 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
752 wxBitmap
*bmpPressed
,
753 wxBitmap
*bmpDisabled
)
754 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
755 bmpPressed
, bmpDisabled
); }
756 #endif // wxUSE_COMBOBOX
758 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
759 { m_renderer
->AdjustSize(size
, window
); }
760 virtual wxRect
GetBorderDimensions(wxBorder border
) const
761 { return m_renderer
->GetBorderDimensions(border
); }
762 virtual bool AreScrollbarsInsideBorder() const
763 { return m_renderer
->AreScrollbarsInsideBorder(); }
766 virtual wxSize
GetScrollbarArrowSize() const
767 { return m_renderer
->GetScrollbarArrowSize(); }
768 #endif // wxUSE_SCROLLBAR
770 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
771 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
772 virtual wxSize
GetCheckBitmapSize() const
773 { return m_renderer
->GetCheckBitmapSize(); }
774 virtual wxSize
GetRadioBitmapSize() const
775 { return m_renderer
->GetRadioBitmapSize(); }
776 virtual wxCoord
GetCheckItemMargin() const
777 { return m_renderer
->GetCheckItemMargin(); }
780 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
781 { return m_renderer
->GetToolBarButtonSize(separator
); }
782 virtual wxSize
GetToolBarMargin() const
783 { return m_renderer
->GetToolBarMargin(); }
784 #endif // wxUSE_TOOLBAR
787 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
788 const wxRect
& rect
) const
789 { return m_renderer
->GetTextTotalArea(text
, rect
); }
790 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
792 wxCoord
*extraSpaceBeyond
) const
793 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
794 #endif // wxUSE_TEXTCTRL
797 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
798 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
799 #endif // wxUSE_NOTEBOOK
802 virtual wxCoord
GetSliderDim() const
803 { return m_renderer
->GetSliderDim(); }
804 virtual wxCoord
GetSliderTickLen() const
805 { return m_renderer
->GetSliderTickLen(); }
807 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
809 wxOrientation orient
,
810 long style
= 0) const
811 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
812 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
814 wxOrientation orient
) const
815 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
816 #endif // wxUSE_SLIDER
818 virtual wxSize
GetProgressBarStep() const
819 { return m_renderer
->GetProgressBarStep(); }
822 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
823 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
824 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
825 const wxMenu
& menu
) const
826 { return m_renderer
->GetMenuGeometry(win
, menu
); }
827 #endif // wxUSE_MENUS
830 virtual wxSize
GetStatusBarBorders() const
831 { return m_renderer
->GetStatusBarBorders(); }
832 virtual wxCoord
GetStatusBarBorderBetweenFields() const
833 { return m_renderer
->GetStatusBarBorderBetweenFields(); }
834 virtual wxSize
GetStatusBarFieldMargins() const
835 { return m_renderer
->GetStatusBarFieldMargins(); }
836 #endif // wxUSE_STATUSBAR
838 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
839 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
840 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
841 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
842 virtual wxSize
GetFrameMinSize(int flags
) const
843 { return m_renderer
->GetFrameMinSize(flags
); }
844 virtual wxSize
GetFrameIconSize() const
845 { return m_renderer
->GetFrameIconSize(); }
846 virtual int HitTestFrame(const wxRect
& rect
,
849 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
851 virtual int DrawHeaderButton(wxWindow
*win
,
855 wxHeaderSortIconType sortIcon
= wxHDR_SORT_ICON_NONE
,
856 wxHeaderButtonParams
* params
= NULL
)
857 { return m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
, sortIcon
, params
); }
858 virtual void DrawTreeItemButton(wxWindow
*win
,
862 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
865 wxRenderer
*m_renderer
;
868 // ----------------------------------------------------------------------------
869 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
871 // ----------------------------------------------------------------------------
873 class WXDLLIMPEXP_CORE wxControlRenderer
876 // create a renderer for this dc with this "fundamental" renderer
877 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
880 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
881 wxCoord marginX
= 0, wxCoord marginY
= 0);
883 void DrawItems(const wxListBox
*listbox
,
884 size_t itemFirst
, size_t itemLast
);
885 #endif // wxUSE_LISTBOX
886 #if wxUSE_CHECKLISTBOX
887 void DrawCheckItems(const wxCheckListBox
*listbox
,
888 size_t itemFirst
, size_t itemLast
);
889 #endif // wxUSE_CHECKLISTBOX
890 void DrawButtonBorder();
891 // the line must be either horizontal or vertical
892 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
894 void DrawBitmap(const wxBitmap
& bitmap
);
895 void DrawBackgroundBitmap();
896 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
898 void DrawProgressBar(const wxGauge
*gauge
);
899 #endif // wxUSE_GAUGE
902 wxWindow
*GetWindow() const { return m_window
; }
903 wxRenderer
*GetRenderer() const { return m_renderer
; }
905 wxDC
& GetDC() { return m_dc
; }
907 const wxRect
& GetRect() const { return m_rect
; }
908 wxRect
& GetRect() { return m_rect
; }
911 static void DrawBitmap(wxDC
&dc
,
912 const wxBitmap
& bitmap
,
914 int alignment
= wxALIGN_CENTRE
|
915 wxALIGN_CENTRE_VERTICAL
,
916 wxStretch stretch
= wxSTRETCH_NOT
);
921 // common part of DrawItems() and DrawCheckItems()
922 void DoDrawItems(const wxListBox
*listbox
,
923 size_t itemFirst
, size_t itemLast
,
924 bool isCheckLbox
= false);
925 #endif // wxUSE_LISTBOX
928 wxRenderer
*m_renderer
;
933 #endif // _WX_UNIV_RENDERER_H_