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 licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_UNIV_RENDERER_H_
13 #define _WX_UNIV_RENDERER_H_
16 wxRenderer class is used to draw all wxWidgets controls. This is an ABC and
17 the look of the application is determined by the concrete derivation of
18 wxRenderer used in the program.
20 It also contains a few static methods which may be used by the concrete
21 renderers and provide the functionality which is often similar or identical
22 in all renderers (using inheritance here would be more restrictive as the
23 given concrete renderer may need an arbitrary subset of the base class
26 Finally note that wxRenderer supersedes wxRendererNative in wxUniv build and
27 includes the latters functionality (which it may delegate to the generic
28 implementation of the latter or reimplement itself).
31 #include "wx/renderer.h"
33 class WXDLLEXPORT wxDC
;
34 class WXDLLEXPORT wxCheckListBox
;
35 class WXDLLEXPORT wxListBox
;
36 class WXDLLEXPORT wxMenu
;
37 class WXDLLEXPORT wxMenuGeometryInfo
;
38 class WXDLLEXPORT wxScrollBar
;
39 class WXDLLEXPORT wxTextCtrl
;
40 class WXDLLEXPORT wxWindow
;
42 class WXDLLEXPORT wxGauge
;
45 #include "wx/string.h"
46 #include "wx/gdicmn.h"
48 #include "wx/scrolbar.h" // for wxScrollBar::Element
50 // helper class used by wxMenu-related functions
51 class WXDLLEXPORT wxMenuGeometryInfo
54 // get the total size of the menu
55 virtual wxSize
GetSize() const = 0;
57 virtual ~wxMenuGeometryInfo();
60 // ----------------------------------------------------------------------------
61 // wxRenderer: abstract renderers interface
62 // ----------------------------------------------------------------------------
64 class WXDLLEXPORT wxRenderer
: public wxDelegateRendererNative
70 // draw the controls background
71 virtual void DrawBackground(wxDC
& dc
,
75 wxWindow
*window
= NULL
) = 0;
77 // draw the button surface
78 virtual void DrawButtonSurface(wxDC
& dc
,
82 { DrawBackground( dc
, col
, rect
, flags
); }
85 // draw the label inside the given rectangle with the specified alignment
86 // and optionally emphasize the character with the given index
87 virtual void DrawLabel(wxDC
& dc
,
88 const wxString
& label
,
91 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
93 wxRect
*rectBounds
= NULL
) = 0;
95 // same but also draw a bitmap if it is valid
96 virtual void DrawButtonLabel(wxDC
& dc
,
97 const wxString
& label
,
98 const wxBitmap
& image
,
101 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
103 wxRect
*rectBounds
= NULL
) = 0;
105 // draw the border and optionally return the rectangle containing the
106 // region inside the border
107 virtual void DrawBorder(wxDC
& dc
,
111 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
113 // draw text control border (I hate to have a separate method for this but
114 // it is needed to accommodate GTK+)
115 virtual void DrawTextBorder(wxDC
& dc
,
119 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
121 // draw push button border and return the rectangle left for the label
122 virtual void DrawButtonBorder(wxDC
& dc
,
125 wxRect
*rectIn
= (wxRect
*)NULL
) = 0;
127 // draw a horizontal line
128 virtual void DrawHorizontalLine(wxDC
& dc
,
129 wxCoord y
, wxCoord x1
, wxCoord x2
) = 0;
131 // draw a vertical line
132 virtual void DrawVerticalLine(wxDC
& dc
,
133 wxCoord x
, wxCoord y1
, wxCoord y2
) = 0;
135 // draw a frame with the label (horizontal alignment can be specified)
136 virtual void DrawFrame(wxDC
& dc
,
137 const wxString
& label
,
140 int alignment
= wxALIGN_LEFT
,
141 int indexAccel
= -1) = 0;
143 // draw an arrow in the given direction
144 virtual void DrawArrow(wxDC
& dc
,
149 // draw a scrollbar arrow (may be the same as arrow but may be not)
150 virtual void DrawScrollbarArrow(wxDC
& dc
,
155 // draw the scrollbar thumb
156 virtual void DrawScrollbarThumb(wxDC
& dc
,
157 wxOrientation orient
,
161 // draw a (part of) scrollbar shaft
162 virtual void DrawScrollbarShaft(wxDC
& dc
,
163 wxOrientation orient
,
167 // draw the rectangle in the corner between two scrollbars
168 virtual void DrawScrollCorner(wxDC
& dc
,
169 const wxRect
& rect
) = 0;
171 // draw an item of a wxListBox
172 virtual void DrawItem(wxDC
& dc
,
173 const wxString
& label
,
177 // draw an item of a wxCheckListBox
178 virtual void DrawCheckItem(wxDC
& dc
,
179 const wxString
& label
,
180 const wxBitmap
& bitmap
,
184 // draw a checkbutton (bitmap may be invalid to use default one)
185 virtual void DrawCheckButton(wxDC
& dc
,
186 const wxString
& label
,
187 const wxBitmap
& bitmap
,
190 wxAlignment align
= wxALIGN_LEFT
,
191 int indexAccel
= -1) = 0;
193 // draw a radio button
194 virtual void DrawRadioButton(wxDC
& dc
,
195 const wxString
& label
,
196 const wxBitmap
& bitmap
,
199 wxAlignment align
= wxALIGN_LEFT
,
200 int indexAccel
= -1) = 0;
202 // draw a toolbar button (label may be empty, bitmap may be invalid, if
203 // both conditions are true this function draws a separator)
204 virtual void DrawToolBarButton(wxDC
& dc
,
205 const wxString
& label
,
206 const wxBitmap
& bitmap
,
210 int tbarStyle
= 0) = 0;
212 // draw a (part of) line in the text control
213 virtual void DrawTextLine(wxDC
& dc
,
214 const wxString
& text
,
220 // draw a line wrap indicator
221 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
) = 0;
223 // draw a notebook tab
224 virtual void DrawTab(wxDC
& dc
,
227 const wxString
& label
,
228 const wxBitmap
& bitmap
= wxNullBitmap
,
230 int indexAccel
= -1) = 0;
232 // draw the slider shaft
233 virtual void DrawSliderShaft(wxDC
& dc
,
236 wxOrientation orient
,
239 wxRect
*rectShaft
= NULL
) = 0;
241 // draw the slider thumb
242 virtual void DrawSliderThumb(wxDC
& dc
,
244 wxOrientation orient
,
248 // draw the slider ticks
249 virtual void DrawSliderTicks(wxDC
& dc
,
252 wxOrientation orient
,
259 // draw a menu bar item
260 virtual void DrawMenuBarItem(wxDC
& dc
,
262 const wxString
& label
,
264 int indexAccel
= -1) = 0;
266 // draw a menu item (also used for submenus if flags has ISSUBMENU flag)
268 // the geometryInfo is calculated by GetMenuGeometry() function from below
269 virtual void DrawMenuItem(wxDC
& dc
,
271 const wxMenuGeometryInfo
& geometryInfo
,
272 const wxString
& label
,
273 const wxString
& accel
,
274 const wxBitmap
& bitmap
= wxNullBitmap
,
276 int indexAccel
= -1) = 0;
278 // draw a menu bar separator
279 virtual void DrawMenuSeparator(wxDC
& dc
,
281 const wxMenuGeometryInfo
& geomInfo
) = 0;
283 // draw a status bar field: wxCONTROL_ISDEFAULT bit in the flags is
284 // interpreted specially and means "draw the status bar grip" here
285 virtual void DrawStatusField(wxDC
& dc
,
287 const wxString
& label
,
288 int flags
= 0, int style
= 0) = 0;
290 // draw complete frame/dialog titlebar
291 virtual void DrawFrameTitleBar(wxDC
& dc
,
293 const wxString
& title
,
296 int specialButton
= 0,
297 int specialButtonFlags
= 0) = 0;
299 // draw frame borders
300 virtual void DrawFrameBorder(wxDC
& dc
,
304 // draw frame titlebar background
305 virtual void DrawFrameBackground(wxDC
& dc
,
310 virtual void DrawFrameTitle(wxDC
& dc
,
312 const wxString
& title
,
316 virtual void DrawFrameIcon(wxDC
& dc
,
321 // draw frame buttons
322 virtual void DrawFrameButton(wxDC
& dc
,
323 wxCoord x
, wxCoord y
,
330 // return the bitmaps to use for combobox button
331 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
333 wxBitmap
*bmpPressed
,
334 wxBitmap
*bmpDisabled
) = 0;
336 // geometry functions
337 // ------------------
339 // get the dimensions of the border: rect.x/y contain the width/height of
340 // the left/top side, width/heigh - of the right/bottom one
341 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
343 // the scrollbars may be drawn either inside the window border or outside
344 // it - this function is used to decide how to draw them
345 virtual bool AreScrollbarsInsideBorder() const = 0;
347 // adjust the size of the control of the given class: for most controls,
348 // this just takes into account the border, but for some (buttons, for
349 // example) it is more complicated - the result being, in any case, that
350 // the control looks "nice" if it uses the adjusted rectangle
351 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
353 // get the size of a scrollbar arrow
354 virtual wxSize
GetScrollbarArrowSize() const = 0;
356 // gets the bounding box for a scrollbar element for the given (by default
357 // - current) thumb position
358 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
359 wxScrollBar::Element elem
,
360 int thumbPos
= -1) const = 0;
362 // returns the size of the scrollbar shaft excluding the arrows
363 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
365 // returns one of wxHT_SCROLLBAR_XXX constants
366 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
367 const wxPoint
& pt
) const = 0;
369 // translate the scrollbar position (in logical units) into physical
370 // coordinate (in pixels) and the other way round
371 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
372 int thumbPos
= -1) = 0;
373 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
376 // get the height of a listbox item from the base font height
377 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
379 // get the size of a checkbox/radio button bitmap
380 virtual wxSize
GetCheckBitmapSize() const = 0;
381 virtual wxSize
GetRadioBitmapSize() const = 0;
382 virtual wxCoord
GetCheckItemMargin() const = 0;
384 // get the standard size of a toolbar button and also return the size of
385 // a toolbar separator in the provided pointer
386 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const = 0;
388 // get the margins between/around the toolbar buttons
389 virtual wxSize
GetToolBarMargin() const = 0;
391 // convert between text rectangle and client rectangle for text controls:
392 // the former is typicall smaller to leave margins around text
393 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
394 const wxRect
& rectText
) const = 0;
396 // extra space is for line indicators
397 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
398 const wxRect
& rectTotal
,
399 wxCoord
*extraSpaceBeyond
) const = 0;
401 // get the overhang of a selected tab
402 virtual wxSize
GetTabIndent() const = 0;
404 // get the padding around the text in a tab
405 virtual wxSize
GetTabPadding() const = 0;
407 // get the default size of the slider in lesser dimension (i.e. height of a
408 // horizontal slider or width of a vertical one)
409 virtual wxCoord
GetSliderDim() const = 0;
411 // get the length of the slider ticks displayed along side slider
412 virtual wxCoord
GetSliderTickLen() const = 0;
414 // get the slider shaft rect from the total slider rect
415 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
417 wxOrientation orient
,
418 long style
= 0) const = 0;
420 // get the size of the slider thumb for the given total slider rect
421 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
423 wxOrientation orient
) const = 0;
425 // get the size of one progress bar step (in horz and vertical directions)
426 virtual wxSize
GetProgressBarStep() const = 0;
428 // get the size of rectangle to use in the menubar for the given text rect
429 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
431 // get the struct storing all layout info needed to draw all menu items
432 // (this can't be calculated for each item separately as they should be
435 // the returned pointer must be deleted by the caller
436 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
437 const wxMenu
& menu
) const = 0;
439 // get the borders around the status bar fields (x and y fields of the
440 // return value) and also, optionally, the border between the fields
441 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const = 0;
443 // get client area rectangle of top level window (i.e. subtract
444 // decorations from given rectangle)
445 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
447 // get size of whole top level window, given size of its client area size
448 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
450 // get the minimal size of top level window
451 virtual wxSize
GetFrameMinSize(int flags
) const = 0;
453 // get titlebar icon size
454 virtual wxSize
GetFrameIconSize() const = 0;
456 // returns one of wxHT_TOPLEVEL_XXX constants
457 virtual int HitTestFrame(const wxRect
& rect
,
459 int flags
= 0) const = 0;
461 // virtual dtor for any base class
462 virtual ~wxRenderer();
466 // draw a frame around rectFrame rectangle but not touching the rectLabel
467 // one: this is used by DrawFrame()
468 void StandardDrawFrame(wxDC
& dc
,
469 const wxRect
& rectFrame
,
470 const wxRect
& rectLabel
);
472 // standard text line drawing: just use DrawText() and highlight the
474 static void StandardDrawTextLine(wxDC
& dc
,
475 const wxString
& text
,
477 int selStart
, int selEnd
,
480 // standard scrollbar hit testing: this assumes that it only has 2 arrows
481 // and a thumb, so the themes which have more complicated scrollbars (e.g.
482 // BeOS) can't use this method
483 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
484 wxScrollBar::Element elem
,
486 const wxSize
& sizeArrow
);
487 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
489 const wxSize
& sizeArrow
);
490 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
492 const wxSize
& sizeArrow
);
493 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
495 const wxSize
& sizeArrow
);
496 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
497 const wxSize
& sizeArrow
);
498 static void StandardScrollBarThumbSize(wxCoord lenBar
,
506 // ----------------------------------------------------------------------------
507 // wxDelegateRenderer: it is impossible to inherit from any of standard
508 // renderers as their declarations are in private code, but you can use this
509 // class to override only some of the Draw() functions - all the other ones
510 // will be left to the original renderer
511 // ----------------------------------------------------------------------------
513 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
516 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
518 virtual void DrawBackground(wxDC
& dc
,
522 wxWindow
*window
= NULL
)
523 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
, window
); }
524 virtual void DrawLabel(wxDC
& dc
,
525 const wxString
& label
,
528 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
530 wxRect
*rectBounds
= NULL
)
531 { m_renderer
->DrawLabel(dc
, label
, rect
,
532 flags
, align
, indexAccel
, rectBounds
); }
533 virtual void DrawButtonLabel(wxDC
& dc
,
534 const wxString
& label
,
535 const wxBitmap
& image
,
538 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
540 wxRect
*rectBounds
= NULL
)
541 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
542 flags
, align
, indexAccel
, rectBounds
); }
543 virtual void DrawBorder(wxDC
& dc
,
547 wxRect
*rectIn
= (wxRect
*)NULL
)
548 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
549 virtual void DrawTextBorder(wxDC
& dc
,
553 wxRect
*rectIn
= (wxRect
*)NULL
)
554 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
555 virtual void DrawButtonBorder(wxDC
& dc
,
558 wxRect
*rectIn
= (wxRect
*)NULL
)
559 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
560 virtual void DrawFrame(wxDC
& dc
,
561 const wxString
& label
,
564 int align
= wxALIGN_LEFT
,
566 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
567 virtual void DrawHorizontalLine(wxDC
& dc
,
568 wxCoord y
, wxCoord x1
, wxCoord x2
)
569 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
570 virtual void DrawVerticalLine(wxDC
& dc
,
571 wxCoord x
, wxCoord y1
, wxCoord y2
)
572 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
573 virtual void DrawArrow(wxDC
& dc
,
577 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
578 virtual void DrawScrollbarArrow(wxDC
& dc
,
582 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
583 virtual void DrawScrollbarThumb(wxDC
& dc
,
584 wxOrientation orient
,
587 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
588 virtual void DrawScrollbarShaft(wxDC
& dc
,
589 wxOrientation orient
,
592 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
593 virtual void DrawScrollCorner(wxDC
& dc
,
595 { m_renderer
->DrawScrollCorner(dc
, rect
); }
596 virtual void DrawItem(wxDC
& dc
,
597 const wxString
& label
,
600 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
601 virtual void DrawCheckItem(wxDC
& dc
,
602 const wxString
& label
,
603 const wxBitmap
& bitmap
,
606 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
607 virtual void DrawCheckButton(wxDC
& dc
,
608 const wxString
& label
,
609 const wxBitmap
& bitmap
,
612 wxAlignment align
= wxALIGN_LEFT
,
614 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
615 flags
, align
, indexAccel
); }
616 virtual void DrawRadioButton(wxDC
& dc
,
617 const wxString
& label
,
618 const wxBitmap
& bitmap
,
621 wxAlignment align
= wxALIGN_LEFT
,
623 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
624 flags
, align
, indexAccel
); }
625 virtual void DrawToolBarButton(wxDC
& dc
,
626 const wxString
& label
,
627 const wxBitmap
& bitmap
,
632 { m_renderer
->DrawToolBarButton(dc
, label
, bitmap
, rect
, flags
, style
, tbarStyle
); }
633 virtual void DrawTextLine(wxDC
& dc
,
634 const wxString
& text
,
639 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
, flags
); }
640 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
641 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
643 virtual void DrawTab(wxDC
& dc
,
646 const wxString
& label
,
647 const wxBitmap
& bitmap
= wxNullBitmap
,
650 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
652 virtual void DrawSliderShaft(wxDC
& dc
,
655 wxOrientation orient
,
658 wxRect
*rectShaft
= NULL
)
659 { m_renderer
->DrawSliderShaft(dc
, rect
, lenThumb
, orient
, flags
, style
, rectShaft
); }
660 virtual void DrawSliderThumb(wxDC
& dc
,
662 wxOrientation orient
,
665 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
, style
); }
666 virtual void DrawSliderTicks(wxDC
& dc
,
669 wxOrientation orient
,
672 int WXUNUSED(step
) = 1,
675 { m_renderer
->DrawSliderTicks(dc
, rect
, lenThumb
, orient
,
676 start
, end
, start
, flags
, style
); }
678 virtual void DrawMenuBarItem(wxDC
& dc
,
680 const wxString
& label
,
683 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
684 virtual void DrawMenuItem(wxDC
& dc
,
686 const wxMenuGeometryInfo
& gi
,
687 const wxString
& label
,
688 const wxString
& accel
,
689 const wxBitmap
& bitmap
= wxNullBitmap
,
692 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
693 bitmap
, flags
, indexAccel
); }
694 virtual void DrawMenuSeparator(wxDC
& dc
,
696 const wxMenuGeometryInfo
& geomInfo
)
697 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
699 virtual void DrawStatusField(wxDC
& dc
,
701 const wxString
& label
,
702 int flags
= 0, int style
= 0)
703 { m_renderer
->DrawStatusField(dc
, rect
, label
, flags
, style
); }
705 virtual void DrawFrameTitleBar(wxDC
& dc
,
707 const wxString
& title
,
710 int specialButton
= 0,
711 int specialButtonFlag
= 0)
712 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
,
713 specialButton
, specialButtonFlag
); }
714 virtual void DrawFrameBorder(wxDC
& dc
,
717 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
718 virtual void DrawFrameBackground(wxDC
& dc
,
721 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
722 virtual void DrawFrameTitle(wxDC
& dc
,
724 const wxString
& title
,
726 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
727 virtual void DrawFrameIcon(wxDC
& dc
,
731 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
732 virtual void DrawFrameButton(wxDC
& dc
,
733 wxCoord x
, wxCoord y
,
736 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
738 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
740 wxBitmap
*bmpPressed
,
741 wxBitmap
*bmpDisabled
)
742 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
743 bmpPressed
, bmpDisabled
); }
745 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
746 { m_renderer
->AdjustSize(size
, window
); }
747 virtual wxRect
GetBorderDimensions(wxBorder border
) const
748 { return m_renderer
->GetBorderDimensions(border
); }
749 virtual bool AreScrollbarsInsideBorder() const
750 { return m_renderer
->AreScrollbarsInsideBorder(); }
752 virtual wxSize
GetScrollbarArrowSize() const
753 { return m_renderer
->GetScrollbarArrowSize(); }
754 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
755 wxScrollBar::Element elem
,
756 int thumbPos
= -1) const
757 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
758 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
759 { return m_renderer
->GetScrollbarSize(scrollbar
); }
760 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
761 const wxPoint
& pt
) const
762 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
763 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
765 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
766 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
768 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
769 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
770 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
771 virtual wxSize
GetCheckBitmapSize() const
772 { return m_renderer
->GetCheckBitmapSize(); }
773 virtual wxSize
GetRadioBitmapSize() const
774 { return m_renderer
->GetRadioBitmapSize(); }
775 virtual wxCoord
GetCheckItemMargin() const
776 { return m_renderer
->GetCheckItemMargin(); }
778 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
779 { return m_renderer
->GetToolBarButtonSize(separator
); }
780 virtual wxSize
GetToolBarMargin() const
781 { return m_renderer
->GetToolBarMargin(); }
783 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
784 const wxRect
& rect
) const
785 { return m_renderer
->GetTextTotalArea(text
, rect
); }
786 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
788 wxCoord
*extraSpaceBeyond
) const
789 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
791 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
792 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
794 virtual wxCoord
GetSliderDim() const
795 { return m_renderer
->GetSliderDim(); }
796 virtual wxCoord
GetSliderTickLen() const
797 { return m_renderer
->GetSliderTickLen(); }
798 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
800 wxOrientation orient
,
801 long style
= 0) const
802 { return m_renderer
->GetSliderShaftRect(rect
, lenThumb
, orient
, style
); }
803 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
805 wxOrientation orient
) const
806 { return m_renderer
->GetSliderThumbSize(rect
, lenThumb
, orient
); }
807 virtual wxSize
GetProgressBarStep() const
808 { return m_renderer
->GetProgressBarStep(); }
809 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
810 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
811 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
812 const wxMenu
& menu
) const
813 { return m_renderer
->GetMenuGeometry(win
, menu
); }
814 virtual wxSize
GetStatusBarBorders(wxCoord
*borderBetweenFields
) const
815 { return m_renderer
->GetStatusBarBorders(borderBetweenFields
); }
816 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
817 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
818 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
819 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
820 virtual wxSize
GetFrameMinSize(int flags
) const
821 { return m_renderer
->GetFrameMinSize(flags
); }
822 virtual wxSize
GetFrameIconSize() const
823 { return m_renderer
->GetFrameIconSize(); }
824 virtual int HitTestFrame(const wxRect
& rect
,
827 { return m_renderer
->HitTestFrame(rect
, pt
, flags
); }
829 virtual void DrawHeaderButton(wxWindow
*win
,
833 { m_renderer
->DrawHeaderButton(win
, dc
, rect
, flags
); }
834 virtual void DrawTreeItemButton(wxWindow
*win
,
838 { m_renderer
->DrawTreeItemButton(win
, dc
, rect
, flags
); }
841 wxRenderer
*m_renderer
;
844 // ----------------------------------------------------------------------------
845 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
847 // ----------------------------------------------------------------------------
849 class WXDLLEXPORT wxControlRenderer
852 // create a renderer for this dc with this "fundamental" renderer
853 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
856 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
857 wxCoord marginX
= 0, wxCoord marginY
= 0);
859 void DrawItems(const wxListBox
*listbox
,
860 size_t itemFirst
, size_t itemLast
);
861 #endif // wxUSE_LISTBOX
862 #if wxUSE_CHECKLISTBOX
863 void DrawCheckItems(const wxCheckListBox
*listbox
,
864 size_t itemFirst
, size_t itemLast
);
865 #endif // wxUSE_CHECKLISTBOX
866 void DrawButtonBorder();
867 // the line must be either horizontal or vertical
868 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
870 void DrawBitmap(const wxBitmap
& bitmap
);
871 void DrawBackgroundBitmap();
872 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
874 void DrawProgressBar(const wxGauge
*gauge
);
875 #endif // wxUSE_GAUGE
878 wxWindow
*GetWindow() const { return m_window
; }
879 wxRenderer
*GetRenderer() const { return m_renderer
; }
881 wxDC
& GetDC() { return m_dc
; }
883 const wxRect
& GetRect() const { return m_rect
; }
884 wxRect
& GetRect() { return m_rect
; }
887 static void DrawBitmap(wxDC
&dc
,
888 const wxBitmap
& bitmap
,
890 int alignment
= wxALIGN_CENTRE
|
891 wxALIGN_CENTRE_VERTICAL
,
892 wxStretch stretch
= wxSTRETCH_NOT
);
895 // common part of DrawItems() and DrawCheckItems()
896 void DoDrawItems(const wxListBox
*listbox
,
897 size_t itemFirst
, size_t itemLast
,
898 bool isCheckLbox
= false);
901 wxRenderer
*m_renderer
;
906 #endif // _WX_UNIV_RENDERER_H_