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 license
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
,
74 // draw the label inside the given rectangle with the specified alignment
75 // and optionally emphasize the character with the given index
76 virtual void DrawLabel(wxDC
& dc
,
77 const wxString
& label
,
80 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
82 wxRect
*rectBounds
= NULL
) = 0;
84 // same but also draw a bitmap if it is valid
85 virtual void DrawButtonLabel(wxDC
& dc
,
86 const wxString
& label
,
87 const wxBitmap
& image
,
90 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
92 wxRect
*rectBounds
= NULL
) = 0;
94 // draw the border and optionally return the rectangle containing the
95 // region inside the border
96 virtual void DrawBorder(wxDC
& dc
,
100 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
102 // draw text control border (I hate to have a separate method for this but
103 // it is needed to accomodate GTK+)
104 virtual void DrawTextBorder(wxDC
& dc
,
108 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
110 // draw push button border and return the rectangle left for the label
111 virtual void DrawButtonBorder(wxDC
& dc
,
114 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
116 // draw a horizontal line
117 virtual void DrawHorizontalLine(wxDC
& dc
,
118 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
120 // draw a vertical line
121 virtual void DrawVerticalLine(wxDC
& dc
,
122 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
124 // draw a frame with the label (horizontal alignment can be specified)
125 virtual void DrawFrame(wxDC
& dc
,
126 const wxString
& label
,
129 int alignment
= wxALIGN_LEFT
,
130 int indexAccel
= -1) = 0;
132 // draw an arrow in the given direction
133 virtual void DrawArrow(wxDC
& dc
,
138 // draw a scrollbar arrow (may be the same as arrow but may be not)
139 virtual void DrawScrollbarArrow(wxDC
& dc
,
144 // draw the scrollbar thumb
145 virtual void DrawScrollbarThumb(wxDC
& dc
,
146 wxOrientation orient
,
150 // draw a (part of) scrollbar shaft
151 virtual void DrawScrollbarShaft(wxDC
& dc
,
152 wxOrientation orient
,
156 // draw the rectangle in the corner between two scrollbars
157 virtual void DrawScrollCorner(wxDC
& dc
,
158 const wxRect
& rect
) = 0;
160 // draw an item of a wxListBox
161 virtual void DrawItem(wxDC
& dc
,
162 const wxString
& label
,
166 // draw an item of a wxCheckListBox
167 virtual void DrawCheckItem(wxDC
& dc
,
168 const wxString
& label
,
169 const wxBitmap
& bitmap
,
173 // draw a checkbutton (bitmap may be invalid to use default one)
174 virtual void DrawCheckButton(wxDC
& dc
,
175 const wxString
& label
,
176 const wxBitmap
& bitmap
,
179 wxAlignment align
= wxALIGN_LEFT
,
180 int indexAccel
= -1) = 0;
182 // draw a radio button
183 virtual void DrawRadioButton(wxDC
& dc
,
184 const wxString
& label
,
185 const wxBitmap
& bitmap
,
188 wxAlignment align
= wxALIGN_LEFT
,
189 int indexAccel
= -1) = 0;
191 // draw a toolbar button (label may be empty, bitmap may be invalid, if
192 // both conditions are true this function draws a separator)
193 virtual void DrawToolBarButton(wxDC
& dc
,
194 const wxString
& label
,
195 const wxBitmap
& bitmap
,
199 // draw a (part of) line in the text control
200 virtual void DrawTextLine(wxDC
& dc
,
201 const wxString
& text
,
207 // draw a line wrap indicator
208 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
210 // draw a notebook tab
211 virtual void DrawTab(wxDC
& dc
,
214 const wxString
& label
,
215 const wxBitmap
& bitmap
= wxNullBitmap
,
217 int indexAccel
= -1) = 0;
219 // draw the slider shaft
220 virtual void DrawSliderShaft(wxDC
& dc
,
222 wxOrientation orient
,
224 wxRect
*rectShaft
= NULL
) = 0;
226 // draw the slider thumb
227 virtual void DrawSliderThumb(wxDC
& dc
,
229 wxOrientation orient
,
232 // draw the slider ticks
233 virtual void DrawSliderTicks(wxDC
& dc
,
235 const wxSize
& sizeThumb
,
236 wxOrientation orient
,
242 // draw a menu bar item
243 virtual void DrawMenuBarItem(wxDC
& dc
,
245 const wxString
& label
,
247 int indexAccel
= -1) = 0;
249 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
251 // the geometryInfo is calculated by GetMenuGeometry() function from below
252 virtual void DrawMenuItem(wxDC
& dc
,
254 const wxMenuGeometryInfo
& geometryInfo
,
255 const wxString
& label
,
256 const wxString
& accel
,
257 const wxBitmap
& bitmap
= wxNullBitmap
,
259 int indexAccel
= -1) = 0;
261 // draw a menu bar separator
262 virtual void DrawMenuSeparator(wxDC
& dc
,
264 const wxMenuGeometryInfo
& geomInfo
) = 0;
266 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
267 // interpreted specially and means "draw the status bar grip" here
268 virtual void DrawStatusField(wxDC
& dc
,
270 const wxString
& label
,
273 // draw complete frame/dialog titlebar
274 virtual void DrawFrameTitleBar(wxDC
& dc
,
276 const wxString
& title
,
279 int specialButton
= 0,
280 int specialButtonFlags
= 0) = 0;
282 // draw frame borders
283 virtual void DrawFrameBorder(wxDC
& dc
,
287 // draw frame titlebar background
288 virtual void DrawFrameBackground(wxDC
& dc
,
293 virtual void DrawFrameTitle(wxDC
& dc
,
295 const wxString
& title
,
299 virtual void DrawFrameIcon(wxDC
& dc
,
304 // draw frame buttons
305 virtual void DrawFrameButton(wxDC
& dc
,
306 wxCoord x
, wxCoord y
,
313 // return the bitmaps to use for combobox button
314 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
316 wxBitmap
*bmpPressed
,
317 wxBitmap
*bmpDisabled
) = 0;
319 // geometry functions
320 // ------------------
322 // get the dimensions of the border: rect.x/y contain the width/height of
323 // the left/top side, width/heigh - of the right/bottom one
324 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
326 // the scrollbars may be drawn either inside the window border or outside
327 // it - this function is used to decide how to draw them
328 virtual bool AreScrollbarsInsideBorder() const = 0;
330 // adjust the size of the control of the given class: for most controls,
331 // this just takes into account the border, but for some (buttons, for
332 // example) it is more complicated - the result being, in any case, that
333 // the control looks "nice" if it uses the adjusted rectangle
334 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
336 // get the size of a scrollbar arrow
337 virtual wxSize
GetScrollbarArrowSize() const = 0;
339 // gets the bounding box for a scrollbar element for the given (by default
340 // - current) thumb position
341 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
342 wxScrollBar::Element elem
,
343 int thumbPos
= -1) const = 0;
345 // returns the size of the scrollbar shaft excluding the arrows
346 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
348 // returns one of wxHT_SCROLLBAR_XXX constants
349 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
350 const wxPoint
& pt
) const = 0;
352 // translate the scrollbar position (in logical units) into physical
353 // coordinate (in pixels) and the other way round
354 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
355 int thumbPos
= -1) = 0;
356 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
359 // get the height of a listbox item from the base font height
360 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
362 // get the size of a checkbox/radio button bitmap
363 virtual wxSize
GetCheckBitmapSize() const = 0;
364 virtual wxSize
GetRadioBitmapSize() const = 0;
365 virtual wxCoord
GetCheckItemMargin() const = 0;
367 // get the standard size of a toolbar button and also return the size of
368 // a toolbar separator in the provided pointer
369 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
371 // get the margins between/around the toolbar buttons
372 virtual wxSize
GetToolBarMargin() const = 0;
374 // convert between text rectangle and client rectangle for text controls:
375 // the former is typicall smaller to leave margins around text
376 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
377 const wxRect
& rectText
) const = 0;
379 // extra space is for line indicators
380 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
381 const wxRect
& rectTotal
,
382 wxCoord
*extraSpaceBeyond
) const = 0;
384 // get the overhang of a selected tab
385 virtual wxSize
GetTabIndent() const = 0;
387 // get the padding around the text in a tab
388 virtual wxSize
GetTabPadding() const = 0;
390 // get the default size of the slider in lesser dimension (i.e. height of a
391 // horizontal slider or width of a vertical one)
392 virtual wxCoord
GetSliderDim() const = 0;
394 // get the length of the slider ticks displayed along side slider
395 virtual wxCoord
GetSliderTickLen() const = 0;
397 // get the slider shaft rect from the total slider rect
398 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
399 wxOrientation orient
) const = 0;
401 // get the size of the slider thumb for the given total slider rect
402 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
403 wxOrientation orient
) const = 0;
405 // get the size of one progress bar step (in horz and vertical directions)
406 virtual wxSize
GetProgressBarStep() const = 0;
408 // get the size of rectangle to use in the menubar for the given text rect
409 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
411 // get the struct storing all layout info needed to draw all menu items
412 // (this can't be calculated for each item separately as they should be
415 // the returned pointer must be deleted by the caller
416 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
417 const wxMenu
& menu
) const = 0;
419 // get the borders around the status bar fields (x and y fields of the
420 // return value) and also, optionally, the border between the fields
421 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
423 // get client area rectangle of top level window (i.e. subtract
424 // decorations from given rectangle)
425 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
427 // get size of whole top level window, given size of its client area size
428 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
430 // get the minimal size of top level window
431 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
433 // get titlebar icon size
434 virtual wxSize
GetFrameIconSize() const = 0;
436 // returns one of wxHT_TOPLEVEL_XXX constants
437 virtual int HitTestFrame(const wxRect
& rect
,
439 int flags
= 0) const = 0;
442 // get the standard icon used by wxWin dialogs - this allows the user
443 // to customize the standard dialogs. The 'which' parameter is one of
445 virtual wxIcon
GetStdIcon(int which
) const = 0;
447 // virtual dtor for any base class
448 virtual ~wxRenderer();
451 // draw a frame around rectFrame rectangle but not touching the rectLabel
452 // one: this is used by DrawFrame()
453 void StandardDrawFrame(wxDC
& dc
,
454 const wxRect
& rectFrame
,
455 const wxRect
& rectLabel
);
457 // standard text line drawing: just use DrawText() and highlight the
459 static void StandardDrawTextLine(wxDC
& dc
,
460 const wxString
& text
,
462 int selStart
, int selEnd
,
465 // standard scrollbar hit testing: this assumes that it only has 2 arrows
466 // and a thumb, so the themes which have more complicated scrollbars (e.g.
467 // BeOS) can't use this method
468 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
469 wxScrollBar::Element elem
,
471 const wxSize
& sizeArrow
);
472 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
474 const wxSize
& sizeArrow
);
475 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
477 const wxSize
& sizeArrow
);
478 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
480 const wxSize
& sizeArrow
);
481 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
482 const wxSize
& sizeArrow
);
483 static void StandardScrollBarThumbSize(wxCoord lenBar
,
491 // ----------------------------------------------------------------------------
492 // wxDelegateRenderer: it is impossible to inherit from any of standard
493 // renderers as their declarations are in private code, but you can use this
494 // class to override only some of the Draw() functions - all the other ones
495 // will be left to the original renderer
496 // ----------------------------------------------------------------------------
498 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
501 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
503 virtual void DrawBackground(wxDC
& dc
,
507 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
); }
508 virtual void DrawLabel(wxDC
& dc
,
509 const wxString
& label
,
512 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
514 wxRect
*rectBounds
= NULL
)
515 { m_renderer
->DrawLabel(dc
, label
, rect
,
516 flags
, align
, indexAccel
, rectBounds
); }
517 virtual void DrawButtonLabel(wxDC
& dc
,
518 const wxString
& label
,
519 const wxBitmap
& image
,
522 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
524 wxRect
*rectBounds
= NULL
)
525 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
526 flags
, align
, indexAccel
, rectBounds
); }
527 virtual void DrawBorder(wxDC
& dc
,
531 wxRect
*rectIn
= (wxRect
*)NULL
)
532 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
533 virtual void DrawTextBorder(wxDC
& dc
,
537 wxRect
*rectIn
= (wxRect
*)NULL
)
538 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
539 virtual void DrawButtonBorder(wxDC
& dc
,
542 wxRect
*rectIn
= (wxRect
*)NULL
)
543 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
544 virtual void DrawFrame(wxDC
& dc
,
545 const wxString
& label
,
548 int align
= wxALIGN_LEFT
,
550 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
551 virtual void DrawHorizontalLine(wxDC
& dc
,
552 wxCoord y
, wxCoord x1
, wxCoord x2
)
553 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
554 virtual void DrawVerticalLine(wxDC
& dc
,
555 wxCoord x
, wxCoord y1
, wxCoord y2
)
556 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
557 virtual void DrawArrow(wxDC
& dc
,
561 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
562 virtual void DrawScrollbarArrow(wxDC
& dc
,
566 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
567 virtual void DrawScrollbarThumb(wxDC
& dc
,
568 wxOrientation orient
,
571 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
572 virtual void DrawScrollbarShaft(wxDC
& dc
,
573 wxOrientation orient
,
576 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
577 virtual void DrawScrollCorner(wxDC
& dc
,
579 { m_renderer
->DrawScrollCorner(dc
, rect
); }
580 virtual void DrawItem(wxDC
& dc
,
581 const wxString
& label
,
584 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
585 virtual void DrawCheckItem(wxDC
& dc
,
586 const wxString
& label
,
587 const wxBitmap
& bitmap
,
590 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
591 virtual void DrawCheckButton(wxDC
& dc
,
592 const wxString
& label
,
593 const wxBitmap
& bitmap
,
596 wxAlignment align
= wxALIGN_LEFT
,
598 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
599 flags
, align
, indexAccel
); }
600 virtual void DrawRadioButton(wxDC
& dc
,
601 const wxString
& label
,
602 const wxBitmap
& bitmap
,
605 wxAlignment align
= wxALIGN_LEFT
,
607 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
608 flags
, align
, indexAccel
); }
609 virtual void DrawToolBarButton(wxDC
& dc
,
610 const wxString
& label
,
611 const wxBitmap
& bitmap
,
614 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
); }
615 virtual void DrawTextLine(wxDC
& dc
,
616 const wxString
& text
,
620 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
); }
621 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
622 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
624 virtual void DrawTab(wxDC
& dc
,
627 const wxString
& label
,
628 const wxBitmap
& bitmap
= wxNullBitmap
,
631 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
633 virtual void DrawSliderShaft(wxDC
& dc
,
635 wxOrientation orient
,
637 wxRect
*rectShaft
= NULL
)
638 { m_renderer
->DrawSliderShaft(dc
, rect
, orient
, flags
, rectShaft
); }
639 virtual void DrawSliderThumb(wxDC
& dc
,
641 wxOrientation orient
,
643 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
); }
644 virtual void DrawSliderTicks(wxDC
& dc
,
646 const wxSize
& sizeThumb
,
647 wxOrientation orient
,
652 { m_renderer
->DrawSliderTicks(dc
, rect
, sizeThumb
, orient
,
653 start
, end
, start
, flags
); }
655 virtual void DrawMenuBarItem(wxDC
& dc
,
657 const wxString
& label
,
660 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
661 virtual void DrawMenuItem(wxDC
& dc
,
663 const wxMenuGeometryInfo
& gi
,
664 const wxString
& label
,
665 const wxString
& accel
,
666 const wxBitmap
& bitmap
= wxNullBitmap
,
669 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
670 bitmap
, flags
, indexAccel
); }
671 virtual void DrawMenuSeparator(wxDC
& dc
,
673 const wxMenuGeometryInfo
& geomInfo
)
674 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
676 virtual void DrawStatusField(wxDC
& dc
,
678 const wxString
& label
,
680 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
); }
682 virtual void DrawFrameTitleBar(wxDC
& dc
,
684 const wxString
& title
,
687 int specialButton
= 0,
688 int specialButtonFlag
= 0)
689 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
690 specialButton
, specialButtonFlag
); }
691 virtual void DrawFrameBorder(wxDC
& dc
,
694 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
695 virtual void DrawFrameBackground(wxDC
& dc
,
698 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
699 virtual void DrawFrameTitle(wxDC
& dc
,
701 const wxString
& title
,
703 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
704 virtual void DrawFrameIcon(wxDC
& dc
,
708 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
709 virtual void DrawFrameButton(wxDC
& dc
,
710 wxCoord x
, wxCoord y
,
713 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
715 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
717 wxBitmap
*bmpPressed
,
718 wxBitmap
*bmpDisabled
) const
719 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
720 bmpPressed
, bmpDisabled
); }
722 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
723 { m_renderer
->AdjustSize(size
, window
); }
724 virtual wxRect
GetBorderDimensions(wxBorder border
) const
725 { return m_renderer
->GetBorderDimensions(border
); }
726 virtual bool AreScrollbarsInsideBorder() const
727 { return m_renderer
->AreScrollbarsInsideBorder(); }
729 virtual wxSize
GetScrollbarArrowSize() const
730 { return m_renderer
->GetScrollbarArrowSize(); }
731 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
732 wxScrollBar::Element elem
,
733 int thumbPos
= -1) const
734 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
735 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
736 { return m_renderer
->GetScrollbarSize(scrollbar
); }
737 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
738 const wxPoint
& pt
) const
739 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
740 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
742 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
743 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
745 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
746 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
747 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
748 virtual wxSize
GetCheckBitmapSize() const
749 { return m_renderer
->GetCheckBitmapSize(); }
750 virtual wxSize
GetRadioBitmapSize() const
751 { return m_renderer
->GetRadioBitmapSize(); }
752 virtual wxCoord
GetCheckItemMargin() const
753 { return m_renderer
->GetCheckItemMargin(); }
755 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
756 { return m_renderer
->GetToolBarButtonSize(separator
); }
757 virtual wxSize
GetToolBarMargin() const
758 { return m_renderer
->GetToolBarMargin(); }
760 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
761 const wxRect
& rect
) const
762 { return m_renderer
->GetTextTotalArea(text
, rect
); }
763 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
765 wxCoord
*extraSpaceBeyond
) const
766 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
768 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
769 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
771 virtual wxCoord
GetSliderDim() const
772 { return m_renderer
->GetSliderDim(); }
773 virtual wxCoord
GetSliderTickLen() const
774 { return m_renderer
->GetSliderTickLen(); }
775 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
776 wxOrientation orient
) const
777 { return GetSliderShaftRect(rect
, orient
); }
778 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
779 wxOrientation orient
) const
780 { return m_renderer
->GetSliderThumbSize(rect
, orient
); }
781 virtual wxSize
GetProgressBarStep() const
782 { return m_renderer
->GetProgressBarStep(); }
783 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
784 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
785 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
786 const wxMenu
& menu
) const
787 { return m_renderer
->GetMenuGeometry(win
, menu
); }
788 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
789 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
790 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
791 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
792 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
793 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
794 virtual wxSize
GetFrameMinSize(int flags
) const
795 { return m_renderer
->GetFrameMinSize(flags
); }
796 virtual wxSize
GetFrameIconSize() const
797 { return m_renderer
->GetFrameIconSize(); }
798 virtual int HitTestFrame(const wxRect
& rect
,
801 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
802 virtual wxIcon
GetStdIcon(int which
) const
803 { return m_renderer
->GetStdIcon(which
); }
806 wxRenderer
*m_renderer
;
809 // ----------------------------------------------------------------------------
810 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
812 // ----------------------------------------------------------------------------
814 class WXDLLEXPORT wxControlRenderer
817 // create a renderer for this dc with this "fundamental" renderer
818 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
821 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
822 wxCoord marginX
= 0, wxCoord marginY
= 0);
824 void DrawItems(const wxListBox
*listbox
,
825 size_t itemFirst
, size_t itemLast
);
826 #endif // wxUSE_LISTBOX
827 #if wxUSE_CHECKLISTBOX
828 void DrawCheckItems(const wxCheckListBox
*listbox
,
829 size_t itemFirst
, size_t itemLast
);
830 #endif // wxUSE_CHECKLISTBOX
831 void DrawButtonBorder();
832 // the line must be either horizontal or vertical
833 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
835 void DrawBitmap(const wxBitmap
& bitmap
);
836 void DrawBackgroundBitmap();
837 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
839 void DrawProgressBar(const wxGauge
*gauge
);
840 #endif // wxUSE_GAUGE
843 wxWindow
*GetWindow() const { return m_window
; }
844 wxRenderer
*GetRenderer() const { return m_renderer
; }
846 wxDC
& GetDC() { return m_dc
; }
848 const wxRect
& GetRect() const { return m_rect
; }
849 wxRect
& GetRect() { return m_rect
; }
852 static void DrawBitmap(wxDC
&dc
,
853 const wxBitmap
& bitmap
,
855 int alignment
= wxALIGN_CENTRE
|
856 wxALIGN_CENTRE_VERTICAL
,
857 wxStretch stretch
= wxSTRETCH_NOT
);
860 // common part of DrawItems() and DrawCheckItems()
861 void DoDrawItems(const wxListBox
*listbox
,
862 size_t itemFirst
, size_t itemLast
,
863 bool isCheckLbox
= FALSE
);
866 wxRenderer
*m_renderer
;
871 #endif // _WX_UNIV_RENDERER_H_