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"
45 #include "wx/scrolbar.h" // for wxScrollBar::Element
47 // ----------------------------------------------------------------------------
48 // wxRenderer: abstract renderers interface
49 // ----------------------------------------------------------------------------
51 class WXDLLEXPORT wxRenderer
57 // draw the controls background
58 virtual void DrawBackground(wxDC
& dc
,
63 // draw the label inside the given rectangle with the specified alignment
64 // and optionally emphasize the character with the given index
65 virtual void DrawLabel(wxDC
& dc
,
66 const wxString
& label
,
69 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
71 wxRect
*rectBounds
= NULL
) = 0;
73 // same but also draw a bitmap if it is valid
74 virtual void DrawButtonLabel(wxDC
& dc
,
75 const wxString
& label
,
76 const wxBitmap
& image
,
79 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
81 wxRect
*rectBounds
= NULL
) = 0;
83 // draw the border and optionally return the rectangle containing the
84 // region inside the border
85 virtual void DrawBorder(wxDC
& dc
,
89 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
91 // draw text control border (I hate to have a separate method for this but
92 // it is needed to accomodate GTK+)
93 virtual void DrawTextBorder(wxDC
& dc
,
97 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
99 // draw push button border and return the rectangle left for the label
100 virtual void DrawButtonBorder(wxDC
& dc
,
103 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
105 // draw a horizontal line
106 virtual void DrawHorizontalLine(wxDC
& dc
,
107 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
109 // draw a vertical line
110 virtual void DrawVerticalLine(wxDC
& dc
,
111 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
113 // draw a frame with the label (horizontal alignment can be specified)
114 virtual void DrawFrame(wxDC
& dc
,
115 const wxString
& label
,
118 int alignment
= wxALIGN_LEFT
,
119 int indexAccel
= -1) = 0;
121 // draw an arrow in the given direction
122 virtual void DrawArrow(wxDC
& dc
,
127 // draw a scrollbar arrow (may be the same as arrow but may be not)
128 virtual void DrawScrollbarArrow(wxDC
& dc
,
133 // draw the scrollbar thumb
134 virtual void DrawScrollbarThumb(wxDC
& dc
,
135 wxOrientation orient
,
139 // draw a (part of) scrollbar shaft
140 virtual void DrawScrollbarShaft(wxDC
& dc
,
141 wxOrientation orient
,
145 // draw the rectangle in the corner between two scrollbars
146 virtual void DrawScrollCorner(wxDC
& dc
,
147 const wxRect
& rect
) = 0;
149 // draw an item of a wxListBox
150 virtual void DrawItem(wxDC
& dc
,
151 const wxString
& label
,
155 // draw an item of a wxCheckListBox
156 virtual void DrawCheckItem(wxDC
& dc
,
157 const wxString
& label
,
158 const wxBitmap
& bitmap
,
162 // draw a checkbutton (bitmap may be invalid to use default one)
163 virtual void DrawCheckButton(wxDC
& dc
,
164 const wxString
& label
,
165 const wxBitmap
& bitmap
,
168 wxAlignment align
= wxALIGN_LEFT
,
169 int indexAccel
= -1) = 0;
171 // draw a radio button
172 virtual void DrawRadioButton(wxDC
& dc
,
173 const wxString
& label
,
174 const wxBitmap
& bitmap
,
177 wxAlignment align
= wxALIGN_LEFT
,
178 int indexAccel
= -1) = 0;
180 // draw a (part of) line in the text control
181 virtual void DrawTextLine(wxDC
& dc
,
182 const wxString
& text
,
188 // draw a line wrap indicator
189 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
191 // draw a notebook tab
192 virtual void DrawTab(wxDC
& dc
,
195 const wxString
& label
,
196 const wxBitmap
& bitmap
= wxNullBitmap
,
198 int indexAccel
= -1) = 0;
200 // draw the slider shaft
201 virtual void DrawSliderShaft(wxDC
& dc
,
203 wxOrientation orient
,
205 wxRect
*rectShaft
= NULL
) = 0;
207 // draw the slider thumb
208 virtual void DrawSliderThumb(wxDC
& dc
,
210 wxOrientation orient
,
213 // draw the slider ticks
214 virtual void DrawSliderTicks(wxDC
& dc
,
216 const wxSize
& sizeThumb
,
217 wxOrientation orient
,
224 // draw a menu bar item
225 virtual void DrawMenuBarItem(wxDC
& dc
,
227 const wxString
& label
,
229 int indexAccel
= -1) = 0;
231 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
233 // the geometryInfo is calculated by GetMenuGeometry() function from below
234 virtual void DrawMenuItem(wxDC
& dc
,
236 const wxMenuGeometryInfo
& geometryInfo
,
237 const wxString
& label
,
238 const wxString
& accel
,
239 const wxBitmap
& bitmap
= wxNullBitmap
,
241 int indexAccel
= -1) = 0;
243 // draw a menu bar separator
244 virtual void DrawMenuSeparator(wxDC
& dc
,
246 const wxMenuGeometryInfo
& geomInfo
) = 0;
248 // draw complete frame/dialog titlebar
249 virtual void DrawFrameTitleBar(wxDC
& dc
,
251 const wxString
& title
,
254 int specialButton
= 0,
255 int specialButtonFlags
= 0) = 0;
257 // draw frame borders
258 virtual void DrawFrameBorder(wxDC
& dc
,
262 // draw frame titlebar background
263 virtual void DrawFrameBackground(wxDC
& dc
,
268 virtual void DrawFrameTitle(wxDC
& dc
,
270 const wxString
& title
,
274 virtual void DrawFrameIcon(wxDC
& dc
,
279 // draw frame buttons
280 virtual void DrawFrameButton(wxDC
& dc
,
281 wxCoord x
, wxCoord y
,
288 // return the bitmaps to use for combobox button
289 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
291 wxBitmap
*bmpPressed
,
292 wxBitmap
*bmpDisabled
) = 0;
294 // geometry functions
295 // ------------------
297 // get the dimensions of the border: rect.x/y contain the width/height of
298 // the left/top side, width/heigh - of the right/bottom one
299 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
301 // the scrollbars may be drawn either inside the window border or outside
302 // it - this function is used to decide how to draw them
303 virtual bool AreScrollbarsInsideBorder() const = 0;
305 // adjust the size of the control of the given class: for most controls,
306 // this just takes into account the border, but for some (buttons, for
307 // example) it is more complicated - the result being, in any case, that
308 // the control looks "nice" if it uses the adjusted rectangle
309 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
311 // get the size of a scrollbar arrow
312 virtual wxSize
GetScrollbarArrowSize() const = 0;
314 // gets the bounding box for a scrollbar element for the given (by default
315 // - current) thumb position
316 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
317 wxScrollBar::Element elem
,
318 int thumbPos
= -1) const = 0;
320 // returns the size of the scrollbar shaft excluding the arrows
321 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
323 // returns one of wxHT_SCROLLBAR_XXX constants
324 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
325 const wxPoint
& pt
) const = 0;
327 // translate the scrollbar position (in logical units) into physical
328 // coordinate (in pixels) and the other way round
329 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
330 int thumbPos
= -1) = 0;
331 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
334 // get the height of a listbox item from the base font height
335 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
337 // get the size of a checkbox/radio button bitmap
338 virtual wxSize
GetCheckBitmapSize() const = 0;
339 virtual wxSize
GetRadioBitmapSize() const = 0;
340 virtual wxCoord
GetCheckItemMargin() const = 0;
342 // convert between text rectangle and client rectangle for text controls:
343 // the former is typicall smaller to leave margins around text
344 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
345 const wxRect
& rectText
) = 0;
347 // extra space is for line indicators
348 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
349 const wxRect
& rectTotal
,
350 wxCoord
*extraSpaceBeyond
) = 0;
352 // get the overhang of a selected tab
353 virtual wxSize
GetTabIndent() const = 0;
355 // get the padding around the text in a tab
356 virtual wxSize
GetTabPadding() const = 0;
358 // get the default size of the slider in lesser dimension (i.e. height of a
359 // horizontal slider or width of a vertical one)
360 virtual wxCoord
GetSliderDim() const = 0;
362 // get the length of the slider ticks displayed along side slider
363 virtual wxCoord
GetSliderTickLen() const = 0;
365 // get the slider shaft rect from the total slider rect
366 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
367 wxOrientation orient
) const = 0;
369 // get the size of the slider thumb for the given total slider rect
370 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
371 wxOrientation orient
) const = 0;
373 // get the size of one progress bar step (in horz and vertical directions)
374 virtual wxSize
GetProgressBarStep() const = 0;
377 // get the size of rectangle to use in the menubar for the given text rect
378 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
380 // get the struct storing all layout info needed to draw all menu items
381 // (this can't be calculated for each item separately as they should be
384 // the returned pointer must be deleted by the caller
385 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
386 const wxMenu
& menu
) const = 0;
389 // get client area rectangle of top level window (i.e. subtract
390 // decorations from given rectangle)
391 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
392 // get size of whole top level window, given size of its client area size
393 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
394 // get titlebar icon size
395 virtual wxSize
GetFrameIconSize() const = 0;
396 // returns one of wxHT_TOPLEVEL_XXX constants
397 virtual int HitTestFrame(const wxRect
& rect
,
399 int flags
) const = 0;
401 // virtual dtor for any base class
402 virtual ~wxRenderer();
405 // draw a frame around rectFrame rectangle but not touching the rectLabel
406 // one: this is used by DrawFrame()
407 void StandardDrawFrame(wxDC
& dc
,
408 const wxRect
& rectFrame
,
409 const wxRect
& rectLabel
);
411 // standard text line drawing: just use DrawText() and highlight the
413 static void StandardDrawTextLine(wxDC
& dc
,
414 const wxString
& text
,
416 int selStart
, int selEnd
,
419 // standard scrollbar hit testing: this assumes that it only has 2 arrows
420 // and a thumb, so the themes which have more complicated scrollbars (e.g.
421 // BeOS) can't use this method
422 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
423 wxScrollBar::Element elem
,
425 const wxSize
& sizeArrow
);
426 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
428 const wxSize
& sizeArrow
);
429 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
431 const wxSize
& sizeArrow
);
432 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
434 const wxSize
& sizeArrow
);
435 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
436 const wxSize
& sizeArrow
);
437 static void StandardScrollBarThumbSize(wxCoord lenBar
,
445 // ----------------------------------------------------------------------------
446 // wxDelegateRenderer: it is impossible to inherit from any of standard
447 // renderers as their declarations are in private code, but you can use this
448 // class to override only some of the Draw() functions - all the other ones
449 // will be left to the original renderer
450 // ----------------------------------------------------------------------------
452 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
455 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
457 virtual void DrawBackground(wxDC
& dc
,
461 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
); }
462 virtual void DrawLabel(wxDC
& dc
,
463 const wxString
& label
,
466 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
468 wxRect
*rectBounds
= NULL
)
469 { m_renderer
->DrawLabel(dc
, label
, rect
,
470 flags
, align
, indexAccel
, rectBounds
); }
471 virtual void DrawButtonLabel(wxDC
& dc
,
472 const wxString
& label
,
473 const wxBitmap
& image
,
476 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
478 wxRect
*rectBounds
= NULL
)
479 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
480 flags
, align
, indexAccel
, rectBounds
); }
481 virtual void DrawBorder(wxDC
& dc
,
485 wxRect
*rectIn
= (wxRect
*)NULL
)
486 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
487 virtual void DrawTextBorder(wxDC
& dc
,
491 wxRect
*rectIn
= (wxRect
*)NULL
)
492 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
493 virtual void DrawButtonBorder(wxDC
& dc
,
496 wxRect
*rectIn
= (wxRect
*)NULL
)
497 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
498 virtual void DrawFrame(wxDC
& dc
,
499 const wxString
& label
,
502 int align
= wxALIGN_LEFT
,
504 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
505 virtual void DrawHorizontalLine(wxDC
& dc
,
506 wxCoord y
, wxCoord x1
, wxCoord x2
)
507 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
508 virtual void DrawVerticalLine(wxDC
& dc
,
509 wxCoord x
, wxCoord y1
, wxCoord y2
)
510 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
511 virtual void DrawArrow(wxDC
& dc
,
515 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
516 virtual void DrawScrollbarArrow(wxDC
& dc
,
520 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
521 virtual void DrawScrollbarThumb(wxDC
& dc
,
522 wxOrientation orient
,
525 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
526 virtual void DrawScrollbarShaft(wxDC
& dc
,
527 wxOrientation orient
,
530 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
531 virtual void DrawScrollCorner(wxDC
& dc
,
533 { m_renderer
->DrawScrollCorner(dc
, rect
); }
534 virtual void DrawItem(wxDC
& dc
,
535 const wxString
& label
,
538 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
539 virtual void DrawCheckItem(wxDC
& dc
,
540 const wxString
& label
,
541 const wxBitmap
& bitmap
,
544 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
545 virtual void DrawCheckButton(wxDC
& dc
,
546 const wxString
& label
,
547 const wxBitmap
& bitmap
,
550 wxAlignment align
= wxALIGN_LEFT
,
552 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
553 flags
, align
, indexAccel
); }
554 virtual void DrawRadioButton(wxDC
& dc
,
555 const wxString
& label
,
556 const wxBitmap
& bitmap
,
559 wxAlignment align
= wxALIGN_LEFT
,
561 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
562 flags
, align
, indexAccel
); }
563 virtual void DrawTextLine(wxDC
& dc
,
564 const wxString
& text
,
568 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
); }
569 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
570 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
572 virtual void DrawTab(wxDC
& dc
,
575 const wxString
& label
,
576 const wxBitmap
& bitmap
= wxNullBitmap
,
579 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
581 virtual void DrawSliderShaft(wxDC
& dc
,
583 wxOrientation orient
,
585 wxRect
*rectShaft
= NULL
)
586 { m_renderer
->DrawSliderShaft(dc
, rect
, orient
, flags
, rectShaft
); }
587 virtual void DrawSliderThumb(wxDC
& dc
,
589 wxOrientation orient
,
591 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
); }
592 virtual void DrawSliderTicks(wxDC
& dc
,
594 const wxSize
& sizeThumb
,
595 wxOrientation orient
,
600 { m_renderer
->DrawSliderTicks(dc
, rect
, sizeThumb
, orient
,
601 start
, end
, start
, flags
); }
604 virtual void DrawMenuBarItem(wxDC
& dc
,
606 const wxString
& label
,
609 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
610 virtual void DrawMenuItem(wxDC
& dc
,
612 const wxMenuGeometryInfo
& gi
,
613 const wxString
& label
,
614 const wxString
& accel
,
615 const wxBitmap
& bitmap
= wxNullBitmap
,
618 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
619 bitmap
, flags
, indexAccel
); }
620 virtual void DrawMenuSeparator(wxDC
& dc
,
622 const wxMenuGeometryInfo
& geomInfo
)
623 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
625 virtual void DrawFrameTitleBar(wxDC
& dc
,
627 const wxString
& title
,
630 int specialButton
= 0,
631 int specialButtonFlag
= 0)
632 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
633 specialButton
, specialButtonFlag
); }
634 virtual void DrawFrameBorder(wxDC
& dc
,
637 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
638 virtual void DrawFrameBackground(wxDC
& dc
,
641 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
642 virtual void DrawFrameTitle(wxDC
& dc
,
644 const wxString
& title
,
646 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
647 virtual void DrawFrameIcon(wxDC
& dc
,
651 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
652 virtual void DrawFrameButton(wxDC
& dc
,
653 wxCoord x
, wxCoord y
,
656 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
658 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
660 wxBitmap
*bmpPressed
,
661 wxBitmap
*bmpDisabled
) const
662 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
663 bmpPressed
, bmpDisabled
); }
665 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
666 { m_renderer
->AdjustSize(size
, window
); }
667 virtual wxRect
GetBorderDimensions(wxBorder border
) const
668 { return m_renderer
->GetBorderDimensions(border
); }
669 virtual bool AreScrollbarsInsideBorder() const
670 { return m_renderer
->AreScrollbarsInsideBorder(); }
672 virtual wxSize
GetScrollbarArrowSize() const
673 { return m_renderer
->GetScrollbarArrowSize(); }
674 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
675 wxScrollBar::Element elem
,
676 int thumbPos
= -1) const
677 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
678 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
679 { return m_renderer
->GetScrollbarSize(scrollbar
); }
680 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
681 const wxPoint
& pt
) const
682 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
683 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
685 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
686 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
688 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
689 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
690 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
691 virtual wxSize
GetCheckBitmapSize() const
692 { return m_renderer
->GetCheckBitmapSize(); }
693 virtual wxSize
GetRadioBitmapSize() const
694 { return m_renderer
->GetRadioBitmapSize(); }
695 virtual wxCoord
GetCheckItemMargin() const
696 { return m_renderer
->GetCheckItemMargin(); }
698 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
, const wxRect
& rect
)
699 { return m_renderer
->GetTextTotalArea(text
, rect
); }
700 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
702 wxCoord
*extraSpaceBeyond
)
703 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
705 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
706 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
708 virtual wxCoord
GetSliderDim() const
709 { return m_renderer
->GetSliderDim(); }
710 virtual wxCoord
GetSliderTickLen() const
711 { return m_renderer
->GetSliderTickLen(); }
712 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
713 wxOrientation orient
) const
714 { return GetSliderShaftRect(rect
, orient
); }
715 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
716 wxOrientation orient
) const
717 { return m_renderer
->GetSliderThumbSize(rect
, orient
); }
718 virtual wxSize
GetProgressBarStep() const
719 { return m_renderer
->GetProgressBarStep(); }
721 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
722 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
723 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
724 const wxMenu
& menu
) const
725 { return m_renderer
->GetMenuGeometry(win
, menu
); }
727 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
728 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
729 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
730 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
731 virtual wxSize
GetFrameIconSize() const
732 { return m_renderer
->GetFrameIconSize(); }
733 virtual int HitTestFrame(const wxRect
& rect
,
736 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
739 wxRenderer
*m_renderer
;
742 // ----------------------------------------------------------------------------
743 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
745 // ----------------------------------------------------------------------------
747 class WXDLLEXPORT wxControlRenderer
750 // create a renderer for this dc with this "fundamental" renderer
751 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
754 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
755 wxCoord marginX
= 0, wxCoord marginY
= 0);
757 void DrawItems(const wxListBox
*listbox
,
758 size_t itemFirst
, size_t itemLast
);
759 #endif // wxUSE_LISTBOX
760 #if wxUSE_CHECKLISTBOX
761 void DrawCheckItems(const wxCheckListBox
*listbox
,
762 size_t itemFirst
, size_t itemLast
);
763 #endif // wxUSE_CHECKLISTBOX
764 void DrawButtonBorder();
765 // the line must be either horizontal or vertical
766 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
768 void DrawBitmap(const wxBitmap
& bitmap
);
769 void DrawBackgroundBitmap();
770 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
772 void DrawProgressBar(const wxGauge
*gauge
);
773 #endif // wxUSE_GAUGE
776 wxWindow
*GetWindow() const { return m_window
; }
777 wxRenderer
*GetRenderer() const { return m_renderer
; }
779 wxDC
& GetDC() { return m_dc
; }
781 const wxRect
& GetRect() const { return m_rect
; }
782 wxRect
& GetRect() { return m_rect
; }
785 static void DrawBitmap(wxDC
&dc
,
786 const wxBitmap
& bitmap
,
788 int alignment
= wxALIGN_CENTRE
|
789 wxALIGN_CENTRE_VERTICAL
,
790 wxStretch stretch
= wxSTRETCH_NOT
);
793 // common part of DrawItems() and DrawCheckItems()
794 void DoDrawItems(const wxListBox
*listbox
,
795 size_t itemFirst
, size_t itemLast
,
796 bool isCheckLbox
= FALSE
);
799 wxRenderer
*m_renderer
;
804 #endif // _WX_UNIV_RENDERER_H_