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 ///////////////////////////////////////////////////////////////////////////////
13 wxRenderer class is used to draw all wxWindows controls. This is an ABC and
14 the look of the application is determined by the concrete derivation of
15 wxRenderer used in the program.
17 It also contains a few static methods which may be used by the concrete
18 renderers and provide the functionality which is often similar or identical
19 in all renderers (using inheritance here would be more restrictive as the
20 given concrete renderer may need an arbitrary subset of the base class
23 Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and
24 includes the latters functionality (which it may delegate to the generic
25 implementation of the latter or reimplement itself).
28 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
29 #pragma interface "renderer.h"
32 #ifndef _WX_UNIV_RENDERER_H_
33 #define _WX_UNIV_RENDERER_H_
35 #include "wx/renderer.h"
37 class WXDLLEXPORT wxDC
;
38 class WXDLLEXPORT wxCheckListBox
;
39 class WXDLLEXPORT wxListBox
;
40 class WXDLLEXPORT wxMenu
;
41 class WXDLLEXPORT wxMenuGeometryInfo
;
42 class WXDLLEXPORT wxScrollBar
;
43 class WXDLLEXPORT wxTextCtrl
;
44 class WXDLLEXPORT wxWindow
;
46 class WXDLLEXPORT wxGauge
;
49 #include "wx/string.h"
50 #include "wx/gdicmn.h"
52 #include "wx/scrolbar.h" // for wxScrollBar::Element
54 // helper class used by wxMenu-related functions
55 class WXDLLEXPORT wxMenuGeometryInfo
58 // get the total size of the menu
59 virtual wxSize
GetSize() const = 0;
61 virtual ~wxMenuGeometryInfo();
64 // ----------------------------------------------------------------------------
65 // wxRenderer: abstract renderers interface
66 // ----------------------------------------------------------------------------
68 class WXDLLEXPORT wxRenderer
: public wxDelegateRendererNative
74 // draw the controls background
75 virtual void DrawBackground(wxDC
& dc
,
79 wxWindow
*window
= NULL
) = 0;
81 // draw the button surface
82 virtual void DrawButtonSurface(wxDC
& dc
,
86 { DrawBackground( dc
, col
, rect
, flags
); }
89 // draw the label inside the given rectangle with the specified alignment
90 // and optionally emphasize the character with the given index
91 virtual void DrawLabel(wxDC
& dc
,
92 const wxString
& label
,
95 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
97 wxRect
*rectBounds
= NULL
) = 0;
99 // same but also draw a bitmap if it is valid
100 virtual void DrawButtonLabel(wxDC
& dc
,
101 const wxString
& label
,
102 const wxBitmap
& image
,
105 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
107 wxRect
*rectBounds
= NULL
) = 0;
109 // draw the border and optionally return the rectangle containing the
110 // region inside the border
111 virtual void DrawBorder(wxDC
& dc
,
115 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
117 // draw text control border (I hate to have a separate method for this but
118 // it is needed to accomodate GTK+)
119 virtual void DrawTextBorder(wxDC
& dc
,
123 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
125 // draw push button border and return the rectangle left for the label
126 virtual void DrawButtonBorder(wxDC
& dc
,
129 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
131 // draw a horizontal line
132 virtual void DrawHorizontalLine(wxDC
& dc
,
133 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
135 // draw a vertical line
136 virtual void DrawVerticalLine(wxDC
& dc
,
137 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
139 // draw a frame with the label (horizontal alignment can be specified)
140 virtual void DrawFrame(wxDC
& dc
,
141 const wxString
& label
,
144 int alignment
= wxALIGN_LEFT
,
145 int indexAccel
= -1) = 0;
147 // draw an arrow in the given direction
148 virtual void DrawArrow(wxDC
& dc
,
153 // draw a scrollbar arrow (may be the same as arrow but may be not)
154 virtual void DrawScrollbarArrow(wxDC
& dc
,
159 // draw the scrollbar thumb
160 virtual void DrawScrollbarThumb(wxDC
& dc
,
161 wxOrientation orient
,
165 // draw a (part of) scrollbar shaft
166 virtual void DrawScrollbarShaft(wxDC
& dc
,
167 wxOrientation orient
,
171 // draw the rectangle in the corner between two scrollbars
172 virtual void DrawScrollCorner(wxDC
& dc
,
173 const wxRect
& rect
) = 0;
175 // draw an item of a wxListBox
176 virtual void DrawItem(wxDC
& dc
,
177 const wxString
& label
,
181 // draw an item of a wxCheckListBox
182 virtual void DrawCheckItem(wxDC
& dc
,
183 const wxString
& label
,
184 const wxBitmap
& bitmap
,
188 // draw a checkbutton (bitmap may be invalid to use default one)
189 virtual void DrawCheckButton(wxDC
& dc
,
190 const wxString
& label
,
191 const wxBitmap
& bitmap
,
194 wxAlignment align
= wxALIGN_LEFT
,
195 int indexAccel
= -1) = 0;
197 // draw a radio button
198 virtual void DrawRadioButton(wxDC
& dc
,
199 const wxString
& label
,
200 const wxBitmap
& bitmap
,
203 wxAlignment align
= wxALIGN_LEFT
,
204 int indexAccel
= -1) = 0;
206 // draw a toolbar button (label may be empty, bitmap may be invalid, if
207 // both conditions are true this function draws a separator)
208 virtual void DrawToolBarButton(wxDC
& dc
,
209 const wxString
& label
,
210 const wxBitmap
& bitmap
,
215 // draw a (part of) line in the text control
216 virtual void DrawTextLine(wxDC
& dc
,
217 const wxString
& text
,
223 // draw a line wrap indicator
224 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
226 // draw a notebook tab
227 virtual void DrawTab(wxDC
& dc
,
230 const wxString
& label
,
231 const wxBitmap
& bitmap
= wxNullBitmap
,
233 int indexAccel
= -1) = 0;
235 // draw the slider shaft
236 virtual void DrawSliderShaft(wxDC
& dc
,
239 wxOrientation orient
,
242 wxRect
*rectShaft
= NULL
) = 0;
244 // draw the slider thumb
245 virtual void DrawSliderThumb(wxDC
& dc
,
247 wxOrientation orient
,
251 // draw the slider ticks
252 virtual void DrawSliderTicks(wxDC
& dc
,
255 wxOrientation orient
,
262 // draw a menu bar item
263 virtual void DrawMenuBarItem(wxDC
& dc
,
265 const wxString
& label
,
267 int indexAccel
= -1) = 0;
269 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
271 // the geometryInfo is calculated by GetMenuGeometry() function from below
272 virtual void DrawMenuItem(wxDC
& dc
,
274 const wxMenuGeometryInfo
& geometryInfo
,
275 const wxString
& label
,
276 const wxString
& accel
,
277 const wxBitmap
& bitmap
= wxNullBitmap
,
279 int indexAccel
= -1) = 0;
281 // draw a menu bar separator
282 virtual void DrawMenuSeparator(wxDC
& dc
,
284 const wxMenuGeometryInfo
& geomInfo
) = 0;
286 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
287 // interpreted specially and means "draw the status bar grip" here
288 virtual void DrawStatusField(wxDC
& dc
,
290 const wxString
& label
,
293 // draw complete frame/dialog titlebar
294 virtual void DrawFrameTitleBar(wxDC
& dc
,
296 const wxString
& title
,
299 int specialButton
= 0,
300 int specialButtonFlags
= 0) = 0;
302 // draw frame borders
303 virtual void DrawFrameBorder(wxDC
& dc
,
307 // draw frame titlebar background
308 virtual void DrawFrameBackground(wxDC
& dc
,
313 virtual void DrawFrameTitle(wxDC
& dc
,
315 const wxString
& title
,
319 virtual void DrawFrameIcon(wxDC
& dc
,
324 // draw frame buttons
325 virtual void DrawFrameButton(wxDC
& dc
,
326 wxCoord x
, wxCoord y
,
333 // return the bitmaps to use for combobox button
334 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
336 wxBitmap
*bmpPressed
,
337 wxBitmap
*bmpDisabled
) = 0;
339 // geometry functions
340 // ------------------
342 // get the dimensions of the border: rect.x/y contain the width/height of
343 // the left/top side, width/heigh - of the right/bottom one
344 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
346 // the scrollbars may be drawn either inside the window border or outside
347 // it - this function is used to decide how to draw them
348 virtual bool AreScrollbarsInsideBorder() const = 0;
350 // adjust the size of the control of the given class: for most controls,
351 // this just takes into account the border, but for some (buttons, for
352 // example) it is more complicated - the result being, in any case, that
353 // the control looks "nice" if it uses the adjusted rectangle
354 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
356 // get the size of a scrollbar arrow
357 virtual wxSize
GetScrollbarArrowSize() const = 0;
359 // gets the bounding box for a scrollbar element for the given (by default
360 // - current) thumb position
361 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
362 wxScrollBar::Element elem
,
363 int thumbPos
= -1) const = 0;
365 // returns the size of the scrollbar shaft excluding the arrows
366 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
368 // returns one of wxHT_SCROLLBAR_XXX constants
369 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
370 const wxPoint
& pt
) const = 0;
372 // translate the scrollbar position (in logical units) into physical
373 // coordinate (in pixels) and the other way round
374 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
375 int thumbPos
= -1) = 0;
376 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
379 // get the height of a listbox item from the base font height
380 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
382 // get the size of a checkbox/radio button bitmap
383 virtual wxSize
GetCheckBitmapSize() const = 0;
384 virtual wxSize
GetRadioBitmapSize() const = 0;
385 virtual wxCoord
GetCheckItemMargin() const = 0;
387 // get the standard size of a toolbar button and also return the size of
388 // a toolbar separator in the provided pointer
389 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
391 // get the margins between/around the toolbar buttons
392 virtual wxSize
GetToolBarMargin() const = 0;
394 // convert between text rectangle and client rectangle for text controls:
395 // the former is typicall smaller to leave margins around text
396 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
397 const wxRect
& rectText
) const = 0;
399 // extra space is for line indicators
400 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
401 const wxRect
& rectTotal
,
402 wxCoord
*extraSpaceBeyond
) const = 0;
404 // get the overhang of a selected tab
405 virtual wxSize
GetTabIndent() const = 0;
407 // get the padding around the text in a tab
408 virtual wxSize
GetTabPadding() const = 0;
410 // get the default size of the slider in lesser dimension (i.e. height of a
411 // horizontal slider or width of a vertical one)
412 virtual wxCoord
GetSliderDim() const = 0;
414 // get the length of the slider ticks displayed along side slider
415 virtual wxCoord
GetSliderTickLen() const = 0;
417 // get the slider shaft rect from the total slider rect
418 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
420 wxOrientation orient
,
421 long style
= 0) const = 0;
423 // get the size of the slider thumb for the given total slider rect
424 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
426 wxOrientation orient
) const = 0;
428 // get the size of one progress bar step (in horz and vertical directions)
429 virtual wxSize
GetProgressBarStep() const = 0;
431 // get the size of rectangle to use in the menubar for the given text rect
432 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
434 // get the struct storing all layout info needed to draw all menu items
435 // (this can't be calculated for each item separately as they should be
438 // the returned pointer must be deleted by the caller
439 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
440 const wxMenu
& menu
) const = 0;
442 // get the borders around the status bar fields (x and y fields of the
443 // return value) and also, optionally, the border between the fields
444 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
446 // get client area rectangle of top level window (i.e. subtract
447 // decorations from given rectangle)
448 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
450 // get size of whole top level window, given size of its client area size
451 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
453 // get the minimal size of top level window
454 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
456 // get titlebar icon size
457 virtual wxSize
GetFrameIconSize() const = 0;
459 // returns one of wxHT_TOPLEVEL_XXX constants
460 virtual int HitTestFrame(const wxRect
& rect
,
462 int flags
= 0) const = 0;
464 // virtual dtor for any base class
465 virtual ~wxRenderer();
469 // draw a frame around rectFrame rectangle but not touching the rectLabel
470 // one: this is used by DrawFrame()
471 void StandardDrawFrame(wxDC
& dc
,
472 const wxRect
& rectFrame
,
473 const wxRect
& rectLabel
);
475 // standard text line drawing: just use DrawText() and highlight the
477 static void StandardDrawTextLine(wxDC
& dc
,
478 const wxString
& text
,
480 int selStart
, int selEnd
,
483 // standard scrollbar hit testing: this assumes that it only has 2 arrows
484 // and a thumb, so the themes which have more complicated scrollbars (e.g.
485 // BeOS) can't use this method
486 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
487 wxScrollBar::Element elem
,
489 const wxSize
& sizeArrow
);
490 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
492 const wxSize
& sizeArrow
);
493 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
495 const wxSize
& sizeArrow
);
496 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
498 const wxSize
& sizeArrow
);
499 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
500 const wxSize
& sizeArrow
);
501 static void StandardScrollBarThumbSize(wxCoord lenBar
,
509 // ----------------------------------------------------------------------------
510 // wxDelegateRenderer: it is impossible to inherit from any of standard
511 // renderers as their declarations are in private code, but you can use this
512 // class to override only some of the Draw() functions - all the other ones
513 // will be left to the original renderer
514 // ----------------------------------------------------------------------------
516 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
519 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
521 virtual void DrawBackground(wxDC
& dc
,
525 wxWindow
*window
= NULL
)
526 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
527 virtual void DrawLabel(wxDC
& dc
,
528 const wxString
& label
,
531 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
533 wxRect
*rectBounds
= NULL
)
534 { m_renderer
->DrawLabel(dc
, label
, rect
,
535 flags
, align
, indexAccel
, rectBounds
); }
536 virtual void DrawButtonLabel(wxDC
& dc
,
537 const wxString
& label
,
538 const wxBitmap
& image
,
541 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
543 wxRect
*rectBounds
= NULL
)
544 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
545 flags
, align
, indexAccel
, rectBounds
); }
546 virtual void DrawBorder(wxDC
& dc
,
550 wxRect
*rectIn
= (wxRect
*)NULL
)
551 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
552 virtual void DrawTextBorder(wxDC
& dc
,
556 wxRect
*rectIn
= (wxRect
*)NULL
)
557 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
558 virtual void DrawButtonBorder(wxDC
& dc
,
561 wxRect
*rectIn
= (wxRect
*)NULL
)
562 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
563 virtual void DrawFrame(wxDC
& dc
,
564 const wxString
& label
,
567 int align
= wxALIGN_LEFT
,
569 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
570 virtual void DrawHorizontalLine(wxDC
& dc
,
571 wxCoord y
, wxCoord x1
, wxCoord x2
)
572 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
573 virtual void DrawVerticalLine(wxDC
& dc
,
574 wxCoord x
, wxCoord y1
, wxCoord y2
)
575 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
576 virtual void DrawArrow(wxDC
& dc
,
580 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
581 virtual void DrawScrollbarArrow(wxDC
& dc
,
585 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
586 virtual void DrawScrollbarThumb(wxDC
& dc
,
587 wxOrientation orient
,
590 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
591 virtual void DrawScrollbarShaft(wxDC
& dc
,
592 wxOrientation orient
,
595 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
596 virtual void DrawScrollCorner(wxDC
& dc
,
598 { m_renderer
->DrawScrollCorner(dc
, rect
); }
599 virtual void DrawItem(wxDC
& dc
,
600 const wxString
& label
,
603 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
604 virtual void DrawCheckItem(wxDC
& dc
,
605 const wxString
& label
,
606 const wxBitmap
& bitmap
,
609 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
610 virtual void DrawCheckButton(wxDC
& dc
,
611 const wxString
& label
,
612 const wxBitmap
& bitmap
,
615 wxAlignment align
= wxALIGN_LEFT
,
617 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
618 flags
, align
, indexAccel
); }
619 virtual void DrawRadioButton(wxDC
& dc
,
620 const wxString
& label
,
621 const wxBitmap
& bitmap
,
624 wxAlignment align
= wxALIGN_LEFT
,
626 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
627 flags
, align
, indexAccel
); }
628 virtual void DrawToolBarButton(wxDC
& dc
,
629 const wxString
& label
,
630 const wxBitmap
& bitmap
,
634 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
); }
635 virtual void DrawTextLine(wxDC
& dc
,
636 const wxString
& text
,
641 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
642 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
643 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
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
); }
654 virtual void DrawSliderShaft(wxDC
& dc
,
657 wxOrientation orient
,
660 wxRect
*rectShaft
= NULL
)
661 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
662 virtual void DrawSliderThumb(wxDC
& dc
,
664 wxOrientation orient
,
667 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
668 virtual void DrawSliderTicks(wxDC
& dc
,
671 wxOrientation orient
,
674 int WXUNUSED(step
) = 1,
677 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
678 start
, end
, start
, flags
, style
); }
680 virtual void DrawMenuBarItem(wxDC
& dc
,
682 const wxString
& label
,
685 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
686 virtual void DrawMenuItem(wxDC
& dc
,
688 const wxMenuGeometryInfo
& gi
,
689 const wxString
& label
,
690 const wxString
& accel
,
691 const wxBitmap
& bitmap
= wxNullBitmap
,
694 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
695 bitmap
, flags
, indexAccel
); }
696 virtual void DrawMenuSeparator(wxDC
& dc
,
698 const wxMenuGeometryInfo
& geomInfo
)
699 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
701 virtual void DrawStatusField(wxDC
& dc
,
703 const wxString
& label
,
705 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
); }
707 virtual void DrawFrameTitleBar(wxDC
& dc
,
709 const wxString
& title
,
712 int specialButton
= 0,
713 int specialButtonFlag
= 0)
714 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
715 specialButton
, specialButtonFlag
); }
716 virtual void DrawFrameBorder(wxDC
& dc
,
719 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
720 virtual void DrawFrameBackground(wxDC
& dc
,
723 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
724 virtual void DrawFrameTitle(wxDC
& dc
,
726 const wxString
& title
,
728 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
729 virtual void DrawFrameIcon(wxDC
& dc
,
733 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
734 virtual void DrawFrameButton(wxDC
& dc
,
735 wxCoord x
, wxCoord y
,
738 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
740 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
742 wxBitmap
*bmpPressed
,
743 wxBitmap
*bmpDisabled
)
744 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
745 bmpPressed
, bmpDisabled
); }
747 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
748 { m_renderer
->AdjustSize(size
, window
); }
749 virtual wxRect
GetBorderDimensions(wxBorder border
) const
750 { return m_renderer
->GetBorderDimensions(border
); }
751 virtual bool AreScrollbarsInsideBorder() const
752 { return m_renderer
->AreScrollbarsInsideBorder(); }
754 virtual wxSize
GetScrollbarArrowSize() const
755 { return m_renderer
->GetScrollbarArrowSize(); }
756 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
757 wxScrollBar::Element elem
,
758 int thumbPos
= -1) const
759 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
760 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
761 { return m_renderer
->GetScrollbarSize(scrollbar
); }
762 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
763 const wxPoint
& pt
) const
764 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
765 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
767 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
768 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
770 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
771 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
772 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
773 virtual wxSize
GetCheckBitmapSize() const
774 { return m_renderer
->GetCheckBitmapSize(); }
775 virtual wxSize
GetRadioBitmapSize() const
776 { return m_renderer
->GetRadioBitmapSize(); }
777 virtual wxCoord
GetCheckItemMargin() const
778 { 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(); }
785 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
786 const wxRect
& rect
) const
787 { return m_renderer
->GetTextTotalArea(text
, rect
); }
788 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
790 wxCoord
*extraSpaceBeyond
) const
791 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
793 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
794 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
796 virtual wxCoord
GetSliderDim() const
797 { return m_renderer
->GetSliderDim(); }
798 virtual wxCoord
GetSliderTickLen() const
799 { return m_renderer
->GetSliderTickLen(); }
800 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
802 wxOrientation orient
,
803 long style
= 0) const
804 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
805 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
807 wxOrientation orient
) const
808 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
809 virtual wxSize
GetProgressBarStep() const
810 { return m_renderer
->GetProgressBarStep(); }
811 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
812 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
813 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
814 const wxMenu
& menu
) const
815 { return m_renderer
->GetMenuGeometry(win
, menu
); }
816 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
817 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
818 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
819 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
820 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
821 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
822 virtual wxSize
GetFrameMinSize(int flags
) const
823 { return m_renderer
->GetFrameMinSize(flags
); }
824 virtual wxSize
GetFrameIconSize() const
825 { return m_renderer
->GetFrameIconSize(); }
826 virtual int HitTestFrame(const wxRect
& rect
,
829 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
831 virtual void DrawHeaderButton(wxWindow
*win
,
835 { m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
); }
836 virtual void DrawTreeItemButton(wxWindow
*win
,
840 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
843 wxRenderer
*m_renderer
;
846 // ----------------------------------------------------------------------------
847 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
849 // ----------------------------------------------------------------------------
851 class WXDLLEXPORT wxControlRenderer
854 // create a renderer for this dc with this "fundamental" renderer
855 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
858 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
859 wxCoord marginX
= 0, wxCoord marginY
= 0);
861 void DrawItems(const wxListBox
*listbox
,
862 size_t itemFirst
, size_t itemLast
);
863 #endif // wxUSE_LISTBOX
864 #if wxUSE_CHECKLISTBOX
865 void DrawCheckItems(const wxCheckListBox
*listbox
,
866 size_t itemFirst
, size_t itemLast
);
867 #endif // wxUSE_CHECKLISTBOX
868 void DrawButtonBorder();
869 // the line must be either horizontal or vertical
870 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
872 void DrawBitmap(const wxBitmap
& bitmap
);
873 void DrawBackgroundBitmap();
874 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
876 void DrawProgressBar(const wxGauge
*gauge
);
877 #endif // wxUSE_GAUGE
880 wxWindow
*GetWindow() const { return m_window
; }
881 wxRenderer
*GetRenderer() const { return m_renderer
; }
883 wxDC
& GetDC() { return m_dc
; }
885 const wxRect
& GetRect() const { return m_rect
; }
886 wxRect
& GetRect() { return m_rect
; }
889 static void DrawBitmap(wxDC
&dc
,
890 const wxBitmap
& bitmap
,
892 int alignment
= wxALIGN_CENTRE
|
893 wxALIGN_CENTRE_VERTICAL
,
894 wxStretch stretch
= wxSTRETCH_NOT
);
897 // common part of DrawItems() and DrawCheckItems()
898 void DoDrawItems(const wxListBox
*listbox
,
899 size_t itemFirst
, size_t itemLast
,
900 bool isCheckLbox
= FALSE
);
903 wxRenderer
*m_renderer
;
908 #endif // _WX_UNIV_RENDERER_H_