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 // helper class used by wxMenu-related functions
48 class WXDLLEXPORT wxMenuGeometryInfo
51 // get the total size of the menu
52 virtual wxSize
GetSize() const = 0;
54 virtual ~wxMenuGeometryInfo();
57 // ----------------------------------------------------------------------------
58 // wxRenderer: abstract renderers interface
59 // ----------------------------------------------------------------------------
61 class WXDLLEXPORT wxRenderer
67 // draw the controls background
68 virtual void DrawBackground(wxDC
& dc
,
73 // draw the label inside the given rectangle with the specified alignment
74 // and optionally emphasize the character with the given index
75 virtual void DrawLabel(wxDC
& dc
,
76 const wxString
& label
,
79 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
81 wxRect
*rectBounds
= NULL
) = 0;
83 // same but also draw a bitmap if it is valid
84 virtual void DrawButtonLabel(wxDC
& dc
,
85 const wxString
& label
,
86 const wxBitmap
& image
,
89 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
91 wxRect
*rectBounds
= NULL
) = 0;
93 // draw the border and optionally return the rectangle containing the
94 // region inside the border
95 virtual void DrawBorder(wxDC
& dc
,
99 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
101 // draw text control border (I hate to have a separate method for this but
102 // it is needed to accomodate GTK+)
103 virtual void DrawTextBorder(wxDC
& dc
,
107 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
109 // draw push button border and return the rectangle left for the label
110 virtual void DrawButtonBorder(wxDC
& dc
,
113 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
115 // draw a horizontal line
116 virtual void DrawHorizontalLine(wxDC
& dc
,
117 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
119 // draw a vertical line
120 virtual void DrawVerticalLine(wxDC
& dc
,
121 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
123 // draw a frame with the label (horizontal alignment can be specified)
124 virtual void DrawFrame(wxDC
& dc
,
125 const wxString
& label
,
128 int alignment
= wxALIGN_LEFT
,
129 int indexAccel
= -1) = 0;
131 // draw an arrow in the given direction
132 virtual void DrawArrow(wxDC
& dc
,
137 // draw a scrollbar arrow (may be the same as arrow but may be not)
138 virtual void DrawScrollbarArrow(wxDC
& dc
,
143 // draw the scrollbar thumb
144 virtual void DrawScrollbarThumb(wxDC
& dc
,
145 wxOrientation orient
,
149 // draw a (part of) scrollbar shaft
150 virtual void DrawScrollbarShaft(wxDC
& dc
,
151 wxOrientation orient
,
155 // draw the rectangle in the corner between two scrollbars
156 virtual void DrawScrollCorner(wxDC
& dc
,
157 const wxRect
& rect
) = 0;
159 // draw an item of a wxListBox
160 virtual void DrawItem(wxDC
& dc
,
161 const wxString
& label
,
165 // draw an item of a wxCheckListBox
166 virtual void DrawCheckItem(wxDC
& dc
,
167 const wxString
& label
,
168 const wxBitmap
& bitmap
,
172 // draw a checkbutton (bitmap may be invalid to use default one)
173 virtual void DrawCheckButton(wxDC
& dc
,
174 const wxString
& label
,
175 const wxBitmap
& bitmap
,
178 wxAlignment align
= wxALIGN_LEFT
,
179 int indexAccel
= -1) = 0;
181 // draw a radio button
182 virtual void DrawRadioButton(wxDC
& dc
,
183 const wxString
& label
,
184 const wxBitmap
& bitmap
,
187 wxAlignment align
= wxALIGN_LEFT
,
188 int indexAccel
= -1) = 0;
190 // draw a (part of) line in the text control
191 virtual void DrawTextLine(wxDC
& dc
,
192 const wxString
& text
,
198 // draw a line wrap indicator
199 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
201 // draw a notebook tab
202 virtual void DrawTab(wxDC
& dc
,
205 const wxString
& label
,
206 const wxBitmap
& bitmap
= wxNullBitmap
,
208 int indexAccel
= -1) = 0;
210 // draw the slider shaft
211 virtual void DrawSliderShaft(wxDC
& dc
,
213 wxOrientation orient
,
215 wxRect
*rectShaft
= NULL
) = 0;
217 // draw the slider thumb
218 virtual void DrawSliderThumb(wxDC
& dc
,
220 wxOrientation orient
,
223 // draw the slider ticks
224 virtual void DrawSliderTicks(wxDC
& dc
,
226 const wxSize
& sizeThumb
,
227 wxOrientation orient
,
233 // draw a menu bar item
234 virtual void DrawMenuBarItem(wxDC
& dc
,
236 const wxString
& label
,
238 int indexAccel
= -1) = 0;
240 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
242 // the geometryInfo is calculated by GetMenuGeometry() function from below
243 virtual void DrawMenuItem(wxDC
& dc
,
245 const wxMenuGeometryInfo
& geometryInfo
,
246 const wxString
& label
,
247 const wxString
& accel
,
248 const wxBitmap
& bitmap
= wxNullBitmap
,
250 int indexAccel
= -1) = 0;
252 // draw a menu bar separator
253 virtual void DrawMenuSeparator(wxDC
& dc
,
255 const wxMenuGeometryInfo
& geomInfo
) = 0;
257 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
258 // interpreted specially and means "draw the status bar grip" here
259 virtual void DrawStatusField(wxDC
& dc
,
261 const wxString
& label
,
264 // draw complete frame/dialog titlebar
265 virtual void DrawFrameTitleBar(wxDC
& dc
,
267 const wxString
& title
,
270 int specialButton
= 0,
271 int specialButtonFlags
= 0) = 0;
273 // draw frame borders
274 virtual void DrawFrameBorder(wxDC
& dc
,
278 // draw frame titlebar background
279 virtual void DrawFrameBackground(wxDC
& dc
,
284 virtual void DrawFrameTitle(wxDC
& dc
,
286 const wxString
& title
,
290 virtual void DrawFrameIcon(wxDC
& dc
,
295 // draw frame buttons
296 virtual void DrawFrameButton(wxDC
& dc
,
297 wxCoord x
, wxCoord y
,
304 // return the bitmaps to use for combobox button
305 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
307 wxBitmap
*bmpPressed
,
308 wxBitmap
*bmpDisabled
) = 0;
310 // geometry functions
311 // ------------------
313 // get the dimensions of the border: rect.x/y contain the width/height of
314 // the left/top side, width/heigh - of the right/bottom one
315 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
317 // the scrollbars may be drawn either inside the window border or outside
318 // it - this function is used to decide how to draw them
319 virtual bool AreScrollbarsInsideBorder() const = 0;
321 // adjust the size of the control of the given class: for most controls,
322 // this just takes into account the border, but for some (buttons, for
323 // example) it is more complicated - the result being, in any case, that
324 // the control looks "nice" if it uses the adjusted rectangle
325 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
327 // get the size of a scrollbar arrow
328 virtual wxSize
GetScrollbarArrowSize() const = 0;
330 // gets the bounding box for a scrollbar element for the given (by default
331 // - current) thumb position
332 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
333 wxScrollBar::Element elem
,
334 int thumbPos
= -1) const = 0;
336 // returns the size of the scrollbar shaft excluding the arrows
337 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
339 // returns one of wxHT_SCROLLBAR_XXX constants
340 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
341 const wxPoint
& pt
) const = 0;
343 // translate the scrollbar position (in logical units) into physical
344 // coordinate (in pixels) and the other way round
345 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
346 int thumbPos
= -1) = 0;
347 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
350 // get the height of a listbox item from the base font height
351 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
353 // get the size of a checkbox/radio button bitmap
354 virtual wxSize
GetCheckBitmapSize() const = 0;
355 virtual wxSize
GetRadioBitmapSize() const = 0;
356 virtual wxCoord
GetCheckItemMargin() const = 0;
358 // convert between text rectangle and client rectangle for text controls:
359 // the former is typicall smaller to leave margins around text
360 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
361 const wxRect
& rectText
) = 0;
363 // extra space is for line indicators
364 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
365 const wxRect
& rectTotal
,
366 wxCoord
*extraSpaceBeyond
) = 0;
368 // get the overhang of a selected tab
369 virtual wxSize
GetTabIndent() const = 0;
371 // get the padding around the text in a tab
372 virtual wxSize
GetTabPadding() const = 0;
374 // get the default size of the slider in lesser dimension (i.e. height of a
375 // horizontal slider or width of a vertical one)
376 virtual wxCoord
GetSliderDim() const = 0;
378 // get the length of the slider ticks displayed along side slider
379 virtual wxCoord
GetSliderTickLen() const = 0;
381 // get the slider shaft rect from the total slider rect
382 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
383 wxOrientation orient
) const = 0;
385 // get the size of the slider thumb for the given total slider rect
386 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
387 wxOrientation orient
) const = 0;
389 // get the size of one progress bar step (in horz and vertical directions)
390 virtual wxSize
GetProgressBarStep() const = 0;
392 // get the size of rectangle to use in the menubar for the given text rect
393 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
395 // get the struct storing all layout info needed to draw all menu items
396 // (this can't be calculated for each item separately as they should be
399 // the returned pointer must be deleted by the caller
400 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
401 const wxMenu
& menu
) const = 0;
403 // get the borders around the status bar fields (x and y fields of the
404 // return value) and also, optionally, the border between the fields
405 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
407 // get client area rectangle of top level window (i.e. subtract
408 // decorations from given rectangle)
409 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
411 // get size of whole top level window, given size of its client area size
412 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
414 // get titlebar icon size
415 virtual wxSize
GetFrameIconSize() const = 0;
417 // returns one of wxHT_TOPLEVEL_XXX constants
418 virtual int HitTestFrame(const wxRect
& rect
,
420 int flags
= 0) const = 0;
422 // virtual dtor for any base class
423 virtual ~wxRenderer();
426 // draw a frame around rectFrame rectangle but not touching the rectLabel
427 // one: this is used by DrawFrame()
428 void StandardDrawFrame(wxDC
& dc
,
429 const wxRect
& rectFrame
,
430 const wxRect
& rectLabel
);
432 // standard text line drawing: just use DrawText() and highlight the
434 static void StandardDrawTextLine(wxDC
& dc
,
435 const wxString
& text
,
437 int selStart
, int selEnd
,
440 // standard scrollbar hit testing: this assumes that it only has 2 arrows
441 // and a thumb, so the themes which have more complicated scrollbars (e.g.
442 // BeOS) can't use this method
443 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
444 wxScrollBar::Element elem
,
446 const wxSize
& sizeArrow
);
447 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
449 const wxSize
& sizeArrow
);
450 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
452 const wxSize
& sizeArrow
);
453 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
455 const wxSize
& sizeArrow
);
456 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
457 const wxSize
& sizeArrow
);
458 static void StandardScrollBarThumbSize(wxCoord lenBar
,
466 // ----------------------------------------------------------------------------
467 // wxDelegateRenderer: it is impossible to inherit from any of standard
468 // renderers as their declarations are in private code, but you can use this
469 // class to override only some of the Draw() functions - all the other ones
470 // will be left to the original renderer
471 // ----------------------------------------------------------------------------
473 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
476 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
478 virtual void DrawBackground(wxDC
& dc
,
482 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
); }
483 virtual void DrawLabel(wxDC
& dc
,
484 const wxString
& label
,
487 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
489 wxRect
*rectBounds
= NULL
)
490 { m_renderer
->DrawLabel(dc
, label
, rect
,
491 flags
, align
, indexAccel
, rectBounds
); }
492 virtual void DrawButtonLabel(wxDC
& dc
,
493 const wxString
& label
,
494 const wxBitmap
& image
,
497 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
499 wxRect
*rectBounds
= NULL
)
500 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
501 flags
, align
, indexAccel
, rectBounds
); }
502 virtual void DrawBorder(wxDC
& dc
,
506 wxRect
*rectIn
= (wxRect
*)NULL
)
507 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
508 virtual void DrawTextBorder(wxDC
& dc
,
512 wxRect
*rectIn
= (wxRect
*)NULL
)
513 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
514 virtual void DrawButtonBorder(wxDC
& dc
,
517 wxRect
*rectIn
= (wxRect
*)NULL
)
518 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
519 virtual void DrawFrame(wxDC
& dc
,
520 const wxString
& label
,
523 int align
= wxALIGN_LEFT
,
525 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
526 virtual void DrawHorizontalLine(wxDC
& dc
,
527 wxCoord y
, wxCoord x1
, wxCoord x2
)
528 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
529 virtual void DrawVerticalLine(wxDC
& dc
,
530 wxCoord x
, wxCoord y1
, wxCoord y2
)
531 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
532 virtual void DrawArrow(wxDC
& dc
,
536 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
537 virtual void DrawScrollbarArrow(wxDC
& dc
,
541 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
542 virtual void DrawScrollbarThumb(wxDC
& dc
,
543 wxOrientation orient
,
546 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
547 virtual void DrawScrollbarShaft(wxDC
& dc
,
548 wxOrientation orient
,
551 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
552 virtual void DrawScrollCorner(wxDC
& dc
,
554 { m_renderer
->DrawScrollCorner(dc
, rect
); }
555 virtual void DrawItem(wxDC
& dc
,
556 const wxString
& label
,
559 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
560 virtual void DrawCheckItem(wxDC
& dc
,
561 const wxString
& label
,
562 const wxBitmap
& bitmap
,
565 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
566 virtual void DrawCheckButton(wxDC
& dc
,
567 const wxString
& label
,
568 const wxBitmap
& bitmap
,
571 wxAlignment align
= wxALIGN_LEFT
,
573 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
574 flags
, align
, indexAccel
); }
575 virtual void DrawRadioButton(wxDC
& dc
,
576 const wxString
& label
,
577 const wxBitmap
& bitmap
,
580 wxAlignment align
= wxALIGN_LEFT
,
582 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
583 flags
, align
, indexAccel
); }
584 virtual void DrawTextLine(wxDC
& dc
,
585 const wxString
& text
,
589 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
); }
590 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
591 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
593 virtual void DrawTab(wxDC
& dc
,
596 const wxString
& label
,
597 const wxBitmap
& bitmap
= wxNullBitmap
,
600 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
602 virtual void DrawSliderShaft(wxDC
& dc
,
604 wxOrientation orient
,
606 wxRect
*rectShaft
= NULL
)
607 { m_renderer
->DrawSliderShaft(dc
, rect
, orient
, flags
, rectShaft
); }
608 virtual void DrawSliderThumb(wxDC
& dc
,
610 wxOrientation orient
,
612 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
); }
613 virtual void DrawSliderTicks(wxDC
& dc
,
615 const wxSize
& sizeThumb
,
616 wxOrientation orient
,
621 { m_renderer
->DrawSliderTicks(dc
, rect
, sizeThumb
, orient
,
622 start
, end
, start
, flags
); }
624 virtual void DrawMenuBarItem(wxDC
& dc
,
626 const wxString
& label
,
629 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
630 virtual void DrawMenuItem(wxDC
& dc
,
632 const wxMenuGeometryInfo
& gi
,
633 const wxString
& label
,
634 const wxString
& accel
,
635 const wxBitmap
& bitmap
= wxNullBitmap
,
638 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
639 bitmap
, flags
, indexAccel
); }
640 virtual void DrawMenuSeparator(wxDC
& dc
,
642 const wxMenuGeometryInfo
& geomInfo
)
643 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
645 virtual void DrawStatusField(wxDC
& dc
,
647 const wxString
& label
,
649 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
); }
651 virtual void DrawFrameTitleBar(wxDC
& dc
,
653 const wxString
& title
,
656 int specialButton
= 0,
657 int specialButtonFlag
= 0)
658 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
659 specialButton
, specialButtonFlag
); }
660 virtual void DrawFrameBorder(wxDC
& dc
,
663 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
664 virtual void DrawFrameBackground(wxDC
& dc
,
667 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
668 virtual void DrawFrameTitle(wxDC
& dc
,
670 const wxString
& title
,
672 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
673 virtual void DrawFrameIcon(wxDC
& dc
,
677 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
678 virtual void DrawFrameButton(wxDC
& dc
,
679 wxCoord x
, wxCoord y
,
682 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
684 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
686 wxBitmap
*bmpPressed
,
687 wxBitmap
*bmpDisabled
) const
688 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
689 bmpPressed
, bmpDisabled
); }
691 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
692 { m_renderer
->AdjustSize(size
, window
); }
693 virtual wxRect
GetBorderDimensions(wxBorder border
) const
694 { return m_renderer
->GetBorderDimensions(border
); }
695 virtual bool AreScrollbarsInsideBorder() const
696 { return m_renderer
->AreScrollbarsInsideBorder(); }
698 virtual wxSize
GetScrollbarArrowSize() const
699 { return m_renderer
->GetScrollbarArrowSize(); }
700 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
701 wxScrollBar::Element elem
,
702 int thumbPos
= -1) const
703 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
704 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
705 { return m_renderer
->GetScrollbarSize(scrollbar
); }
706 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
707 const wxPoint
& pt
) const
708 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
709 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
711 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
712 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
714 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
715 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
716 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
717 virtual wxSize
GetCheckBitmapSize() const
718 { return m_renderer
->GetCheckBitmapSize(); }
719 virtual wxSize
GetRadioBitmapSize() const
720 { return m_renderer
->GetRadioBitmapSize(); }
721 virtual wxCoord
GetCheckItemMargin() const
722 { return m_renderer
->GetCheckItemMargin(); }
724 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
, const wxRect
& rect
)
725 { return m_renderer
->GetTextTotalArea(text
, rect
); }
726 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
728 wxCoord
*extraSpaceBeyond
)
729 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
731 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
732 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
734 virtual wxCoord
GetSliderDim() const
735 { return m_renderer
->GetSliderDim(); }
736 virtual wxCoord
GetSliderTickLen() const
737 { return m_renderer
->GetSliderTickLen(); }
738 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
739 wxOrientation orient
) const
740 { return GetSliderShaftRect(rect
, orient
); }
741 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
742 wxOrientation orient
) const
743 { return m_renderer
->GetSliderThumbSize(rect
, orient
); }
744 virtual wxSize
GetProgressBarStep() const
745 { return m_renderer
->GetProgressBarStep(); }
746 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
747 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
748 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
749 const wxMenu
& menu
) const
750 { return m_renderer
->GetMenuGeometry(win
, menu
); }
751 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
752 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
753 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
754 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
755 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
756 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
757 virtual wxSize
GetFrameIconSize() const
758 { return m_renderer
->GetFrameIconSize(); }
759 virtual int HitTestFrame(const wxRect
& rect
,
762 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
765 wxRenderer
*m_renderer
;
768 // ----------------------------------------------------------------------------
769 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
771 // ----------------------------------------------------------------------------
773 class WXDLLEXPORT wxControlRenderer
776 // create a renderer for this dc with this "fundamental" renderer
777 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
780 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
781 wxCoord marginX
= 0, wxCoord marginY
= 0);
783 void DrawItems(const wxListBox
*listbox
,
784 size_t itemFirst
, size_t itemLast
);
785 #endif // wxUSE_LISTBOX
786 #if wxUSE_CHECKLISTBOX
787 void DrawCheckItems(const wxCheckListBox
*listbox
,
788 size_t itemFirst
, size_t itemLast
);
789 #endif // wxUSE_CHECKLISTBOX
790 void DrawButtonBorder();
791 // the line must be either horizontal or vertical
792 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
794 void DrawBitmap(const wxBitmap
& bitmap
);
795 void DrawBackgroundBitmap();
796 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
798 void DrawProgressBar(const wxGauge
*gauge
);
799 #endif // wxUSE_GAUGE
802 wxWindow
*GetWindow() const { return m_window
; }
803 wxRenderer
*GetRenderer() const { return m_renderer
; }
805 wxDC
& GetDC() { return m_dc
; }
807 const wxRect
& GetRect() const { return m_rect
; }
808 wxRect
& GetRect() { return m_rect
; }
811 static void DrawBitmap(wxDC
&dc
,
812 const wxBitmap
& bitmap
,
814 int alignment
= wxALIGN_CENTRE
|
815 wxALIGN_CENTRE_VERTICAL
,
816 wxStretch stretch
= wxSTRETCH_NOT
);
819 // common part of DrawItems() and DrawCheckItems()
820 void DoDrawItems(const wxListBox
*listbox
,
821 size_t itemFirst
, size_t itemLast
,
822 bool isCheckLbox
= FALSE
);
825 wxRenderer
*m_renderer
;
830 #endif // _WX_UNIV_RENDERER_H_