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
,
73 wxWindow
*window
= NULL
) = 0;
75 // draw the button surface
76 virtual void DrawButtonSurface(wxDC
& dc
,
80 { DrawBackground( dc
, col
, rect
, flags
); }
83 // draw the label inside the given rectangle with the specified alignment
84 // and optionally emphasize the character with the given index
85 virtual void DrawLabel(wxDC
& dc
,
86 const wxString
& label
,
89 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
91 wxRect
*rectBounds
= NULL
) = 0;
93 // same but also draw a bitmap if it is valid
94 virtual void DrawButtonLabel(wxDC
& dc
,
95 const wxString
& label
,
96 const wxBitmap
& image
,
99 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
101 wxRect
*rectBounds
= NULL
) = 0;
103 // draw the border and optionally return the rectangle containing the
104 // region inside the border
105 virtual void DrawBorder(wxDC
& dc
,
109 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
111 // draw text control border (I hate to have a separate method for this but
112 // it is needed to accomodate GTK+)
113 virtual void DrawTextBorder(wxDC
& dc
,
117 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
119 // draw push button border and return the rectangle left for the label
120 virtual void DrawButtonBorder(wxDC
& dc
,
123 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
125 // draw a horizontal line
126 virtual void DrawHorizontalLine(wxDC
& dc
,
127 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
129 // draw a vertical line
130 virtual void DrawVerticalLine(wxDC
& dc
,
131 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
133 // draw a frame with the label (horizontal alignment can be specified)
134 virtual void DrawFrame(wxDC
& dc
,
135 const wxString
& label
,
138 int alignment
= wxALIGN_LEFT
,
139 int indexAccel
= -1) = 0;
141 // draw an arrow in the given direction
142 virtual void DrawArrow(wxDC
& dc
,
147 // draw a scrollbar arrow (may be the same as arrow but may be not)
148 virtual void DrawScrollbarArrow(wxDC
& dc
,
153 // draw the scrollbar thumb
154 virtual void DrawScrollbarThumb(wxDC
& dc
,
155 wxOrientation orient
,
159 // draw a (part of) scrollbar shaft
160 virtual void DrawScrollbarShaft(wxDC
& dc
,
161 wxOrientation orient
,
165 // draw the rectangle in the corner between two scrollbars
166 virtual void DrawScrollCorner(wxDC
& dc
,
167 const wxRect
& rect
) = 0;
169 // draw an item of a wxListBox
170 virtual void DrawItem(wxDC
& dc
,
171 const wxString
& label
,
175 // draw an item of a wxCheckListBox
176 virtual void DrawCheckItem(wxDC
& dc
,
177 const wxString
& label
,
178 const wxBitmap
& bitmap
,
182 // draw a checkbutton (bitmap may be invalid to use default one)
183 virtual void DrawCheckButton(wxDC
& dc
,
184 const wxString
& label
,
185 const wxBitmap
& bitmap
,
188 wxAlignment align
= wxALIGN_LEFT
,
189 int indexAccel
= -1) = 0;
191 // draw a radio button
192 virtual void DrawRadioButton(wxDC
& dc
,
193 const wxString
& label
,
194 const wxBitmap
& bitmap
,
197 wxAlignment align
= wxALIGN_LEFT
,
198 int indexAccel
= -1) = 0;
200 // draw a toolbar button (label may be empty, bitmap may be invalid, if
201 // both conditions are true this function draws a separator)
202 virtual void DrawToolBarButton(wxDC
& dc
,
203 const wxString
& label
,
204 const wxBitmap
& bitmap
,
208 // draw a (part of) line in the text control
209 virtual void DrawTextLine(wxDC
& dc
,
210 const wxString
& text
,
216 // draw a line wrap indicator
217 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
219 // draw a notebook tab
220 virtual void DrawTab(wxDC
& dc
,
223 const wxString
& label
,
224 const wxBitmap
& bitmap
= wxNullBitmap
,
226 int indexAccel
= -1) = 0;
228 // draw the slider shaft
229 virtual void DrawSliderShaft(wxDC
& dc
,
231 wxOrientation orient
,
233 wxRect
*rectShaft
= NULL
) = 0;
235 // draw the slider thumb
236 virtual void DrawSliderThumb(wxDC
& dc
,
238 wxOrientation orient
,
241 // draw the slider ticks
242 virtual void DrawSliderTicks(wxDC
& dc
,
244 const wxSize
& sizeThumb
,
245 wxOrientation orient
,
251 // draw a menu bar item
252 virtual void DrawMenuBarItem(wxDC
& dc
,
254 const wxString
& label
,
256 int indexAccel
= -1) = 0;
258 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
260 // the geometryInfo is calculated by GetMenuGeometry() function from below
261 virtual void DrawMenuItem(wxDC
& dc
,
263 const wxMenuGeometryInfo
& geometryInfo
,
264 const wxString
& label
,
265 const wxString
& accel
,
266 const wxBitmap
& bitmap
= wxNullBitmap
,
268 int indexAccel
= -1) = 0;
270 // draw a menu bar separator
271 virtual void DrawMenuSeparator(wxDC
& dc
,
273 const wxMenuGeometryInfo
& geomInfo
) = 0;
275 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
276 // interpreted specially and means "draw the status bar grip" here
277 virtual void DrawStatusField(wxDC
& dc
,
279 const wxString
& label
,
282 // draw complete frame/dialog titlebar
283 virtual void DrawFrameTitleBar(wxDC
& dc
,
285 const wxString
& title
,
288 int specialButton
= 0,
289 int specialButtonFlags
= 0) = 0;
291 // draw frame borders
292 virtual void DrawFrameBorder(wxDC
& dc
,
296 // draw frame titlebar background
297 virtual void DrawFrameBackground(wxDC
& dc
,
302 virtual void DrawFrameTitle(wxDC
& dc
,
304 const wxString
& title
,
308 virtual void DrawFrameIcon(wxDC
& dc
,
313 // draw frame buttons
314 virtual void DrawFrameButton(wxDC
& dc
,
315 wxCoord x
, wxCoord y
,
322 // return the bitmaps to use for combobox button
323 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
325 wxBitmap
*bmpPressed
,
326 wxBitmap
*bmpDisabled
) = 0;
328 // geometry functions
329 // ------------------
331 // get the dimensions of the border: rect.x/y contain the width/height of
332 // the left/top side, width/heigh - of the right/bottom one
333 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
335 // the scrollbars may be drawn either inside the window border or outside
336 // it - this function is used to decide how to draw them
337 virtual bool AreScrollbarsInsideBorder() const = 0;
339 // adjust the size of the control of the given class: for most controls,
340 // this just takes into account the border, but for some (buttons, for
341 // example) it is more complicated - the result being, in any case, that
342 // the control looks "nice" if it uses the adjusted rectangle
343 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
345 // get the size of a scrollbar arrow
346 virtual wxSize
GetScrollbarArrowSize() const = 0;
348 // gets the bounding box for a scrollbar element for the given (by default
349 // - current) thumb position
350 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
351 wxScrollBar::Element elem
,
352 int thumbPos
= -1) const = 0;
354 // returns the size of the scrollbar shaft excluding the arrows
355 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
357 // returns one of wxHT_SCROLLBAR_XXX constants
358 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
359 const wxPoint
& pt
) const = 0;
361 // translate the scrollbar position (in logical units) into physical
362 // coordinate (in pixels) and the other way round
363 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
364 int thumbPos
= -1) = 0;
365 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
368 // get the height of a listbox item from the base font height
369 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
371 // get the size of a checkbox/radio button bitmap
372 virtual wxSize
GetCheckBitmapSize() const = 0;
373 virtual wxSize
GetRadioBitmapSize() const = 0;
374 virtual wxCoord
GetCheckItemMargin() const = 0;
376 // get the standard size of a toolbar button and also return the size of
377 // a toolbar separator in the provided pointer
378 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
380 // get the margins between/around the toolbar buttons
381 virtual wxSize
GetToolBarMargin() const = 0;
383 // convert between text rectangle and client rectangle for text controls:
384 // the former is typicall smaller to leave margins around text
385 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
386 const wxRect
& rectText
) const = 0;
388 // extra space is for line indicators
389 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
390 const wxRect
& rectTotal
,
391 wxCoord
*extraSpaceBeyond
) const = 0;
393 // get the overhang of a selected tab
394 virtual wxSize
GetTabIndent() const = 0;
396 // get the padding around the text in a tab
397 virtual wxSize
GetTabPadding() const = 0;
399 // get the default size of the slider in lesser dimension (i.e. height of a
400 // horizontal slider or width of a vertical one)
401 virtual wxCoord
GetSliderDim() const = 0;
403 // get the length of the slider ticks displayed along side slider
404 virtual wxCoord
GetSliderTickLen() const = 0;
406 // get the slider shaft rect from the total slider rect
407 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
408 wxOrientation orient
) const = 0;
410 // get the size of the slider thumb for the given total slider rect
411 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
412 wxOrientation orient
) const = 0;
414 // get the size of one progress bar step (in horz and vertical directions)
415 virtual wxSize
GetProgressBarStep() const = 0;
417 // get the size of rectangle to use in the menubar for the given text rect
418 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
420 // get the struct storing all layout info needed to draw all menu items
421 // (this can't be calculated for each item separately as they should be
424 // the returned pointer must be deleted by the caller
425 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
426 const wxMenu
& menu
) const = 0;
428 // get the borders around the status bar fields (x and y fields of the
429 // return value) and also, optionally, the border between the fields
430 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
432 // get client area rectangle of top level window (i.e. subtract
433 // decorations from given rectangle)
434 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
436 // get size of whole top level window, given size of its client area size
437 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
439 // get the minimal size of top level window
440 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
442 // get titlebar icon size
443 virtual wxSize
GetFrameIconSize() const = 0;
445 // returns one of wxHT_TOPLEVEL_XXX constants
446 virtual int HitTestFrame(const wxRect
& rect
,
448 int flags
= 0) const = 0;
450 // virtual dtor for any base class
451 virtual ~wxRenderer();
454 // draw a frame around rectFrame rectangle but not touching the rectLabel
455 // one: this is used by DrawFrame()
456 void StandardDrawFrame(wxDC
& dc
,
457 const wxRect
& rectFrame
,
458 const wxRect
& rectLabel
);
460 // standard text line drawing: just use DrawText() and highlight the
462 static void StandardDrawTextLine(wxDC
& dc
,
463 const wxString
& text
,
465 int selStart
, int selEnd
,
468 // standard scrollbar hit testing: this assumes that it only has 2 arrows
469 // and a thumb, so the themes which have more complicated scrollbars (e.g.
470 // BeOS) can't use this method
471 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
472 wxScrollBar::Element elem
,
474 const wxSize
& sizeArrow
);
475 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
477 const wxSize
& sizeArrow
);
478 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
480 const wxSize
& sizeArrow
);
481 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
483 const wxSize
& sizeArrow
);
484 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
485 const wxSize
& sizeArrow
);
486 static void StandardScrollBarThumbSize(wxCoord lenBar
,
494 // ----------------------------------------------------------------------------
495 // wxDelegateRenderer: it is impossible to inherit from any of standard
496 // renderers as their declarations are in private code, but you can use this
497 // class to override only some of the Draw() functions - all the other ones
498 // will be left to the original renderer
499 // ----------------------------------------------------------------------------
501 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
504 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
506 virtual void DrawBackground(wxDC
& dc
,
510 wxWindow
*window
= NULL
)
511 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
512 virtual void DrawLabel(wxDC
& dc
,
513 const wxString
& label
,
516 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
518 wxRect
*rectBounds
= NULL
)
519 { m_renderer
->DrawLabel(dc
, label
, rect
,
520 flags
, align
, indexAccel
, rectBounds
); }
521 virtual void DrawButtonLabel(wxDC
& dc
,
522 const wxString
& label
,
523 const wxBitmap
& image
,
526 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
528 wxRect
*rectBounds
= NULL
)
529 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
530 flags
, align
, indexAccel
, rectBounds
); }
531 virtual void DrawBorder(wxDC
& dc
,
535 wxRect
*rectIn
= (wxRect
*)NULL
)
536 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
537 virtual void DrawTextBorder(wxDC
& dc
,
541 wxRect
*rectIn
= (wxRect
*)NULL
)
542 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
543 virtual void DrawButtonBorder(wxDC
& dc
,
546 wxRect
*rectIn
= (wxRect
*)NULL
)
547 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
548 virtual void DrawFrame(wxDC
& dc
,
549 const wxString
& label
,
552 int align
= wxALIGN_LEFT
,
554 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
555 virtual void DrawHorizontalLine(wxDC
& dc
,
556 wxCoord y
, wxCoord x1
, wxCoord x2
)
557 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
558 virtual void DrawVerticalLine(wxDC
& dc
,
559 wxCoord x
, wxCoord y1
, wxCoord y2
)
560 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
561 virtual void DrawArrow(wxDC
& dc
,
565 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
566 virtual void DrawScrollbarArrow(wxDC
& dc
,
570 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
571 virtual void DrawScrollbarThumb(wxDC
& dc
,
572 wxOrientation orient
,
575 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
576 virtual void DrawScrollbarShaft(wxDC
& dc
,
577 wxOrientation orient
,
580 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
581 virtual void DrawScrollCorner(wxDC
& dc
,
583 { m_renderer
->DrawScrollCorner(dc
, rect
); }
584 virtual void DrawItem(wxDC
& dc
,
585 const wxString
& label
,
588 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
589 virtual void DrawCheckItem(wxDC
& dc
,
590 const wxString
& label
,
591 const wxBitmap
& bitmap
,
594 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
595 virtual void DrawCheckButton(wxDC
& dc
,
596 const wxString
& label
,
597 const wxBitmap
& bitmap
,
600 wxAlignment align
= wxALIGN_LEFT
,
602 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
603 flags
, align
, indexAccel
); }
604 virtual void DrawRadioButton(wxDC
& dc
,
605 const wxString
& label
,
606 const wxBitmap
& bitmap
,
609 wxAlignment align
= wxALIGN_LEFT
,
611 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
612 flags
, align
, indexAccel
); }
613 virtual void DrawToolBarButton(wxDC
& dc
,
614 const wxString
& label
,
615 const wxBitmap
& bitmap
,
618 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
); }
619 virtual void DrawTextLine(wxDC
& dc
,
620 const wxString
& text
,
625 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
626 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
627 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
629 virtual void DrawTab(wxDC
& dc
,
632 const wxString
& label
,
633 const wxBitmap
& bitmap
= wxNullBitmap
,
636 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
638 virtual void DrawSliderShaft(wxDC
& dc
,
640 wxOrientation orient
,
642 wxRect
*rectShaft
= NULL
)
643 { m_renderer
->DrawSliderShaft(dc
, rect
, orient
, flags
, rectShaft
); }
644 virtual void DrawSliderThumb(wxDC
& dc
,
646 wxOrientation orient
,
648 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
); }
649 virtual void DrawSliderTicks(wxDC
& dc
,
651 const wxSize
& sizeThumb
,
652 wxOrientation orient
,
657 { m_renderer
->DrawSliderTicks(dc
, rect
, sizeThumb
, orient
,
658 start
, end
, start
, flags
); }
660 virtual void DrawMenuBarItem(wxDC
& dc
,
662 const wxString
& label
,
665 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
666 virtual void DrawMenuItem(wxDC
& dc
,
668 const wxMenuGeometryInfo
& gi
,
669 const wxString
& label
,
670 const wxString
& accel
,
671 const wxBitmap
& bitmap
= wxNullBitmap
,
674 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
675 bitmap
, flags
, indexAccel
); }
676 virtual void DrawMenuSeparator(wxDC
& dc
,
678 const wxMenuGeometryInfo
& geomInfo
)
679 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
681 virtual void DrawStatusField(wxDC
& dc
,
683 const wxString
& label
,
685 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
); }
687 virtual void DrawFrameTitleBar(wxDC
& dc
,
689 const wxString
& title
,
692 int specialButton
= 0,
693 int specialButtonFlag
= 0)
694 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
695 specialButton
, specialButtonFlag
); }
696 virtual void DrawFrameBorder(wxDC
& dc
,
699 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
700 virtual void DrawFrameBackground(wxDC
& dc
,
703 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
704 virtual void DrawFrameTitle(wxDC
& dc
,
706 const wxString
& title
,
708 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
709 virtual void DrawFrameIcon(wxDC
& dc
,
713 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
714 virtual void DrawFrameButton(wxDC
& dc
,
715 wxCoord x
, wxCoord y
,
718 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
720 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
722 wxBitmap
*bmpPressed
,
723 wxBitmap
*bmpDisabled
)
724 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
725 bmpPressed
, bmpDisabled
); }
727 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
728 { m_renderer
->AdjustSize(size
, window
); }
729 virtual wxRect
GetBorderDimensions(wxBorder border
) const
730 { return m_renderer
->GetBorderDimensions(border
); }
731 virtual bool AreScrollbarsInsideBorder() const
732 { return m_renderer
->AreScrollbarsInsideBorder(); }
734 virtual wxSize
GetScrollbarArrowSize() const
735 { return m_renderer
->GetScrollbarArrowSize(); }
736 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
737 wxScrollBar::Element elem
,
738 int thumbPos
= -1) const
739 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
740 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
741 { return m_renderer
->GetScrollbarSize(scrollbar
); }
742 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
743 const wxPoint
& pt
) const
744 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
745 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
747 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
748 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
750 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
751 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
752 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
753 virtual wxSize
GetCheckBitmapSize() const
754 { return m_renderer
->GetCheckBitmapSize(); }
755 virtual wxSize
GetRadioBitmapSize() const
756 { return m_renderer
->GetRadioBitmapSize(); }
757 virtual wxCoord
GetCheckItemMargin() const
758 { return m_renderer
->GetCheckItemMargin(); }
760 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
761 { return m_renderer
->GetToolBarButtonSize(separator
); }
762 virtual wxSize
GetToolBarMargin() const
763 { return m_renderer
->GetToolBarMargin(); }
765 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
766 const wxRect
& rect
) const
767 { return m_renderer
->GetTextTotalArea(text
, rect
); }
768 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
770 wxCoord
*extraSpaceBeyond
) const
771 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
773 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
774 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
776 virtual wxCoord
GetSliderDim() const
777 { return m_renderer
->GetSliderDim(); }
778 virtual wxCoord
GetSliderTickLen() const
779 { return m_renderer
->GetSliderTickLen(); }
780 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
781 wxOrientation orient
) const
782 { return m_renderer
->GetSliderShaftRect(rect
, orient
); }
783 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
784 wxOrientation orient
) const
785 { return m_renderer
->GetSliderThumbSize(rect
, orient
); }
786 virtual wxSize
GetProgressBarStep() const
787 { return m_renderer
->GetProgressBarStep(); }
788 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
789 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
790 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
791 const wxMenu
& menu
) const
792 { return m_renderer
->GetMenuGeometry(win
, menu
); }
793 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
794 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
795 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
796 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
797 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
798 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
799 virtual wxSize
GetFrameMinSize(int flags
) const
800 { return m_renderer
->GetFrameMinSize(flags
); }
801 virtual wxSize
GetFrameIconSize() const
802 { return m_renderer
->GetFrameIconSize(); }
803 virtual int HitTestFrame(const wxRect
& rect
,
806 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
809 wxRenderer
*m_renderer
;
812 // ----------------------------------------------------------------------------
813 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
815 // ----------------------------------------------------------------------------
817 class WXDLLEXPORT wxControlRenderer
820 // create a renderer for this dc with this "fundamental" renderer
821 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
824 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
825 wxCoord marginX
= 0, wxCoord marginY
= 0);
827 void DrawItems(const wxListBox
*listbox
,
828 size_t itemFirst
, size_t itemLast
);
829 #endif // wxUSE_LISTBOX
830 #if wxUSE_CHECKLISTBOX
831 void DrawCheckItems(const wxCheckListBox
*listbox
,
832 size_t itemFirst
, size_t itemLast
);
833 #endif // wxUSE_CHECKLISTBOX
834 void DrawButtonBorder();
835 // the line must be either horizontal or vertical
836 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
838 void DrawBitmap(const wxBitmap
& bitmap
);
839 void DrawBackgroundBitmap();
840 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
842 void DrawProgressBar(const wxGauge
*gauge
);
843 #endif // wxUSE_GAUGE
846 wxWindow
*GetWindow() const { return m_window
; }
847 wxRenderer
*GetRenderer() const { return m_renderer
; }
849 wxDC
& GetDC() { return m_dc
; }
851 const wxRect
& GetRect() const { return m_rect
; }
852 wxRect
& GetRect() { return m_rect
; }
855 static void DrawBitmap(wxDC
&dc
,
856 const wxBitmap
& bitmap
,
858 int alignment
= wxALIGN_CENTRE
|
859 wxALIGN_CENTRE_VERTICAL
,
860 wxStretch stretch
= wxSTRETCH_NOT
);
863 // common part of DrawItems() and DrawCheckItems()
864 void DoDrawItems(const wxListBox
*listbox
,
865 size_t itemFirst
, size_t itemLast
,
866 bool isCheckLbox
= FALSE
);
869 wxRenderer
*m_renderer
;
874 #endif // _WX_UNIV_RENDERER_H_