#include <wx/renderer.h>

Usually wxWidgets uses the underlying low level GUI system to draw all the controls - this is what we mean when we say that it is a "native" framework. However not all controls exist under all (or even any) platforms and in this case wxWidgets provides a default, generic, implementation of them written in wxWidgets itself.
These controls don't have the native appearance if only the standard line drawing and other graphics primitives are used, because the native appearance is different under different platforms while the lines are always drawn in the same way.
This is why we have renderers: wxRendererNative is a class which virtualizes the drawing, i.e. it abstracts the drawing operations and allows you to draw say, a button, without caring about exactly how this is done. Of course, as we can draw the button differently in different renderers, this also allows us to emulate the native look and feel.
So the renderers work by exposing a large set of high-level drawing functions which are used by the generic controls. There is always a default global renderer but it may be changed or extended by the user, see Render Sample.
All drawing functions take some standard parameters:
Public Member Functions | |
| virtual | ~wxRendererNative () |
| virtual void | DrawCheckBox (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual void | DrawComboBoxDropButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual void | DrawDropArrow (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual void | DrawFocusRect (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual int | DrawHeaderButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0, wxHeaderSortIconType sortArrow=wxHDR_SORT_ICON_NONE, wxHeaderButtonParams *params=NULL)=0 |
| virtual int | DrawHeaderButtonContents (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0, wxHeaderSortIconType sortArrow=wxHDR_SORT_ICON_NONE, wxHeaderButtonParams *params=NULL)=0 |
| virtual void | DrawItemSelectionRect (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual void | DrawPushButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual void | DrawSplitterBorder (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual void | DrawSplitterSash (wxWindow *win, wxDC &dc, const wxSize &size, wxCoord position, wxOrientation orient, int flags=0)=0 |
| virtual void | DrawTreeItemButton (wxWindow *win, wxDC &dc, const wxRect &rect, int flags=0)=0 |
| virtual wxSize | GetCheckBoxSize (wxWindow *win)=0 |
| virtual int | GetHeaderButtonHeight (wxWindow *win)=0 |
| virtual wxSplitterRenderParams | GetSplitterParams (const wxWindow *win)=0 |
| virtual wxRendererVersion | GetVersion () const =0 |
Static Public Member Functions | |
| static wxRendererNative | Get () |
| static wxRendererNative | GetDefault () |
| static wxRendererNative | GetGeneric () |
| static wxRendererNative * | Load (const wxString &name) |
| static wxRendererNative * | Set (wxRendererNative *renderer) |
| virtual wxRendererNative::~wxRendererNative | ( | ) | [virtual] |
Virtual destructor as for any base class.
| virtual void wxRendererNative::DrawCheckBox | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw a check box.
flags may have the wxCONTROL_CHECKED, wxCONTROL_CURRENT or wxCONTROL_UNDETERMINED bit set, see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawComboBoxDropButton | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw a button like the one used by wxComboBox to show a drop down window. The usual appearance is a downwards pointing arrow.
flags may have the wxCONTROL_PRESSED or wxCONTROL_CURRENT bit set, see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawDropArrow | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw a drop down arrow that is suitable for use outside a combo box. Arrow will have transparent background.
rect is not entirely filled by the arrow. Instead, you should use bounding rectangle of a drop down button which arrow matches the size you need.
flags may have the wxCONTROL_PRESSED or wxCONTROL_CURRENT bit set, see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawFocusRect | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw a focus rectangle using the specified rectangle. wxListCtrl.
The only supported flags is wxCONTROL_SELECTED for items which are selected. see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| virtual int wxRendererNative::DrawHeaderButton | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0, |
|||
| wxHeaderSortIconType | sortArrow = wxHDR_SORT_ICON_NONE, |
|||
| wxHeaderButtonParams * | params = NULL | |||
| ) | [pure virtual] |
Draw the header control button (used, for example, by wxListCtrl).
Depending on platforms the flags parameter may support the wxCONTROL_SELECTED wxCONTROL_DISABLED and wxCONTROL_CURRENT bits, see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| virtual int wxRendererNative::DrawHeaderButtonContents | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0, |
|||
| wxHeaderSortIconType | sortArrow = wxHDR_SORT_ICON_NONE, |
|||
| wxHeaderButtonParams * | params = NULL | |||
| ) | [pure virtual] |
Draw the contents of a header control button (label, sort arrows, etc.). This function is normally only called by DrawHeaderButton().
Depending on platforms the flags parameter may support the wxCONTROL_SELECTED wxCONTROL_DISABLED and wxCONTROL_CURRENT bits, see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawItemSelectionRect | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw a selection rectangle underneath the text as used e.g. in a wxListCtrl.
The supported flags are wxCONTROL_SELECTED for items which are selected (e.g. often a blue rectangle) and wxCONTROL_CURRENT for the item that has the focus (often a dotted line around the item's text). wxCONTROL_FOCUSED may be used to indicate if the control has the focus (othewise the the selection rectangle is e.g. often grey and not blue). This may be ignored by the renderer or deduced by the code directly from the win.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawPushButton | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw a blank push button that looks very similar to wxButton.
flags may have the wxCONTROL_PRESSED, wxCONTROL_CURRENT or wxCONTROL_ISDEFAULT bit set, see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawSplitterBorder | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw the border for sash window: this border must be such that the sash drawn by DrawSplitterSash() blends into it well.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawSplitterSash | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxSize & | size, | |||
| wxCoord | position, | |||
| wxOrientation | orient, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw a sash. The orient parameter defines whether the sash should be vertical or horizontal and how the position should be interpreted.
Implemented in wxDelegateRendererNative.
| virtual void wxRendererNative::DrawTreeItemButton | ( | wxWindow * | win, | |
| wxDC & | dc, | |||
| const wxRect & | rect, | |||
| int | flags = 0 | |||
| ) | [pure virtual] |
Draw the expanded/collapsed icon for a tree control item.
To draw an expanded button the flags parameter must contain wxCONTROL_EXPANDED bit, see wxCONTROL_FLAGS.
Implemented in wxDelegateRendererNative.
| static wxRendererNative wxRendererNative::Get | ( | ) | [static] |
Return the currently used renderer.
| static wxRendererNative wxRendererNative::GetDefault | ( | ) | [static] |
| static wxRendererNative wxRendererNative::GetGeneric | ( | ) | [static] |
Return the generic implementation of the renderer. Under some platforms, this is the default renderer implementation, others have platform-specific default renderer which can be retrieved by calling GetDefault().
Returns the size of a check box.
Implemented in wxDelegateRendererNative.
| virtual int wxRendererNative::GetHeaderButtonHeight | ( | wxWindow * | win | ) | [pure virtual] |
Returns the height of a header button, either a fixed platform height if available, or a generic height based on the window's font.
Implemented in wxDelegateRendererNative.
| virtual wxSplitterRenderParams wxRendererNative::GetSplitterParams | ( | const wxWindow * | win | ) | [pure virtual] |
Get the splitter parameters, see wxSplitterRenderParams.
Implemented in wxDelegateRendererNative.
| virtual wxRendererVersion wxRendererNative::GetVersion | ( | ) | const [pure virtual] |
This function is used for version checking: Load() refuses to load any shared libraries implementing an older or incompatible version.
wxRendererVersion::Current_XXX values), but it has to be in the derived, not base, class, to detect mismatches between the renderers versions and so you have to implement it anew in all renderers. Implemented in wxDelegateRendererNative.
| static wxRendererNative* wxRendererNative::Load | ( | const wxString & | name | ) | [static] |
Load the renderer from the specified DLL, the returned pointer must be deleted by caller if not NULL when it is not used any more.
The name should be just the base name of the renderer and not the full name of the DLL file which is constructed differently (using wxDynamicLibrary::CanonicalizePluginName()) on different systems.
| static wxRendererNative* wxRendererNative::Set | ( | wxRendererNative * | renderer | ) | [static] |
Set the renderer to use, passing NULL reverts to using the default renderer (the global renderer must always exist).
Return the previous renderer used with Set() or NULL if none.
|
[ top ] |