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
25 #pragma interface "renderer.h"
28 #ifndef _WX_UNIV_RENDERER_H_
29 #define _WX_UNIV_RENDERER_H_
31 class WXDLLEXPORT wxDC
;
32 class WXDLLEXPORT wxCheckListBox
;
33 class WXDLLEXPORT wxListBox
;
34 class WXDLLEXPORT wxMenu
;
35 class WXDLLEXPORT wxMenuGeometryInfo
;
36 class WXDLLEXPORT wxScrollBar
;
37 class WXDLLEXPORT wxTextCtrl
;
38 class WXDLLEXPORT wxWindow
;
40 class WXDLLEXPORT wxGauge
;
43 #include "wx/string.h"
44 #include "wx/gdicmn.h"
46 #include "wx/scrolbar.h" // for wxScrollBar::Element
48 // helper class used by wxMenu-related functions
49 class WXDLLEXPORT wxMenuGeometryInfo
52 // get the total size of the menu
53 virtual wxSize
GetSize() const = 0;
55 virtual ~wxMenuGeometryInfo();
58 // ----------------------------------------------------------------------------
59 // wxRenderer: abstract renderers interface
60 // ----------------------------------------------------------------------------
62 class WXDLLEXPORT wxRenderer
68 // draw the controls background
69 virtual void DrawBackground(wxDC
& dc
,
73 wxWindow
*window
= NULL
) = 0;
75 // draw the button surface
76 virtual void DrawButtonSurface(wxDC
& dc
,
80 { DrawBackground( dc
, col
, rect
, flags
); }
83 // draw the label inside the given rectangle with the specified alignment
84 // and optionally emphasize the character with the given index
85 virtual void DrawLabel(wxDC
& dc
,
86 const wxString
& label
,
89 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
91 wxRect
*rectBounds
= NULL
) = 0;
93 // same but also draw a bitmap if it is valid
94 virtual void DrawButtonLabel(wxDC
& dc
,
95 const wxString
& label
,
96 const wxBitmap
& image
,
99 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
101 wxRect
*rectBounds
= NULL
) = 0;
103 // draw the border and optionally return the rectangle containing the
104 // region inside the border
105 virtual void DrawBorder(wxDC
& dc
,
109 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
111 // draw text control border (I hate to have a separate method for this but
112 // it is needed to accomodate GTK+)
113 virtual void DrawTextBorder(wxDC
& dc
,
117 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
119 // draw push button border and return the rectangle left for the label
120 virtual void DrawButtonBorder(wxDC
& dc
,
123 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
125 // draw a horizontal line
126 virtual void DrawHorizontalLine(wxDC
& dc
,
127 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
129 // draw a vertical line
130 virtual void DrawVerticalLine(wxDC
& dc
,
131 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
133 // draw a frame with the label (horizontal alignment can be specified)
134 virtual void DrawFrame(wxDC
& dc
,
135 const wxString
& label
,
138 int alignment
= wxALIGN_LEFT
,
139 int indexAccel
= -1) = 0;
141 // draw an arrow in the given direction
142 virtual void DrawArrow(wxDC
& dc
,
147 // draw a scrollbar arrow (may be the same as arrow but may be not)
148 virtual void DrawScrollbarArrow(wxDC
& dc
,
153 // draw the scrollbar thumb
154 virtual void DrawScrollbarThumb(wxDC
& dc
,
155 wxOrientation orient
,
159 // draw a (part of) scrollbar shaft
160 virtual void DrawScrollbarShaft(wxDC
& dc
,
161 wxOrientation orient
,
165 // draw the rectangle in the corner between two scrollbars
166 virtual void DrawScrollCorner(wxDC
& dc
,
167 const wxRect
& rect
) = 0;
169 // draw an item of a wxListBox
170 virtual void DrawItem(wxDC
& dc
,
171 const wxString
& label
,
175 // draw an item of a wxCheckListBox
176 virtual void DrawCheckItem(wxDC
& dc
,
177 const wxString
& label
,
178 const wxBitmap
& bitmap
,
182 // draw a checkbutton (bitmap may be invalid to use default one)
183 virtual void DrawCheckButton(wxDC
& dc
,
184 const wxString
& label
,
185 const wxBitmap
& bitmap
,
188 wxAlignment align
= wxALIGN_LEFT
,
189 int indexAccel
= -1) = 0;
191 // draw a radio button
192 virtual void DrawRadioButton(wxDC
& dc
,
193 const wxString
& label
,
194 const wxBitmap
& bitmap
,
197 wxAlignment align
= wxALIGN_LEFT
,
198 int indexAccel
= -1) = 0;
200 // draw a toolbar button (label may be empty, bitmap may be invalid, if
201 // both conditions are true this function draws a separator)
202 virtual void DrawToolBarButton(wxDC
& dc
,
203 const wxString
& label
,
204 const wxBitmap
& bitmap
,
209 // draw a (part of) line in the text control
210 virtual void DrawTextLine(wxDC
& dc
,
211 const wxString
& text
,
217 // draw a line wrap indicator
218 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
220 // draw a notebook tab
221 virtual void DrawTab(wxDC
& dc
,
224 const wxString
& label
,
225 const wxBitmap
& bitmap
= wxNullBitmap
,
227 int indexAccel
= -1) = 0;
229 // draw the slider shaft
230 virtual void DrawSliderShaft(wxDC
& dc
,
233 wxOrientation orient
,
236 wxRect
*rectShaft
= NULL
) = 0;
238 // draw the slider thumb
239 virtual void DrawSliderThumb(wxDC
& dc
,
241 wxOrientation orient
,
245 // draw the slider ticks
246 virtual void DrawSliderTicks(wxDC
& dc
,
249 wxOrientation orient
,
256 // draw a menu bar item
257 virtual void DrawMenuBarItem(wxDC
& dc
,
259 const wxString
& label
,
261 int indexAccel
= -1) = 0;
263 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
265 // the geometryInfo is calculated by GetMenuGeometry() function from below
266 virtual void DrawMenuItem(wxDC
& dc
,
268 const wxMenuGeometryInfo
& geometryInfo
,
269 const wxString
& label
,
270 const wxString
& accel
,
271 const wxBitmap
& bitmap
= wxNullBitmap
,
273 int indexAccel
= -1) = 0;
275 // draw a menu bar separator
276 virtual void DrawMenuSeparator(wxDC
& dc
,
278 const wxMenuGeometryInfo
& geomInfo
) = 0;
280 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
281 // interpreted specially and means "draw the status bar grip" here
282 virtual void DrawStatusField(wxDC
& dc
,
284 const wxString
& label
,
287 // draw complete frame/dialog titlebar
288 virtual void DrawFrameTitleBar(wxDC
& dc
,
290 const wxString
& title
,
293 int specialButton
= 0,
294 int specialButtonFlags
= 0) = 0;
296 // draw frame borders
297 virtual void DrawFrameBorder(wxDC
& dc
,
301 // draw frame titlebar background
302 virtual void DrawFrameBackground(wxDC
& dc
,
307 virtual void DrawFrameTitle(wxDC
& dc
,
309 const wxString
& title
,
313 virtual void DrawFrameIcon(wxDC
& dc
,
318 // draw frame buttons
319 virtual void DrawFrameButton(wxDC
& dc
,
320 wxCoord x
, wxCoord y
,
327 // return the bitmaps to use for combobox button
328 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
330 wxBitmap
*bmpPressed
,
331 wxBitmap
*bmpDisabled
) = 0;
333 // geometry functions
334 // ------------------
336 // get the dimensions of the border: rect.x/y contain the width/height of
337 // the left/top side, width/heigh - of the right/bottom one
338 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
340 // the scrollbars may be drawn either inside the window border or outside
341 // it - this function is used to decide how to draw them
342 virtual bool AreScrollbarsInsideBorder() const = 0;
344 // adjust the size of the control of the given class: for most controls,
345 // this just takes into account the border, but for some (buttons, for
346 // example) it is more complicated - the result being, in any case, that
347 // the control looks "nice" if it uses the adjusted rectangle
348 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
350 // get the size of a scrollbar arrow
351 virtual wxSize
GetScrollbarArrowSize() const = 0;
353 // gets the bounding box for a scrollbar element for the given (by default
354 // - current) thumb position
355 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
356 wxScrollBar::Element elem
,
357 int thumbPos
= -1) const = 0;
359 // returns the size of the scrollbar shaft excluding the arrows
360 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
362 // returns one of wxHT_SCROLLBAR_XXX constants
363 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
364 const wxPoint
& pt
) const = 0;
366 // translate the scrollbar position (in logical units) into physical
367 // coordinate (in pixels) and the other way round
368 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
369 int thumbPos
= -1) = 0;
370 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
373 // get the height of a listbox item from the base font height
374 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
376 // get the size of a checkbox/radio button bitmap
377 virtual wxSize
GetCheckBitmapSize() const = 0;
378 virtual wxSize
GetRadioBitmapSize() const = 0;
379 virtual wxCoord
GetCheckItemMargin() const = 0;
381 // get the standard size of a toolbar button and also return the size of
382 // a toolbar separator in the provided pointer
383 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
385 // get the margins between/around the toolbar buttons
386 virtual wxSize
GetToolBarMargin() const = 0;
388 // convert between text rectangle and client rectangle for text controls:
389 // the former is typicall smaller to leave margins around text
390 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
391 const wxRect
& rectText
) const = 0;
393 // extra space is for line indicators
394 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
395 const wxRect
& rectTotal
,
396 wxCoord
*extraSpaceBeyond
) const = 0;
398 // get the overhang of a selected tab
399 virtual wxSize
GetTabIndent() const = 0;
401 // get the padding around the text in a tab
402 virtual wxSize
GetTabPadding() const = 0;
404 // get the default size of the slider in lesser dimension (i.e. height of a
405 // horizontal slider or width of a vertical one)
406 virtual wxCoord
GetSliderDim() const = 0;
408 // get the length of the slider ticks displayed along side slider
409 virtual wxCoord
GetSliderTickLen() const = 0;
411 // get the slider shaft rect from the total slider rect
412 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
414 wxOrientation orient
,
415 long style
= 0) const = 0;
417 // get the size of the slider thumb for the given total slider rect
418 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
420 wxOrientation orient
) const = 0;
422 // get the size of one progress bar step (in horz and vertical directions)
423 virtual wxSize
GetProgressBarStep() const = 0;
425 // get the size of rectangle to use in the menubar for the given text rect
426 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
428 // get the struct storing all layout info needed to draw all menu items
429 // (this can't be calculated for each item separately as they should be
432 // the returned pointer must be deleted by the caller
433 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
434 const wxMenu
& menu
) const = 0;
436 // get the borders around the status bar fields (x and y fields of the
437 // return value) and also, optionally, the border between the fields
438 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
440 // get client area rectangle of top level window (i.e. subtract
441 // decorations from given rectangle)
442 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
444 // get size of whole top level window, given size of its client area size
445 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
447 // get the minimal size of top level window
448 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
450 // get titlebar icon size
451 virtual wxSize
GetFrameIconSize() const = 0;
453 // returns one of wxHT_TOPLEVEL_XXX constants
454 virtual int HitTestFrame(const wxRect
& rect
,
456 int flags
= 0) const = 0;
458 // virtual dtor for any base class
459 virtual ~wxRenderer();
462 // draw a frame around rectFrame rectangle but not touching the rectLabel
463 // one: this is used by DrawFrame()
464 void StandardDrawFrame(wxDC
& dc
,
465 const wxRect
& rectFrame
,
466 const wxRect
& rectLabel
);
468 // standard text line drawing: just use DrawText() and highlight the
470 static void StandardDrawTextLine(wxDC
& dc
,
471 const wxString
& text
,
473 int selStart
, int selEnd
,
476 // standard scrollbar hit testing: this assumes that it only has 2 arrows
477 // and a thumb, so the themes which have more complicated scrollbars (e.g.
478 // BeOS) can't use this method
479 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
480 wxScrollBar::Element elem
,
482 const wxSize
& sizeArrow
);
483 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
485 const wxSize
& sizeArrow
);
486 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
488 const wxSize
& sizeArrow
);
489 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
491 const wxSize
& sizeArrow
);
492 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
493 const wxSize
& sizeArrow
);
494 static void StandardScrollBarThumbSize(wxCoord lenBar
,
502 // ----------------------------------------------------------------------------
503 // wxDelegateRenderer: it is impossible to inherit from any of standard
504 // renderers as their declarations are in private code, but you can use this
505 // class to override only some of the Draw() functions - all the other ones
506 // will be left to the original renderer
507 // ----------------------------------------------------------------------------
509 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
512 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
514 virtual void DrawBackground(wxDC
& dc
,
518 wxWindow
*window
= NULL
)
519 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
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
); }
621 virtual void DrawToolBarButton(wxDC
& dc
,
622 const wxString
& label
,
623 const wxBitmap
& bitmap
,
627 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
); }
628 virtual void DrawTextLine(wxDC
& dc
,
629 const wxString
& text
,
634 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
635 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
636 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
638 virtual void DrawTab(wxDC
& dc
,
641 const wxString
& label
,
642 const wxBitmap
& bitmap
= wxNullBitmap
,
645 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
647 virtual void DrawSliderShaft(wxDC
& dc
,
650 wxOrientation orient
,
653 wxRect
*rectShaft
= NULL
)
654 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
655 virtual void DrawSliderThumb(wxDC
& dc
,
657 wxOrientation orient
,
660 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
661 virtual void DrawSliderTicks(wxDC
& dc
,
664 wxOrientation orient
,
670 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
671 start
, end
, start
, flags
, style
); }
673 virtual void DrawMenuBarItem(wxDC
& dc
,
675 const wxString
& label
,
678 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
679 virtual void DrawMenuItem(wxDC
& dc
,
681 const wxMenuGeometryInfo
& gi
,
682 const wxString
& label
,
683 const wxString
& accel
,
684 const wxBitmap
& bitmap
= wxNullBitmap
,
687 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
688 bitmap
, flags
, indexAccel
); }
689 virtual void DrawMenuSeparator(wxDC
& dc
,
691 const wxMenuGeometryInfo
& geomInfo
)
692 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
694 virtual void DrawStatusField(wxDC
& dc
,
696 const wxString
& label
,
698 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
); }
700 virtual void DrawFrameTitleBar(wxDC
& dc
,
702 const wxString
& title
,
705 int specialButton
= 0,
706 int specialButtonFlag
= 0)
707 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
708 specialButton
, specialButtonFlag
); }
709 virtual void DrawFrameBorder(wxDC
& dc
,
712 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
713 virtual void DrawFrameBackground(wxDC
& dc
,
716 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
717 virtual void DrawFrameTitle(wxDC
& dc
,
719 const wxString
& title
,
721 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
722 virtual void DrawFrameIcon(wxDC
& dc
,
726 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
727 virtual void DrawFrameButton(wxDC
& dc
,
728 wxCoord x
, wxCoord y
,
731 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
733 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
735 wxBitmap
*bmpPressed
,
736 wxBitmap
*bmpDisabled
)
737 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
738 bmpPressed
, bmpDisabled
); }
740 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
741 { m_renderer
->AdjustSize(size
, window
); }
742 virtual wxRect
GetBorderDimensions(wxBorder border
) const
743 { return m_renderer
->GetBorderDimensions(border
); }
744 virtual bool AreScrollbarsInsideBorder() const
745 { return m_renderer
->AreScrollbarsInsideBorder(); }
747 virtual wxSize
GetScrollbarArrowSize() const
748 { return m_renderer
->GetScrollbarArrowSize(); }
749 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
750 wxScrollBar::Element elem
,
751 int thumbPos
= -1) const
752 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
753 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
754 { return m_renderer
->GetScrollbarSize(scrollbar
); }
755 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
756 const wxPoint
& pt
) const
757 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
758 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
760 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
761 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
763 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
764 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
765 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
766 virtual wxSize
GetCheckBitmapSize() const
767 { return m_renderer
->GetCheckBitmapSize(); }
768 virtual wxSize
GetRadioBitmapSize() const
769 { return m_renderer
->GetRadioBitmapSize(); }
770 virtual wxCoord
GetCheckItemMargin() const
771 { return m_renderer
->GetCheckItemMargin(); }
773 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
774 { return m_renderer
->GetToolBarButtonSize(separator
); }
775 virtual wxSize
GetToolBarMargin() const
776 { return m_renderer
->GetToolBarMargin(); }
778 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
779 const wxRect
& rect
) const
780 { return m_renderer
->GetTextTotalArea(text
, rect
); }
781 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
783 wxCoord
*extraSpaceBeyond
) const
784 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
786 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
787 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
789 virtual wxCoord
GetSliderDim() const
790 { return m_renderer
->GetSliderDim(); }
791 virtual wxCoord
GetSliderTickLen() const
792 { return m_renderer
->GetSliderTickLen(); }
793 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
795 wxOrientation orient
,
796 long style
= 0) const
797 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
798 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
800 wxOrientation orient
) const
801 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
802 virtual wxSize
GetProgressBarStep() const
803 { return m_renderer
->GetProgressBarStep(); }
804 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
805 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
806 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
807 const wxMenu
& menu
) const
808 { return m_renderer
->GetMenuGeometry(win
, menu
); }
809 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
810 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
811 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
812 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
813 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
814 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
815 virtual wxSize
GetFrameMinSize(int flags
) const
816 { return m_renderer
->GetFrameMinSize(flags
); }
817 virtual wxSize
GetFrameIconSize() const
818 { return m_renderer
->GetFrameIconSize(); }
819 virtual int HitTestFrame(const wxRect
& rect
,
822 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
825 wxRenderer
*m_renderer
;
828 // ----------------------------------------------------------------------------
829 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
831 // ----------------------------------------------------------------------------
833 class WXDLLEXPORT wxControlRenderer
836 // create a renderer for this dc with this "fundamental" renderer
837 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
840 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
841 wxCoord marginX
= 0, wxCoord marginY
= 0);
843 void DrawItems(const wxListBox
*listbox
,
844 size_t itemFirst
, size_t itemLast
);
845 #endif // wxUSE_LISTBOX
846 #if wxUSE_CHECKLISTBOX
847 void DrawCheckItems(const wxCheckListBox
*listbox
,
848 size_t itemFirst
, size_t itemLast
);
849 #endif // wxUSE_CHECKLISTBOX
850 void DrawButtonBorder();
851 // the line must be either horizontal or vertical
852 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
854 void DrawBitmap(const wxBitmap
& bitmap
);
855 void DrawBackgroundBitmap();
856 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
858 void DrawProgressBar(const wxGauge
*gauge
);
859 #endif // wxUSE_GAUGE
862 wxWindow
*GetWindow() const { return m_window
; }
863 wxRenderer
*GetRenderer() const { return m_renderer
; }
865 wxDC
& GetDC() { return m_dc
; }
867 const wxRect
& GetRect() const { return m_rect
; }
868 wxRect
& GetRect() { return m_rect
; }
871 static void DrawBitmap(wxDC
&dc
,
872 const wxBitmap
& bitmap
,
874 int alignment
= wxALIGN_CENTRE
|
875 wxALIGN_CENTRE_VERTICAL
,
876 wxStretch stretch
= wxSTRETCH_NOT
);
879 // common part of DrawItems() and DrawCheckItems()
880 void DoDrawItems(const wxListBox
*listbox
,
881 size_t itemFirst
, size_t itemLast
,
882 bool isCheckLbox
= FALSE
);
885 wxRenderer
*m_renderer
;
890 #endif // _WX_UNIV_RENDERER_H_