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 pressedButtons
= 0) = 0;
256 // draw frame borders
257 virtual void DrawFrameBorder(wxDC
& dc
,
261 // draw frame titlebar background
262 virtual void DrawFrameBackground(wxDC
& dc
,
267 virtual void DrawFrameTitle(wxDC
& dc
,
269 const wxString
& title
,
273 virtual void DrawFrameIcon(wxDC
& dc
,
278 // draw frame buttons
279 virtual void DrawFrameButton(wxDC
& dc
,
280 wxCoord x
, wxCoord y
,
287 // return the bitmaps to use for combobox button
288 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
290 wxBitmap
*bmpPressed
,
291 wxBitmap
*bmpDisabled
) = 0;
293 // geometry functions
294 // ------------------
296 // get the dimensions of the border: rect.x/y contain the width/height of
297 // the left/top side, width/heigh - of the right/bottom one
298 virtual wxRect
GetBorderDimensions(wxBorder border
) const = 0;
300 // the scrollbars may be drawn either inside the window border or outside
301 // it - this function is used to decide how to draw them
302 virtual bool AreScrollbarsInsideBorder() const = 0;
304 // adjust the size of the control of the given class: for most controls,
305 // this just takes into account the border, but for some (buttons, for
306 // example) it is more complicated - the result being, in any case, that
307 // the control looks "nice" if it uses the adjusted rectangle
308 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
) = 0;
310 // get the size of a scrollbar arrow
311 virtual wxSize
GetScrollbarArrowSize() const = 0;
313 // gets the bounding box for a scrollbar element for the given (by default
314 // - current) thumb position
315 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
316 wxScrollBar::Element elem
,
317 int thumbPos
= -1) const = 0;
319 // returns the size of the scrollbar shaft excluding the arrows
320 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
) = 0;
322 // returns one of wxHT_SCROLLBAR_XXX constants
323 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
324 const wxPoint
& pt
) const = 0;
326 // translate the scrollbar position (in logical units) into physical
327 // coordinate (in pixels) and the other way round
328 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
329 int thumbPos
= -1) = 0;
330 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
333 // get the height of a listbox item from the base font height
334 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
) = 0;
336 // get the size of a checkbox/radio button bitmap
337 virtual wxSize
GetCheckBitmapSize() const = 0;
338 virtual wxSize
GetRadioBitmapSize() const = 0;
339 virtual wxCoord
GetCheckItemMargin() const = 0;
341 // convert between text rectangle and client rectangle for text controls:
342 // the former is typicall smaller to leave margins around text
343 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
344 const wxRect
& rectText
) = 0;
346 // extra space is for line indicators
347 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
348 const wxRect
& rectTotal
,
349 wxCoord
*extraSpaceBeyond
) = 0;
351 // get the overhang of a selected tab
352 virtual wxSize
GetTabIndent() const = 0;
354 // get the padding around the text in a tab
355 virtual wxSize
GetTabPadding() const = 0;
357 // get the default size of the slider in lesser dimension (i.e. height of a
358 // horizontal slider or width of a vertical one)
359 virtual wxCoord
GetSliderDim() const = 0;
361 // get the length of the slider ticks displayed along side slider
362 virtual wxCoord
GetSliderTickLen() const = 0;
364 // get the slider shaft rect from the total slider rect
365 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
366 wxOrientation orient
) const = 0;
368 // get the size of the slider thumb for the given total slider rect
369 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
370 wxOrientation orient
) const = 0;
372 // get the size of one progress bar step (in horz and vertical directions)
373 virtual wxSize
GetProgressBarStep() const = 0;
376 // get the size of rectangle to use in the menubar for the given text rect
377 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const = 0;
379 // get the struct storing all layout info needed to draw all menu items
380 // (this can't be calculated for each item separately as they should be
383 // the returned pointer must be deleted by the caller
384 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
385 const wxMenu
& menu
) const = 0;
388 // get client area rectangle of top level window (i.e. subtract
389 // decorations from given rectangle)
390 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const = 0;
391 // get size of whole top level window, given size of its client area size
392 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const = 0;
393 // get titlebar icon size
394 virtual wxSize
GetFrameIconSize() const = 0;
396 // virtual dtor for any base class
397 virtual ~wxRenderer();
400 // draw a frame around rectFrame rectangle but not touching the rectLabel
401 // one: this is used by DrawFrame()
402 void StandardDrawFrame(wxDC
& dc
,
403 const wxRect
& rectFrame
,
404 const wxRect
& rectLabel
);
406 // standard text line drawing: just use DrawText() and highlight the
408 static void StandardDrawTextLine(wxDC
& dc
,
409 const wxString
& text
,
411 int selStart
, int selEnd
,
414 // standard scrollbar hit testing: this assumes that it only has 2 arrows
415 // and a thumb, so the themes which have more complicated scrollbars (e.g.
416 // BeOS) can't use this method
417 static wxRect
StandardGetScrollbarRect(const wxScrollBar
*scrollbar
,
418 wxScrollBar::Element elem
,
420 const wxSize
& sizeArrow
);
421 static wxHitTest
StandardHitTestScrollbar(const wxScrollBar
*scrollbar
,
423 const wxSize
& sizeArrow
);
424 static wxCoord
StandardScrollbarToPixel(const wxScrollBar
*scrollbar
,
426 const wxSize
& sizeArrow
);
427 static int StandardPixelToScrollbar(const wxScrollBar
*scrollbar
,
429 const wxSize
& sizeArrow
);
430 static wxCoord
StandardScrollBarSize(const wxScrollBar
*scrollbar
,
431 const wxSize
& sizeArrow
);
432 static void StandardScrollBarThumbSize(wxCoord lenBar
,
440 // ----------------------------------------------------------------------------
441 // wxDelegateRenderer: it is impossible to inherit from any of standard
442 // renderers as their declarations are in private code, but you can use this
443 // class to override only some of the Draw() functions - all the other ones
444 // will be left to the original renderer
445 // ----------------------------------------------------------------------------
447 class WXDLLEXPORT wxDelegateRenderer
: public wxRenderer
450 wxDelegateRenderer(wxRenderer
*renderer
) : m_renderer(renderer
) { }
452 virtual void DrawBackground(wxDC
& dc
,
456 { m_renderer
->DrawBackground(dc
, col
, rect
, flags
); }
457 virtual void DrawLabel(wxDC
& dc
,
458 const wxString
& label
,
461 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
463 wxRect
*rectBounds
= NULL
)
464 { m_renderer
->DrawLabel(dc
, label
, rect
,
465 flags
, align
, indexAccel
, rectBounds
); }
466 virtual void DrawButtonLabel(wxDC
& dc
,
467 const wxString
& label
,
468 const wxBitmap
& image
,
471 int align
= wxALIGN_LEFT
| wxALIGN_TOP
,
473 wxRect
*rectBounds
= NULL
)
474 { m_renderer
->DrawButtonLabel(dc
, label
, image
, rect
,
475 flags
, align
, indexAccel
, rectBounds
); }
476 virtual void DrawBorder(wxDC
& dc
,
480 wxRect
*rectIn
= (wxRect
*)NULL
)
481 { m_renderer
->DrawBorder(dc
, border
, rect
, flags
, rectIn
); }
482 virtual void DrawTextBorder(wxDC
& dc
,
486 wxRect
*rectIn
= (wxRect
*)NULL
)
487 { m_renderer
->DrawTextBorder(dc
, border
, rect
, flags
, rectIn
); }
488 virtual void DrawButtonBorder(wxDC
& dc
,
491 wxRect
*rectIn
= (wxRect
*)NULL
)
492 { m_renderer
->DrawButtonBorder(dc
, rect
, flags
, rectIn
); }
493 virtual void DrawFrame(wxDC
& dc
,
494 const wxString
& label
,
497 int align
= wxALIGN_LEFT
,
499 { m_renderer
->DrawFrame(dc
, label
, rect
, flags
, align
, indexAccel
); }
500 virtual void DrawHorizontalLine(wxDC
& dc
,
501 wxCoord y
, wxCoord x1
, wxCoord x2
)
502 { m_renderer
->DrawHorizontalLine(dc
, y
, x1
, x2
); }
503 virtual void DrawVerticalLine(wxDC
& dc
,
504 wxCoord x
, wxCoord y1
, wxCoord y2
)
505 { m_renderer
->DrawVerticalLine(dc
, x
, y1
, y2
); }
506 virtual void DrawArrow(wxDC
& dc
,
510 { m_renderer
->DrawArrow(dc
, dir
, rect
, flags
); }
511 virtual void DrawScrollbarArrow(wxDC
& dc
,
515 { m_renderer
->DrawScrollbarArrow(dc
, dir
, rect
, flags
); }
516 virtual void DrawScrollbarThumb(wxDC
& dc
,
517 wxOrientation orient
,
520 { m_renderer
->DrawScrollbarThumb(dc
, orient
, rect
, flags
); }
521 virtual void DrawScrollbarShaft(wxDC
& dc
,
522 wxOrientation orient
,
525 { m_renderer
->DrawScrollbarShaft(dc
, orient
, rect
, flags
); }
526 virtual void DrawScrollCorner(wxDC
& dc
,
528 { m_renderer
->DrawScrollCorner(dc
, rect
); }
529 virtual void DrawItem(wxDC
& dc
,
530 const wxString
& label
,
533 { m_renderer
->DrawItem(dc
, label
, rect
, flags
); }
534 virtual void DrawCheckItem(wxDC
& dc
,
535 const wxString
& label
,
536 const wxBitmap
& bitmap
,
539 { m_renderer
->DrawCheckItem(dc
, label
, bitmap
, rect
, flags
); }
540 virtual void DrawCheckButton(wxDC
& dc
,
541 const wxString
& label
,
542 const wxBitmap
& bitmap
,
545 wxAlignment align
= wxALIGN_LEFT
,
547 { m_renderer
->DrawCheckButton(dc
, label
, bitmap
, rect
,
548 flags
, align
, indexAccel
); }
549 virtual void DrawRadioButton(wxDC
& dc
,
550 const wxString
& label
,
551 const wxBitmap
& bitmap
,
554 wxAlignment align
= wxALIGN_LEFT
,
556 { m_renderer
->DrawRadioButton(dc
, label
, bitmap
, rect
,
557 flags
, align
, indexAccel
); }
558 virtual void DrawTextLine(wxDC
& dc
,
559 const wxString
& text
,
563 { m_renderer
->DrawTextLine(dc
, text
, rect
, selStart
, selEnd
); }
564 virtual void DrawLineWrapMark(wxDC
& dc
, const wxRect
& rect
)
565 { m_renderer
->DrawLineWrapMark(dc
, rect
); }
567 virtual void DrawTab(wxDC
& dc
,
570 const wxString
& label
,
571 const wxBitmap
& bitmap
= wxNullBitmap
,
574 { m_renderer
->DrawTab(dc
, rect
, dir
, label
, bitmap
, flags
, accel
); }
576 virtual void DrawSliderShaft(wxDC
& dc
,
578 wxOrientation orient
,
580 wxRect
*rectShaft
= NULL
)
581 { m_renderer
->DrawSliderShaft(dc
, rect
, orient
, flags
, rectShaft
); }
582 virtual void DrawSliderThumb(wxDC
& dc
,
584 wxOrientation orient
,
586 { m_renderer
->DrawSliderThumb(dc
, rect
, orient
, flags
); }
587 virtual void DrawSliderTicks(wxDC
& dc
,
589 const wxSize
& sizeThumb
,
590 wxOrientation orient
,
595 { m_renderer
->DrawSliderTicks(dc
, rect
, sizeThumb
, orient
,
596 start
, end
, start
, flags
); }
599 virtual void DrawMenuBarItem(wxDC
& dc
,
601 const wxString
& label
,
604 { m_renderer
->DrawMenuBarItem(dc
, rect
, label
, flags
, indexAccel
); }
605 virtual void DrawMenuItem(wxDC
& dc
,
607 const wxMenuGeometryInfo
& gi
,
608 const wxString
& label
,
609 const wxString
& accel
,
610 const wxBitmap
& bitmap
= wxNullBitmap
,
613 { m_renderer
->DrawMenuItem(dc
, y
, gi
, label
, accel
,
614 bitmap
, flags
, indexAccel
); }
615 virtual void DrawMenuSeparator(wxDC
& dc
,
617 const wxMenuGeometryInfo
& geomInfo
)
618 { m_renderer
->DrawMenuSeparator(dc
, y
, geomInfo
); }
620 virtual void DrawFrameTitleBar(wxDC
& dc
,
622 const wxString
& title
,
625 int pressedButtons
= 0)
626 { m_renderer
->DrawFrameTitleBar(dc
, rect
, title
, icon
, flags
, pressedButtons
); }
627 virtual void DrawFrameBorder(wxDC
& dc
,
630 { m_renderer
->DrawFrameBorder(dc
, rect
, flags
); }
631 virtual void DrawFrameBackground(wxDC
& dc
,
634 { m_renderer
->DrawFrameBackground(dc
, rect
, flags
); }
635 virtual void DrawFrameTitle(wxDC
& dc
,
637 const wxString
& title
,
639 { m_renderer
->DrawFrameTitle(dc
, rect
, title
, flags
); }
640 virtual void DrawFrameIcon(wxDC
& dc
,
644 { m_renderer
->DrawFrameIcon(dc
, rect
, icon
, flags
); }
645 virtual void DrawFrameButton(wxDC
& dc
,
646 wxCoord x
, wxCoord y
,
649 { m_renderer
->DrawFrameButton(dc
, x
, y
, button
, flags
); }
651 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
653 wxBitmap
*bmpPressed
,
654 wxBitmap
*bmpDisabled
) const
655 { m_renderer
->GetComboBitmaps(bmpNormal
, bmpFocus
,
656 bmpPressed
, bmpDisabled
); }
658 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
)
659 { m_renderer
->AdjustSize(size
, window
); }
660 virtual wxRect
GetBorderDimensions(wxBorder border
) const
661 { return m_renderer
->GetBorderDimensions(border
); }
662 virtual bool AreScrollbarsInsideBorder() const
663 { return m_renderer
->AreScrollbarsInsideBorder(); }
665 virtual wxSize
GetScrollbarArrowSize() const
666 { return m_renderer
->GetScrollbarArrowSize(); }
667 virtual wxRect
GetScrollbarRect(const wxScrollBar
*scrollbar
,
668 wxScrollBar::Element elem
,
669 int thumbPos
= -1) const
670 { return m_renderer
->GetScrollbarRect(scrollbar
, elem
, thumbPos
); }
671 virtual wxCoord
GetScrollbarSize(const wxScrollBar
*scrollbar
)
672 { return m_renderer
->GetScrollbarSize(scrollbar
); }
673 virtual wxHitTest
HitTestScrollbar(const wxScrollBar
*scrollbar
,
674 const wxPoint
& pt
) const
675 { return m_renderer
->HitTestScrollbar(scrollbar
, pt
); }
676 virtual wxCoord
ScrollbarToPixel(const wxScrollBar
*scrollbar
,
678 { return m_renderer
->ScrollbarToPixel(scrollbar
, thumbPos
); }
679 virtual int PixelToScrollbar(const wxScrollBar
*scrollbar
,
681 { return m_renderer
->PixelToScrollbar(scrollbar
, coord
); }
682 virtual wxCoord
GetListboxItemHeight(wxCoord fontHeight
)
683 { return m_renderer
->GetListboxItemHeight(fontHeight
); }
684 virtual wxSize
GetCheckBitmapSize() const
685 { return m_renderer
->GetCheckBitmapSize(); }
686 virtual wxSize
GetRadioBitmapSize() const
687 { return m_renderer
->GetRadioBitmapSize(); }
688 virtual wxCoord
GetCheckItemMargin() const
689 { return m_renderer
->GetCheckItemMargin(); }
691 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
, const wxRect
& rect
)
692 { return m_renderer
->GetTextTotalArea(text
, rect
); }
693 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
695 wxCoord
*extraSpaceBeyond
)
696 { return m_renderer
->GetTextClientArea(text
, rect
, extraSpaceBeyond
); }
698 virtual wxSize
GetTabIndent() const { return m_renderer
->GetTabIndent(); }
699 virtual wxSize
GetTabPadding() const { return m_renderer
->GetTabPadding(); }
701 virtual wxCoord
GetSliderDim() const
702 { return m_renderer
->GetSliderDim(); }
703 virtual wxCoord
GetSliderTickLen() const
704 { return m_renderer
->GetSliderTickLen(); }
705 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
706 wxOrientation orient
) const
707 { return GetSliderShaftRect(rect
, orient
); }
708 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
709 wxOrientation orient
) const
710 { return m_renderer
->GetSliderThumbSize(rect
, orient
); }
711 virtual wxSize
GetProgressBarStep() const
712 { return m_renderer
->GetProgressBarStep(); }
714 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const
715 { return m_renderer
->GetMenuBarItemSize(sizeText
); }
716 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
717 const wxMenu
& menu
) const
718 { return m_renderer
->GetMenuGeometry(win
, menu
); }
720 virtual wxRect
GetFrameClientArea(const wxRect
& rect
, int flags
) const
721 { return m_renderer
->GetFrameClientArea(rect
, flags
); }
722 virtual wxSize
GetFrameTotalSize(const wxSize
& clientSize
, int flags
) const
723 { return m_renderer
->GetFrameTotalSize(clientSize
, flags
); }
724 virtual wxSize
GetFrameIconSize() const
725 { return m_renderer
->GetFrameIconSize(); }
728 wxRenderer
*m_renderer
;
731 // ----------------------------------------------------------------------------
732 // wxControlRenderer: wraps the wxRenderer functions in a form easy to use from
734 // ----------------------------------------------------------------------------
736 class WXDLLEXPORT wxControlRenderer
739 // create a renderer for this dc with this "fundamental" renderer
740 wxControlRenderer(wxWindow
*control
, wxDC
& dc
, wxRenderer
*renderer
);
743 void DrawLabel(const wxBitmap
& bitmap
= wxNullBitmap
,
744 wxCoord marginX
= 0, wxCoord marginY
= 0);
746 void DrawItems(const wxListBox
*listbox
,
747 size_t itemFirst
, size_t itemLast
);
748 #endif // wxUSE_LISTBOX
749 #if wxUSE_CHECKLISTBOX
750 void DrawCheckItems(const wxCheckListBox
*listbox
,
751 size_t itemFirst
, size_t itemLast
);
752 #endif // wxUSE_CHECKLISTBOX
753 void DrawButtonBorder();
754 // the line must be either horizontal or vertical
755 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
757 void DrawBitmap(const wxBitmap
& bitmap
);
758 void DrawBackgroundBitmap();
759 void DrawScrollbar(const wxScrollBar
*scrollbar
, int thumbPosOld
);
761 void DrawProgressBar(const wxGauge
*gauge
);
762 #endif // wxUSE_GAUGE
765 wxWindow
*GetWindow() const { return m_window
; }
766 wxRenderer
*GetRenderer() const { return m_renderer
; }
768 wxDC
& GetDC() { return m_dc
; }
770 const wxRect
& GetRect() const { return m_rect
; }
771 wxRect
& GetRect() { return m_rect
; }
774 static void DrawBitmap(wxDC
&dc
,
775 const wxBitmap
& bitmap
,
777 int alignment
= wxALIGN_CENTRE
|
778 wxALIGN_CENTRE_VERTICAL
,
779 wxStretch stretch
= wxSTRETCH_NOT
);
782 // common part of DrawItems() and DrawCheckItems()
783 void DoDrawItems(const wxListBox
*listbox
,
784 size_t itemFirst
, size_t itemLast
,
785 bool isCheckLbox
= FALSE
);
788 wxRenderer
*m_renderer
;
793 #endif // _WX_UNIV_RENDERER_H_