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 (part of) line in the text control
192 virtual void DrawTextLine(wxDC
& dc
,
193 const wxString
& text
,
199 // draw a line wrap indicator
200 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
202 // draw a notebook tab
203 virtual void DrawTab(wxDC
& dc
,
206 const wxString
& label
,
207 const wxBitmap
& bitmap
= wxNullBitmap
,
209 int indexAccel
= -1) = 0;
211 // draw the slider shaft
212 virtual void DrawSliderShaft(wxDC
& dc
,
214 wxOrientation orient
,
216 wxRect
*rectShaft
= NULL
) = 0;
218 // draw the slider thumb
219 virtual void DrawSliderThumb(wxDC
& dc
,
221 wxOrientation orient
,
224 // draw the slider ticks
225 virtual void DrawSliderTicks(wxDC
& dc
,
227 const wxSize
& sizeThumb
,
228 wxOrientation orient
,
234 // draw a menu bar item
235 virtual void DrawMenuBarItem(wxDC
& dc
,
237 const wxString
& label
,
239 int indexAccel
= -1) = 0;
241 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
243 // the geometryInfo is calculated by GetMenuGeometry() function from below
244 virtual void DrawMenuItem(wxDC
& dc
,
246 const wxMenuGeometryInfo
& geometryInfo
,
247 const wxString
& label
,
248 const wxString
& accel
,
249 const wxBitmap
& bitmap
= wxNullBitmap
,
251 int indexAccel
= -1) = 0;
253 // draw a menu bar separator
254 virtual void DrawMenuSeparator(wxDC
& dc
,
256 const wxMenuGeometryInfo
& geomInfo
) = 0;
258 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
259 // interpreted specially and means "draw the status bar grip" here
260 virtual void DrawStatusField(wxDC
& dc
,
262 const wxString
& label
,
265 // draw complete frame/dialog titlebar
266 virtual void DrawFrameTitleBar(wxDC
& dc
,
268 const wxString
& title
,
271 int specialButton
= 0,
272 int specialButtonFlags
= 0) = 0;
274 // draw frame borders
275 virtual void DrawFrameBorder(wxDC
& dc
,
279 // draw frame titlebar background
280 virtual void DrawFrameBackground(wxDC
& dc
,
285 virtual void DrawFrameTitle(wxDC
& dc
,
287 const wxString
& title
,
291 virtual void DrawFrameIcon(wxDC
& dc
,
296 // draw frame buttons
297 virtual void DrawFrameButton(wxDC
& dc
,
298 wxCoord x
, wxCoord y
,
305 // return the bitmaps to use for combobox button
306 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
308 wxBitmap
*bmpPressed
,
309 wxBitmap
*bmpDisabled
) = 0;
311 // geometry functions
312 // ------------------
314 // get the dimensions of the border: rect.x/y contain the width/height of
315 // the left/top side, width/heigh - of the right/bottom one
316 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
318 // the scrollbars may be drawn either inside the window border or outside
319 // it - this function is used to decide how to draw them
320 virtual bool AreScrollbarsInsideBorder() const = 0;
322 // adjust the size of the control of the given class: for most controls,
323 // this just takes into account the border, but for some (buttons, for
324 // example) it is more complicated - the result being, in any case, that
325 // the control looks "nice" if it uses the adjusted rectangle
326 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
328 // get the size of a scrollbar arrow
329 virtual wxSize
GetScrollbarArrowSize() const = 0;
331 // gets the bounding box for a scrollbar element for the given (by default
332 // - current) thumb position
333 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
334 wxScrollBar::Element elem
,
335 int thumbPos
= -1) const = 0;
337 // returns the size of the scrollbar shaft excluding the arrows
338 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
340 // returns one of wxHT_SCROLLBAR_XXX constants
341 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
342 const wxPoint
& pt
) const = 0;
344 // translate the scrollbar position (in logical units) into physical
345 // coordinate (in pixels) and the other way round
346 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
347 int thumbPos
= -1) = 0;
348 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
351 // get the height of a listbox item from the base font height
352 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
354 // get the size of a checkbox/radio button bitmap
355 virtual wxSize
GetCheckBitmapSize() const = 0;
356 virtual wxSize
GetRadioBitmapSize() const = 0;
357 virtual wxCoord
GetCheckItemMargin() const = 0;
359 // convert between text rectangle and client rectangle for text controls:
360 // the former is typicall smaller to leave margins around text
361 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
362 const wxRect
& rectText
) = 0;
364 // extra space is for line indicators
365 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
366 const wxRect
& rectTotal
,
367 wxCoord
*extraSpaceBeyond
) = 0;
369 // get the overhang of a selected tab
370 virtual wxSize
GetTabIndent() const = 0;
372 // get the padding around the text in a tab
373 virtual wxSize
GetTabPadding() const = 0;
375 // get the default size of the slider in lesser dimension (i.e. height of a
376 // horizontal slider or width of a vertical one)
377 virtual wxCoord
GetSliderDim() const = 0;
379 // get the length of the slider ticks displayed along side slider
380 virtual wxCoord
GetSliderTickLen() const = 0;
382 // get the slider shaft rect from the total slider rect
383 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
384 wxOrientation orient
) const = 0;
386 // get the size of the slider thumb for the given total slider rect
387 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
388 wxOrientation orient
) const = 0;
390 // get the size of one progress bar step (in horz and vertical directions)
391 virtual wxSize
GetProgressBarStep() const = 0;
393 // get the size of rectangle to use in the menubar for the given text rect
394 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
396 // get the struct storing all layout info needed to draw all menu items
397 // (this can't be calculated for each item separately as they should be
400 // the returned pointer must be deleted by the caller
401 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
402 const wxMenu
& menu
) const = 0;
404 // get the borders around the status bar fields (x and y fields of the
405 // return value) and also, optionally, the border between the fields
406 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
408 // get client area rectangle of top level window (i.e. subtract
409 // decorations from given rectangle)
410 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
412 // get size of whole top level window, given size of its client area size
413 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
415 // get titlebar icon size
416 virtual wxSize
GetFrameIconSize() const = 0;
418 // returns one of wxHT_TOPLEVEL_XXX constants
419 virtual int HitTestFrame(const wxRect
& rect
,
421 int flags
= 0) const = 0;
424 // get the standard icon used by wxWin dialogs - this allows the user
425 // to customize the standard dialogs. The 'which' parameter is one of
427 virtual wxIcon
GetStdIcon(int which
) const = 0;
429 // virtual dtor for any base class
430 virtual ~wxRenderer();
433 // draw a frame around rectFrame rectangle but not touching the rectLabel
434 // one: this is used by DrawFrame()
435 void StandardDrawFrame(wxDC
& dc
,
436 const wxRect
& rectFrame
,
437 const wxRect
& rectLabel
);
439 // standard text line drawing: just use DrawText() and highlight the
441 static void StandardDrawTextLine(wxDC
& dc
,
442 const wxString
& text
,
444 int selStart
, int selEnd
,
447 // standard scrollbar hit testing: this assumes that it only has 2 arrows
448 // and a thumb, so the themes which have more complicated scrollbars (e.g.
449 // BeOS) can't use this method
450 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
451 wxScrollBar::Element elem
,
453 const wxSize
& sizeArrow
);
454 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
456 const wxSize
& sizeArrow
);
457 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
459 const wxSize
& sizeArrow
);
460 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
462 const wxSize
& sizeArrow
);
463 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
464 const wxSize
& sizeArrow
);
465 static void StandardScrollBarThumbSize(wxCoord lenBar
,
473 // ----------------------------------------------------------------------------
474 // wxDelegateRenderer: it is impossible to inherit from any of standard
475 // renderers as their declarations are in private code, but you can use this
476 // class to override only some of the Draw() functions - all the other ones
477 // will be left to the original renderer
478 // ----------------------------------------------------------------------------
480 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
483 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
485 virtual void DrawBackground(wxDC
& dc
,
489 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
); }
490 virtual void DrawLabel(wxDC
& dc
,
491 const wxString
& label
,
494 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
496 wxRect
*rectBounds
= NULL
)
497 { m_renderer
->DrawLabel(dc
, label
, rect
,
498 flags
, align
, indexAccel
, rectBounds
); }
499 virtual void DrawButtonLabel(wxDC
& dc
,
500 const wxString
& label
,
501 const wxBitmap
& image
,
504 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
506 wxRect
*rectBounds
= NULL
)
507 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
508 flags
, align
, indexAccel
, rectBounds
); }
509 virtual void DrawBorder(wxDC
& dc
,
513 wxRect
*rectIn
= (wxRect
*)NULL
)
514 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
515 virtual void DrawTextBorder(wxDC
& dc
,
519 wxRect
*rectIn
= (wxRect
*)NULL
)
520 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
521 virtual void DrawButtonBorder(wxDC
& dc
,
524 wxRect
*rectIn
= (wxRect
*)NULL
)
525 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
526 virtual void DrawFrame(wxDC
& dc
,
527 const wxString
& label
,
530 int align
= wxALIGN_LEFT
,
532 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
533 virtual void DrawHorizontalLine(wxDC
& dc
,
534 wxCoord y
, wxCoord x1
, wxCoord x2
)
535 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
536 virtual void DrawVerticalLine(wxDC
& dc
,
537 wxCoord x
, wxCoord y1
, wxCoord y2
)
538 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
539 virtual void DrawArrow(wxDC
& dc
,
543 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
544 virtual void DrawScrollbarArrow(wxDC
& dc
,
548 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
549 virtual void DrawScrollbarThumb(wxDC
& dc
,
550 wxOrientation orient
,
553 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
554 virtual void DrawScrollbarShaft(wxDC
& dc
,
555 wxOrientation orient
,
558 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
559 virtual void DrawScrollCorner(wxDC
& dc
,
561 { m_renderer
->DrawScrollCorner(dc
, rect
); }
562 virtual void DrawItem(wxDC
& dc
,
563 const wxString
& label
,
566 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
567 virtual void DrawCheckItem(wxDC
& dc
,
568 const wxString
& label
,
569 const wxBitmap
& bitmap
,
572 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
573 virtual void DrawCheckButton(wxDC
& dc
,
574 const wxString
& label
,
575 const wxBitmap
& bitmap
,
578 wxAlignment align
= wxALIGN_LEFT
,
580 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
581 flags
, align
, indexAccel
); }
582 virtual void DrawRadioButton(wxDC
& dc
,
583 const wxString
& label
,
584 const wxBitmap
& bitmap
,
587 wxAlignment align
= wxALIGN_LEFT
,
589 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
590 flags
, align
, indexAccel
); }
591 virtual void DrawTextLine(wxDC
& dc
,
592 const wxString
& text
,
596 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
); }
597 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
598 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
600 virtual void DrawTab(wxDC
& dc
,
603 const wxString
& label
,
604 const wxBitmap
& bitmap
= wxNullBitmap
,
607 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
609 virtual void DrawSliderShaft(wxDC
& dc
,
611 wxOrientation orient
,
613 wxRect
*rectShaft
= NULL
)
614 { m_renderer
->DrawSliderShaft(dc
, rect
, orient
, flags
, rectShaft
); }
615 virtual void DrawSliderThumb(wxDC
& dc
,
617 wxOrientation orient
,
619 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
); }
620 virtual void DrawSliderTicks(wxDC
& dc
,
622 const wxSize
& sizeThumb
,
623 wxOrientation orient
,
628 { m_renderer
->DrawSliderTicks(dc
, rect
, sizeThumb
, orient
,
629 start
, end
, start
, flags
); }
631 virtual void DrawMenuBarItem(wxDC
& dc
,
633 const wxString
& label
,
636 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
637 virtual void DrawMenuItem(wxDC
& dc
,
639 const wxMenuGeometryInfo
& gi
,
640 const wxString
& label
,
641 const wxString
& accel
,
642 const wxBitmap
& bitmap
= wxNullBitmap
,
645 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
646 bitmap
, flags
, indexAccel
); }
647 virtual void DrawMenuSeparator(wxDC
& dc
,
649 const wxMenuGeometryInfo
& geomInfo
)
650 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
652 virtual void DrawStatusField(wxDC
& dc
,
654 const wxString
& label
,
656 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
); }
658 virtual void DrawFrameTitleBar(wxDC
& dc
,
660 const wxString
& title
,
663 int specialButton
= 0,
664 int specialButtonFlag
= 0)
665 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
666 specialButton
, specialButtonFlag
); }
667 virtual void DrawFrameBorder(wxDC
& dc
,
670 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
671 virtual void DrawFrameBackground(wxDC
& dc
,
674 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
675 virtual void DrawFrameTitle(wxDC
& dc
,
677 const wxString
& title
,
679 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
680 virtual void DrawFrameIcon(wxDC
& dc
,
684 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
685 virtual void DrawFrameButton(wxDC
& dc
,
686 wxCoord x
, wxCoord y
,
689 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
691 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
693 wxBitmap
*bmpPressed
,
694 wxBitmap
*bmpDisabled
) const
695 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
696 bmpPressed
, bmpDisabled
); }
698 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
699 { m_renderer
->AdjustSize(size
, window
); }
700 virtual wxRect
GetBorderDimensions(wxBorder border
) const
701 { return m_renderer
->GetBorderDimensions(border
); }
702 virtual bool AreScrollbarsInsideBorder() const
703 { return m_renderer
->AreScrollbarsInsideBorder(); }
705 virtual wxSize
GetScrollbarArrowSize() const
706 { return m_renderer
->GetScrollbarArrowSize(); }
707 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
708 wxScrollBar::Element elem
,
709 int thumbPos
= -1) const
710 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
711 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
712 { return m_renderer
->GetScrollbarSize(scrollbar
); }
713 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
714 const wxPoint
& pt
) const
715 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
716 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
718 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
719 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
721 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
722 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
723 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
724 virtual wxSize
GetCheckBitmapSize() const
725 { return m_renderer
->GetCheckBitmapSize(); }
726 virtual wxSize
GetRadioBitmapSize() const
727 { return m_renderer
->GetRadioBitmapSize(); }
728 virtual wxCoord
GetCheckItemMargin() const
729 { return m_renderer
->GetCheckItemMargin(); }
731 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
, const wxRect
& rect
)
732 { return m_renderer
->GetTextTotalArea(text
, rect
); }
733 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
735 wxCoord
*extraSpaceBeyond
)
736 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
738 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
739 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
741 virtual wxCoord
GetSliderDim() const
742 { return m_renderer
->GetSliderDim(); }
743 virtual wxCoord
GetSliderTickLen() const
744 { return m_renderer
->GetSliderTickLen(); }
745 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
746 wxOrientation orient
) const
747 { return GetSliderShaftRect(rect
, orient
); }
748 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
749 wxOrientation orient
) const
750 { return m_renderer
->GetSliderThumbSize(rect
, orient
); }
751 virtual wxSize
GetProgressBarStep() const
752 { return m_renderer
->GetProgressBarStep(); }
753 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
754 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
755 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
756 const wxMenu
& menu
) const
757 { return m_renderer
->GetMenuGeometry(win
, menu
); }
758 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
759 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
760 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
761 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
762 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
763 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
764 virtual wxSize
GetFrameIconSize() const
765 { return m_renderer
->GetFrameIconSize(); }
766 virtual int HitTestFrame(const wxRect
& rect
,
769 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
770 virtual wxIcon
GetStdIcon(int which
) const
771 { return m_renderer
->GetStdIcon(which
); }
774 wxRenderer
*m_renderer
;
777 // ----------------------------------------------------------------------------
778 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
780 // ----------------------------------------------------------------------------
782 class WXDLLEXPORT wxControlRenderer
785 // create a renderer for this dc with this "fundamental" renderer
786 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
789 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
790 wxCoord marginX
= 0, wxCoord marginY
= 0);
792 void DrawItems(const wxListBox
*listbox
,
793 size_t itemFirst
, size_t itemLast
);
794 #endif // wxUSE_LISTBOX
795 #if wxUSE_CHECKLISTBOX
796 void DrawCheckItems(const wxCheckListBox
*listbox
,
797 size_t itemFirst
, size_t itemLast
);
798 #endif // wxUSE_CHECKLISTBOX
799 void DrawButtonBorder();
800 // the line must be either horizontal or vertical
801 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
803 void DrawBitmap(const wxBitmap
& bitmap
);
804 void DrawBackgroundBitmap();
805 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
807 void DrawProgressBar(const wxGauge
*gauge
);
808 #endif // wxUSE_GAUGE
811 wxWindow
*GetWindow() const { return m_window
; }
812 wxRenderer
*GetRenderer() const { return m_renderer
; }
814 wxDC
& GetDC() { return m_dc
; }
816 const wxRect
& GetRect() const { return m_rect
; }
817 wxRect
& GetRect() { return m_rect
; }
820 static void DrawBitmap(wxDC
&dc
,
821 const wxBitmap
& bitmap
,
823 int alignment
= wxALIGN_CENTRE
|
824 wxALIGN_CENTRE_VERTICAL
,
825 wxStretch stretch
= wxSTRETCH_NOT
);
828 // common part of DrawItems() and DrawCheckItems()
829 void DoDrawItems(const wxListBox
*listbox
,
830 size_t itemFirst
, size_t itemLast
,
831 bool isCheckLbox
= FALSE
);
834 wxRenderer
*m_renderer
;
839 #endif // _WX_UNIV_RENDERER_H_