1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/renderer.h
3 // Purpose: wxRenderer class declaration
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_UNIV_RENDERER_H_
13 #define _WX_UNIV_RENDERER_H_
16 wxRenderer class is used to draw all wxWidgets controls. This is an ABC and
17 the look of the application is determined by the concrete derivation of
18 wxRenderer used in the program.
20 It also contains a few static methods which may be used by the concrete
21 renderers and provide the functionality which is often similar or identical
22 in all renderers (using inheritance here would be more restrictive as the
23 given concrete renderer may need an arbitrary subset of the base class
26 Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and
27 includes the latters functionality (which it may delegate to the generic
28 implementation of the latter or reimplement itself).
31 #include "wx/renderer.h"
33 class WXDLLEXPORT wxWindow
;
34 class WXDLLEXPORT wxDC
;
35 class WXDLLEXPORT wxCheckListBox
;
38 class WXDLLEXPORT wxListBox
;
39 #endif // wxUSE_LISTBOX
42 class WXDLLEXPORT wxMenu
;
43 class WXDLLEXPORT wxMenuGeometryInfo
;
46 class WXDLLEXPORT wxScrollBar
;
49 class WXDLLEXPORT wxTextCtrl
;
53 class WXDLLEXPORT wxGauge
;
56 #include "wx/string.h"
57 #include "wx/gdicmn.h"
59 #include "wx/scrolbar.h" // for wxScrollBar::Element
61 // helper class used by wxMenu-related functions
62 class WXDLLEXPORT wxMenuGeometryInfo
65 // get the total size of the menu
66 virtual wxSize
GetSize() const = 0;
68 virtual ~wxMenuGeometryInfo();
71 // ----------------------------------------------------------------------------
72 // wxRenderer: abstract renderers interface
73 // ----------------------------------------------------------------------------
75 class WXDLLEXPORT wxRenderer
: public wxDelegateRendererNative
81 // draw the controls background
82 virtual void DrawBackground(wxDC
& dc
,
86 wxWindow
*window
= NULL
) = 0;
88 // draw the button surface
89 virtual void DrawButtonSurface(wxDC
& dc
,
93 { DrawBackground( dc
, col
, rect
, flags
); }
96 // draw the label inside the given rectangle with the specified alignment
97 // and optionally emphasize the character with the given index
98 virtual void DrawLabel(wxDC
& dc
,
99 const wxString
& label
,
102 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
104 wxRect
*rectBounds
= NULL
) = 0;
106 // same but also draw a bitmap if it is valid
107 virtual void DrawButtonLabel(wxDC
& dc
,
108 const wxString
& label
,
109 const wxBitmap
& image
,
112 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
114 wxRect
*rectBounds
= NULL
) = 0;
116 // draw the border and optionally return the rectangle containing the
117 // region inside the border
118 virtual void DrawBorder(wxDC
& dc
,
122 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
124 // draw text control border (I hate to have a separate method for this but
125 // it is needed to accommodate GTK+)
126 virtual void DrawTextBorder(wxDC
& dc
,
130 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
132 // draw push button border and return the rectangle left for the label
133 virtual void DrawButtonBorder(wxDC
& dc
,
136 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
138 // draw a horizontal line
139 virtual void DrawHorizontalLine(wxDC
& dc
,
140 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
142 // draw a vertical line
143 virtual void DrawVerticalLine(wxDC
& dc
,
144 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
146 // draw a frame with the label (horizontal alignment can be specified)
147 virtual void DrawFrame(wxDC
& dc
,
148 const wxString
& label
,
151 int alignment
= wxALIGN_LEFT
,
152 int indexAccel
= -1) = 0;
154 // draw an arrow in the given direction
155 virtual void DrawArrow(wxDC
& dc
,
160 // draw a scrollbar arrow (may be the same as arrow but may be not)
161 virtual void DrawScrollbarArrow(wxDC
& dc
,
166 // draw the scrollbar thumb
167 virtual void DrawScrollbarThumb(wxDC
& dc
,
168 wxOrientation orient
,
172 // draw a (part of) scrollbar shaft
173 virtual void DrawScrollbarShaft(wxDC
& dc
,
174 wxOrientation orient
,
178 // draw the rectangle in the corner between two scrollbars
179 virtual void DrawScrollCorner(wxDC
& dc
,
180 const wxRect
& rect
) = 0;
182 // draw an item of a wxListBox
183 virtual void DrawItem(wxDC
& dc
,
184 const wxString
& label
,
188 // draw an item of a wxCheckListBox
189 virtual void DrawCheckItem(wxDC
& dc
,
190 const wxString
& label
,
191 const wxBitmap
& bitmap
,
195 // draw a checkbutton (bitmap may be invalid to use default one)
196 virtual void DrawCheckButton(wxDC
& dc
,
197 const wxString
& label
,
198 const wxBitmap
& bitmap
,
201 wxAlignment align
= wxALIGN_LEFT
,
202 int indexAccel
= -1) = 0;
204 // draw a radio button
205 virtual void DrawRadioButton(wxDC
& dc
,
206 const wxString
& label
,
207 const wxBitmap
& bitmap
,
210 wxAlignment align
= wxALIGN_LEFT
,
211 int indexAccel
= -1) = 0;
214 // draw a toolbar button (label may be empty, bitmap may be invalid, if
215 // both conditions are true this function draws a separator)
216 virtual void DrawToolBarButton(wxDC
& dc
,
217 const wxString
& label
,
218 const wxBitmap
& bitmap
,
222 int tbarStyle
= 0) = 0;
223 #endif // wxUSE_TOOLBAR
225 // draw a (part of) line in the text control
226 virtual void DrawTextLine(wxDC
& dc
,
227 const wxString
& text
,
233 // draw a line wrap indicator
234 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
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;
247 // draw the slider shaft
248 virtual void DrawSliderShaft(wxDC
& dc
,
251 wxOrientation orient
,
254 wxRect
*rectShaft
= NULL
) = 0;
256 // draw the slider thumb
257 virtual void DrawSliderThumb(wxDC
& dc
,
259 wxOrientation orient
,
263 // draw the slider ticks
264 virtual void DrawSliderTicks(wxDC
& dc
,
267 wxOrientation orient
,
273 #endif // wxUSE_SLIDER
276 // draw a menu bar item
277 virtual void DrawMenuBarItem(wxDC
& dc
,
279 const wxString
& label
,
281 int indexAccel
= -1) = 0;
283 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
285 // the geometryInfo is calculated by GetMenuGeometry() function from below
286 virtual void DrawMenuItem(wxDC
& dc
,
288 const wxMenuGeometryInfo
& geometryInfo
,
289 const wxString
& label
,
290 const wxString
& accel
,
291 const wxBitmap
& bitmap
= wxNullBitmap
,
293 int indexAccel
= -1) = 0;
295 // draw a menu bar separator
296 virtual void DrawMenuSeparator(wxDC
& dc
,
298 const wxMenuGeometryInfo
& geomInfo
) = 0;
299 #endif // wxUSE_MENUS
302 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
303 // interpreted specially and means "draw the status bar grip" here
304 virtual void DrawStatusField(wxDC
& dc
,
306 const wxString
& label
,
307 int flags
= 0, int style
= 0) = 0;
308 #endif // wxUSE_STATUSBAR
310 // draw complete frame/dialog titlebar
311 virtual void DrawFrameTitleBar(wxDC
& dc
,
313 const wxString
& title
,
316 int specialButton
= 0,
317 int specialButtonFlags
= 0) = 0;
319 // draw frame borders
320 virtual void DrawFrameBorder(wxDC
& dc
,
324 // draw frame titlebar background
325 virtual void DrawFrameBackground(wxDC
& dc
,
330 virtual void DrawFrameTitle(wxDC
& dc
,
332 const wxString
& title
,
336 virtual void DrawFrameIcon(wxDC
& dc
,
341 // draw frame buttons
342 virtual void DrawFrameButton(wxDC
& dc
,
343 wxCoord x
, wxCoord y
,
350 // return the bitmaps to use for combobox button
351 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
353 wxBitmap
*bmpPressed
,
354 wxBitmap
*bmpDisabled
) = 0;
356 // geometry functions
357 // ------------------
359 // get the dimensions of the border: rect.x/y contain the width/height of
360 // the left/top side, width/heigh - of the right/bottom one
361 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
363 // the scrollbars may be drawn either inside the window border or outside
364 // it - this function is used to decide how to draw them
365 virtual bool AreScrollbarsInsideBorder() const = 0;
367 // adjust the size of the control of the given class: for most controls,
368 // this just takes into account the border, but for some (buttons, for
369 // example) it is more complicated - the result being, in any case, that
370 // the control looks "nice" if it uses the adjusted rectangle
371 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
375 // get the size of a scrollbar arrow
376 virtual wxSize
GetScrollbarArrowSize() const = 0;
378 // gets the bounding box for a scrollbar element for the given (by default
379 // - current) thumb position
380 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
381 wxScrollBar::Element elem
,
382 int thumbPos
= -1) const = 0;
384 // returns the size of the scrollbar shaft excluding the arrows
385 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
387 // returns one of wxHT_SCROLLBAR_XXX constants
388 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
389 const wxPoint
& pt
) const = 0;
391 // translate the scrollbar position (in logical units) into physical
392 // coordinate (in pixels) and the other way round
393 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
394 int thumbPos
= -1) = 0;
395 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
398 #endif // wxUSE_SCROLLBAR
400 // get the height of a listbox item from the base font height
401 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
403 // get the size of a checkbox/radio button bitmap
404 virtual wxSize
GetCheckBitmapSize() const = 0;
405 virtual wxSize
GetRadioBitmapSize() const = 0;
406 virtual wxCoord
GetCheckItemMargin() const = 0;
408 // get the standard size of a toolbar button and also return the size of
409 // a toolbar separator in the provided pointer
410 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
412 // get the margins between/around the toolbar buttons
413 virtual wxSize
GetToolBarMargin() const = 0;
416 // convert between text rectangle and client rectangle for text controls:
417 // the former is typicall smaller to leave margins around text
418 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
419 const wxRect
& rectText
) const = 0;
421 // extra space is for line indicators
422 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
423 const wxRect
& rectTotal
,
424 wxCoord
*extraSpaceBeyond
) const = 0;
425 #endif // wxUSE_TEXTCTRL
427 // get the overhang of a selected tab
428 virtual wxSize
GetTabIndent() const = 0;
430 // get the padding around the text in a tab
431 virtual wxSize
GetTabPadding() const = 0;
434 // get the default size of the slider in lesser dimension (i.e. height of a
435 // horizontal slider or width of a vertical one)
436 virtual wxCoord
GetSliderDim() const = 0;
438 // get the length of the slider ticks displayed along side slider
439 virtual wxCoord
GetSliderTickLen() const = 0;
441 // get the slider shaft rect from the total slider rect
442 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
444 wxOrientation orient
,
445 long style
= 0) const = 0;
447 // get the size of the slider thumb for the given total slider rect
448 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
450 wxOrientation orient
) const = 0;
451 #endif // wxUSE_SLIDER
453 // get the size of one progress bar step (in horz and vertical directions)
454 virtual wxSize
GetProgressBarStep() const = 0;
457 // get the size of rectangle to use in the menubar for the given text rect
458 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
460 // get the struct storing all layout info needed to draw all menu items
461 // (this can't be calculated for each item separately as they should be
464 // the returned pointer must be deleted by the caller
465 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
466 const wxMenu
& menu
) const = 0;
467 #endif // wxUSE_MENUS
470 // get the borders around the status bar fields (x and y fields of the
471 // return value) and also, optionally, the border between the fields
472 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
473 #endif // wxUSE_STATUSBAR
475 // get client area rectangle of top level window (i.e. subtract
476 // decorations from given rectangle)
477 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
479 // get size of whole top level window, given size of its client area size
480 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
482 // get the minimal size of top level window
483 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
485 // get titlebar icon size
486 virtual wxSize
GetFrameIconSize() const = 0;
488 // returns one of wxHT_TOPLEVEL_XXX constants
489 virtual int HitTestFrame(const wxRect
& rect
,
491 int flags
= 0) const = 0;
493 // virtual dtor for any base class
494 virtual ~wxRenderer();
498 // draw a frame around rectFrame rectangle but not touching the rectLabel
499 // one: this is used by DrawFrame()
500 void StandardDrawFrame(wxDC
& dc
,
501 const wxRect
& rectFrame
,
502 const wxRect
& rectLabel
);
504 // standard text line drawing: just use DrawText() and highlight the
506 static void StandardDrawTextLine(wxDC
& dc
,
507 const wxString
& text
,
509 int selStart
, int selEnd
,
513 // standard scrollbar hit testing: this assumes that it only has 2 arrows
514 // and a thumb, so the themes which have more complicated scrollbars (e.g.
515 // BeOS) can't use this method
516 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
517 wxScrollBar::Element elem
,
519 const wxSize
& sizeArrow
);
520 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
522 const wxSize
& sizeArrow
);
523 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
525 const wxSize
& sizeArrow
);
526 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
528 const wxSize
& sizeArrow
);
529 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
530 const wxSize
& sizeArrow
);
531 static void StandardScrollBarThumbSize(wxCoord lenBar
,
537 #endif // wxUSE_SCROLLBAR
541 // ----------------------------------------------------------------------------
542 // wxDelegateRenderer: it is impossible to inherit from any of standard
543 // renderers as their declarations are in private code, but you can use this
544 // class to override only some of the Draw() functions - all the other ones
545 // will be left to the original renderer
546 // ----------------------------------------------------------------------------
548 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
551 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
553 virtual void DrawBackground(wxDC
& dc
,
557 wxWindow
*window
= NULL
)
558 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
559 virtual void DrawLabel(wxDC
& dc
,
560 const wxString
& label
,
563 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
565 wxRect
*rectBounds
= NULL
)
566 { m_renderer
->DrawLabel(dc
, label
, rect
,
567 flags
, align
, indexAccel
, rectBounds
); }
568 virtual void DrawButtonLabel(wxDC
& dc
,
569 const wxString
& label
,
570 const wxBitmap
& image
,
573 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
575 wxRect
*rectBounds
= NULL
)
576 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
577 flags
, align
, indexAccel
, rectBounds
); }
578 virtual void DrawBorder(wxDC
& dc
,
582 wxRect
*rectIn
= (wxRect
*)NULL
)
583 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
584 virtual void DrawTextBorder(wxDC
& dc
,
588 wxRect
*rectIn
= (wxRect
*)NULL
)
589 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
590 virtual void DrawButtonBorder(wxDC
& dc
,
593 wxRect
*rectIn
= (wxRect
*)NULL
)
594 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
595 virtual void DrawFrame(wxDC
& dc
,
596 const wxString
& label
,
599 int align
= wxALIGN_LEFT
,
601 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
602 virtual void DrawHorizontalLine(wxDC
& dc
,
603 wxCoord y
, wxCoord x1
, wxCoord x2
)
604 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
605 virtual void DrawVerticalLine(wxDC
& dc
,
606 wxCoord x
, wxCoord y1
, wxCoord y2
)
607 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
608 virtual void DrawArrow(wxDC
& dc
,
612 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
613 virtual void DrawScrollbarArrow(wxDC
& dc
,
617 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
618 virtual void DrawScrollbarThumb(wxDC
& dc
,
619 wxOrientation orient
,
622 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
623 virtual void DrawScrollbarShaft(wxDC
& dc
,
624 wxOrientation orient
,
627 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
628 virtual void DrawScrollCorner(wxDC
& dc
,
630 { m_renderer
->DrawScrollCorner(dc
, rect
); }
631 virtual void DrawItem(wxDC
& dc
,
632 const wxString
& label
,
635 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
636 virtual void DrawCheckItem(wxDC
& dc
,
637 const wxString
& label
,
638 const wxBitmap
& bitmap
,
641 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
642 virtual void DrawCheckButton(wxDC
& dc
,
643 const wxString
& label
,
644 const wxBitmap
& bitmap
,
647 wxAlignment align
= wxALIGN_LEFT
,
649 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
650 flags
, align
, indexAccel
); }
651 virtual void DrawRadioButton(wxDC
& dc
,
652 const wxString
& label
,
653 const wxBitmap
& bitmap
,
656 wxAlignment align
= wxALIGN_LEFT
,
658 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
659 flags
, align
, indexAccel
); }
661 virtual void DrawToolBarButton(wxDC
& dc
,
662 const wxString
& label
,
663 const wxBitmap
& bitmap
,
668 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
669 #endif // wxUSE_TOOLBAR
670 virtual void DrawTextLine(wxDC
& dc
,
671 const wxString
& text
,
676 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
677 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
678 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
680 virtual void DrawTab(wxDC
& dc
,
683 const wxString
& label
,
684 const wxBitmap
& bitmap
= wxNullBitmap
,
687 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
691 virtual void DrawSliderShaft(wxDC
& dc
,
694 wxOrientation orient
,
697 wxRect
*rectShaft
= NULL
)
698 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
699 virtual void DrawSliderThumb(wxDC
& dc
,
701 wxOrientation orient
,
704 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
705 virtual void DrawSliderTicks(wxDC
& dc
,
708 wxOrientation orient
,
711 int WXUNUSED(step
) = 1,
714 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
715 start
, end
, start
, flags
, style
); }
716 #endif // wxUSE_SLIDER
719 virtual void DrawMenuBarItem(wxDC
& dc
,
721 const wxString
& label
,
724 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
725 virtual void DrawMenuItem(wxDC
& dc
,
727 const wxMenuGeometryInfo
& gi
,
728 const wxString
& label
,
729 const wxString
& accel
,
730 const wxBitmap
& bitmap
= wxNullBitmap
,
733 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
734 bitmap
, flags
, indexAccel
); }
735 virtual void DrawMenuSeparator(wxDC
& dc
,
737 const wxMenuGeometryInfo
& geomInfo
)
738 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
739 #endif // wxUSE_MENUS
742 virtual void DrawStatusField(wxDC
& dc
,
744 const wxString
& label
,
745 int flags
= 0, int style
= 0)
746 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
747 #endif // wxUSE_STATUSBAR
749 virtual void DrawFrameTitleBar(wxDC
& dc
,
751 const wxString
& title
,
754 int specialButton
= 0,
755 int specialButtonFlag
= 0)
756 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
757 specialButton
, specialButtonFlag
); }
758 virtual void DrawFrameBorder(wxDC
& dc
,
761 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
762 virtual void DrawFrameBackground(wxDC
& dc
,
765 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
766 virtual void DrawFrameTitle(wxDC
& dc
,
768 const wxString
& title
,
770 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
771 virtual void DrawFrameIcon(wxDC
& dc
,
775 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
776 virtual void DrawFrameButton(wxDC
& dc
,
777 wxCoord x
, wxCoord y
,
780 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
782 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
784 wxBitmap
*bmpPressed
,
785 wxBitmap
*bmpDisabled
)
786 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
787 bmpPressed
, bmpDisabled
); }
789 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
790 { m_renderer
->AdjustSize(size
, window
); }
791 virtual wxRect
GetBorderDimensions(wxBorder border
) const
792 { return m_renderer
->GetBorderDimensions(border
); }
793 virtual bool AreScrollbarsInsideBorder() const
794 { return m_renderer
->AreScrollbarsInsideBorder(); }
797 virtual wxSize
GetScrollbarArrowSize() const
798 { return m_renderer
->GetScrollbarArrowSize(); }
799 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
800 wxScrollBar::Element elem
,
801 int thumbPos
= -1) const
802 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
803 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
804 { return m_renderer
->GetScrollbarSize(scrollbar
); }
805 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
806 const wxPoint
& pt
) const
807 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
808 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
810 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
811 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
813 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
814 #endif // wxUSE_SCROLLBAR
816 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
817 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
818 virtual wxSize
GetCheckBitmapSize() const
819 { return m_renderer
->GetCheckBitmapSize(); }
820 virtual wxSize
GetRadioBitmapSize() const
821 { return m_renderer
->GetRadioBitmapSize(); }
822 virtual wxCoord
GetCheckItemMargin() const
823 { return m_renderer
->GetCheckItemMargin(); }
825 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
826 { return m_renderer
->GetToolBarButtonSize(separator
); }
827 virtual wxSize
GetToolBarMargin() const
828 { return m_renderer
->GetToolBarMargin(); }
831 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
832 const wxRect
& rect
) const
833 { return m_renderer
->GetTextTotalArea(text
, rect
); }
834 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
836 wxCoord
*extraSpaceBeyond
) const
837 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
838 #endif // wxUSE_TEXTCTRL
840 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
841 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
844 virtual wxCoord
GetSliderDim() const
845 { return m_renderer
->GetSliderDim(); }
846 virtual wxCoord
GetSliderTickLen() const
847 { return m_renderer
->GetSliderTickLen(); }
849 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
851 wxOrientation orient
,
852 long style
= 0) const
853 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
854 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
856 wxOrientation orient
) const
857 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
858 #endif // wxUSE_SLIDER
860 virtual wxSize
GetProgressBarStep() const
861 { return m_renderer
->GetProgressBarStep(); }
864 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
865 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
866 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
867 const wxMenu
& menu
) const
868 { return m_renderer
->GetMenuGeometry(win
, menu
); }
869 #endif // wxUSE_MENUS
872 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
873 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
874 #endif // wxUSE_STATUSBAR
875 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
876 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
877 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
878 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
879 virtual wxSize
GetFrameMinSize(int flags
) const
880 { return m_renderer
->GetFrameMinSize(flags
); }
881 virtual wxSize
GetFrameIconSize() const
882 { return m_renderer
->GetFrameIconSize(); }
883 virtual int HitTestFrame(const wxRect
& rect
,
886 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
888 virtual void DrawHeaderButton(wxWindow
*win
,
892 { m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
); }
893 virtual void DrawTreeItemButton(wxWindow
*win
,
897 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
900 wxRenderer
*m_renderer
;
903 // ----------------------------------------------------------------------------
904 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
906 // ----------------------------------------------------------------------------
908 class WXDLLEXPORT wxControlRenderer
911 // create a renderer for this dc with this "fundamental" renderer
912 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
915 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
916 wxCoord marginX
= 0, wxCoord marginY
= 0);
918 void DrawItems(const wxListBox
*listbox
,
919 size_t itemFirst
, size_t itemLast
);
920 #endif // wxUSE_LISTBOX
921 #if wxUSE_CHECKLISTBOX
922 void DrawCheckItems(const wxCheckListBox
*listbox
,
923 size_t itemFirst
, size_t itemLast
);
924 #endif // wxUSE_CHECKLISTBOX
925 void DrawButtonBorder();
926 // the line must be either horizontal or vertical
927 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
929 void DrawBitmap(const wxBitmap
& bitmap
);
930 void DrawBackgroundBitmap();
931 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
933 void DrawProgressBar(const wxGauge
*gauge
);
934 #endif // wxUSE_GAUGE
937 wxWindow
*GetWindow() const { return m_window
; }
938 wxRenderer
*GetRenderer() const { return m_renderer
; }
940 wxDC
& GetDC() { return m_dc
; }
942 const wxRect
& GetRect() const { return m_rect
; }
943 wxRect
& GetRect() { return m_rect
; }
946 static void DrawBitmap(wxDC
&dc
,
947 const wxBitmap
& bitmap
,
949 int alignment
= wxALIGN_CENTRE
|
950 wxALIGN_CENTRE_VERTICAL
,
951 wxStretch stretch
= wxSTRETCH_NOT
);
956 // common part of DrawItems() and DrawCheckItems()
957 void DoDrawItems(const wxListBox
*listbox
,
958 size_t itemFirst
, size_t itemLast
,
959 bool isCheckLbox
= false);
960 #endif // wxUSE_LISTBOX
963 wxRenderer
*m_renderer
;
968 #endif // _WX_UNIV_RENDERER_H_