2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: renderer.h
|
2008-06-20 22:38:44 -04:00
|
|
|
// Purpose: interface of wxRendererNative
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
2008-06-20 22:38:44 -04:00
|
|
|
@anchor wxCONTROL_FLAGS
|
|
|
|
|
|
|
|
The following rendering flags are defined for wxRendererNative:
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/** Control is disabled. */
|
|
|
|
wxCONTROL_DISABLED = 0x00000001,
|
|
|
|
|
|
|
|
/** Currently has keyboard focus. */
|
|
|
|
wxCONTROL_FOCUSED = 0x00000002,
|
|
|
|
|
|
|
|
/** (Button) is pressed. */
|
|
|
|
wxCONTROL_PRESSED = 0x00000004,
|
|
|
|
|
|
|
|
/** Control-specific bit. */
|
|
|
|
wxCONTROL_SPECIAL = 0x00000008,
|
|
|
|
|
|
|
|
/** Only for the buttons. */
|
|
|
|
wxCONTROL_ISDEFAULT = wxCONTROL_SPECIAL,
|
|
|
|
|
|
|
|
/** Only for the menu items. */
|
|
|
|
wxCONTROL_ISSUBMENU = wxCONTROL_SPECIAL,
|
|
|
|
|
|
|
|
/** Only for the tree items. */
|
|
|
|
wxCONTROL_EXPANDED = wxCONTROL_SPECIAL,
|
|
|
|
|
|
|
|
/** Only for the status bar panes. */
|
|
|
|
wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL,
|
|
|
|
|
|
|
|
/** Checkboxes only: flat border. */
|
|
|
|
wxCONTROL_FLAT = wxCONTROL_SPECIAL,
|
|
|
|
|
|
|
|
/** Mouse is currently over the control. */
|
|
|
|
wxCONTROL_CURRENT = 0x00000010,
|
|
|
|
|
|
|
|
/** Selected item in e.g. listbox. */
|
|
|
|
wxCONTROL_SELECTED = 0x00000020,
|
|
|
|
|
|
|
|
/** (Check/radio button) is checked. */
|
|
|
|
wxCONTROL_CHECKED = 0x00000040,
|
|
|
|
|
|
|
|
/** (Menu) item can be checked. */
|
|
|
|
wxCONTROL_CHECKABLE = 0x00000080,
|
|
|
|
|
|
|
|
/** (Check) undetermined state. */
|
|
|
|
wxCONTROL_UNDETERMINED = wxCONTROL_CHECKABLE
|
|
|
|
};
|
|
|
|
|
2009-10-19 04:59:25 -04:00
|
|
|
/**
|
|
|
|
Title bar buttons supported by wxRendererNative::DrawTitleBarBitmap().
|
|
|
|
*/
|
|
|
|
enum wxTitleBarButton
|
|
|
|
{
|
|
|
|
wxTITLEBAR_BUTTON_CLOSE = 0x01000000,
|
|
|
|
wxTITLEBAR_BUTTON_MAXIMIZE = 0x02000000,
|
|
|
|
wxTITLEBAR_BUTTON_ICONIZE = 0x04000000,
|
|
|
|
wxTITLEBAR_BUTTON_RESTORE = 0x08000000,
|
|
|
|
wxTITLEBAR_BUTTON_HELP = 0x10000000
|
|
|
|
};
|
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
/**
|
|
|
|
@struct wxSplitterRenderParams
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
This is just a simple @c struct used as a return value of
|
2008-06-20 22:38:44 -04:00
|
|
|
wxRendererNative::GetSplitterParams().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
It doesn't have any methods and all of its fields are constant, so they can
|
|
|
|
only be examined but not modified.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
2008-06-20 22:38:44 -04:00
|
|
|
@category{gdi}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
struct wxSplitterRenderParams
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
/**
|
2008-06-20 22:38:44 -04:00
|
|
|
The only way to initialize this struct is by using this ctor.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
wxSplitterRenderParams(wxCoord widthSash_, wxCoord border_, bool isSens_);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
/**
|
|
|
|
The width of the border drawn by the splitter inside it, may be 0.
|
|
|
|
*/
|
|
|
|
const wxCoord border;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
@true if the sash changes appearance when the mouse passes over it, @false
|
|
|
|
otherwise.
|
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
const bool isHotSensitive;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
The width of the splitter sash.
|
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
const wxCoord widthSash;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
@struct wxHeaderButtonParams
|
|
|
|
|
|
|
|
This @c struct can optionally be used with
|
|
|
|
wxRendererNative::DrawHeaderButton() to specify custom values used to draw
|
|
|
|
the text or bitmap label.
|
|
|
|
|
|
|
|
@library{wxbase}
|
|
|
|
@category{gdi}
|
|
|
|
*/
|
|
|
|
struct wxHeaderButtonParams
|
|
|
|
{
|
|
|
|
wxHeaderButtonParams();
|
|
|
|
|
|
|
|
wxColour m_arrowColour;
|
|
|
|
wxColour m_selectionColour;
|
|
|
|
wxString m_labelText;
|
|
|
|
wxFont m_labelFont;
|
|
|
|
wxColour m_labelColour;
|
|
|
|
wxBitmap m_labelBitmap;
|
|
|
|
int m_labelAlignment;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
Used to specify the type of sort arrow used with
|
|
|
|
wxRendererNative::DrawHeaderButton().
|
|
|
|
*/
|
|
|
|
enum wxHeaderSortIconType
|
|
|
|
{
|
|
|
|
wxHDR_SORT_ICON_NONE, ///< Don't draw a sort arrow.
|
|
|
|
wxHDR_SORT_ICON_UP, ///< Draw a sort arrow icon pointing up.
|
|
|
|
wxHDR_SORT_ICON_DOWN ///< Draw a sort arrow icon pointing down.
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxDelegateRendererNative
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
wxDelegateRendererNative allows reuse of renderers code by forwarding all the
|
2009-03-02 15:09:10 -05:00
|
|
|
wxRendererNative methods to the given object and
|
|
|
|
thus allowing you to only modify some of its methods -- without having to
|
|
|
|
reimplement all of them.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-01 09:59:28 -04:00
|
|
|
Note that the "normal", inheritance-based approach, doesn't work with the
|
2008-03-08 08:52:38 -05:00
|
|
|
renderers as it is impossible to derive from a class unknown at compile-time
|
|
|
|
and the renderer is only chosen at run-time. So suppose that you want to only
|
|
|
|
add something to the drawing of the tree control buttons but leave all the
|
|
|
|
other methods unchanged -- the only way to do it, considering that the renderer
|
|
|
|
class which you want to customize might not even be written yet when you write
|
|
|
|
your code (it could be written later and loaded from a DLL during run-time), is
|
|
|
|
by using this class.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
Except for the constructor, it has exactly the same methods as
|
2009-03-02 15:09:10 -05:00
|
|
|
wxRendererNative and their implementation is
|
|
|
|
trivial: they are simply forwarded to the real renderer. Note that the "real"
|
|
|
|
renderer may, in turn, be a wxDelegateRendererNative as well and that there may
|
|
|
|
be arbitrarily many levels like this -- but at the end of the chain there must
|
|
|
|
be a real renderer which does the drawing.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-06-20 22:38:44 -04:00
|
|
|
@category{gdi}
|
|
|
|
|
|
|
|
@see wxRendererNative
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxDelegateRendererNative : public wxRendererNative
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The default constructor does the same thing as the other one except that it
|
2008-06-20 22:38:44 -04:00
|
|
|
uses the @ref wxRendererNative::GetGeneric() "generic renderer" instead of the
|
|
|
|
user-specified @a rendererNative.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
In any case, this sets up the delegate renderer object to follow all calls to
|
|
|
|
the specified real renderer.
|
|
|
|
*/
|
|
|
|
wxDelegateRendererNative();
|
|
|
|
/**
|
2008-06-20 22:38:44 -04:00
|
|
|
This constructor uses the user-specified @a rendererNative to set up the delegate
|
|
|
|
renderer object to follow all calls to the specified real renderer.
|
|
|
|
|
|
|
|
@note
|
|
|
|
This object does not take ownership of (i.e. won't delete) @a rendererNative.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
wxDelegateRendererNative(wxRendererNative& rendererNative);
|
|
|
|
|
|
|
|
// The rest of these functions inherit the documentation from wxRendererNative
|
|
|
|
|
|
|
|
virtual int DrawHeaderButton(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0,
|
|
|
|
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
|
|
|
|
wxHeaderButtonParams* params = NULL);
|
|
|
|
|
|
|
|
virtual int DrawHeaderButtonContents(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0,
|
|
|
|
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
|
|
|
|
wxHeaderButtonParams* params = NULL);
|
|
|
|
|
|
|
|
virtual int GetHeaderButtonHeight(wxWindow *win);
|
|
|
|
|
2010-10-30 11:57:32 -04:00
|
|
|
virtual int GetHeaderButtonMargin(wxWindow *win);
|
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0);
|
|
|
|
|
|
|
|
virtual void DrawSplitterBorder(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0);
|
|
|
|
|
|
|
|
virtual void DrawSplitterSash(wxWindow *win, wxDC& dc,
|
|
|
|
const wxSize& size, wxCoord position,
|
|
|
|
wxOrientation orient, int flags = 0);
|
|
|
|
|
|
|
|
virtual void DrawComboBoxDropButton(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0);
|
|
|
|
|
|
|
|
virtual void DrawDropArrow(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0);
|
|
|
|
|
|
|
|
virtual void DrawCheckBox(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0 );
|
|
|
|
|
2009-03-02 15:09:10 -05:00
|
|
|
virtual wxSize GetCheckBoxSize(wxWindow *win);
|
2008-08-02 17:51:22 -04:00
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
virtual void DrawPushButton(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0 );
|
|
|
|
|
|
|
|
virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0 );
|
|
|
|
|
|
|
|
virtual void DrawFocusRect(wxWindow* win, wxDC& dc,
|
|
|
|
const wxRect& rect, int flags = 0);
|
|
|
|
|
|
|
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
|
|
|
|
|
|
|
|
virtual wxRendererVersion GetVersion() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxRendererNative
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
First, a brief introduction to wxRendererNative and why it is needed.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Usually wxWidgets uses the underlying low level GUI system to draw all the
|
2008-04-01 09:59:28 -04:00
|
|
|
controls - this is what we mean when we say that it is a "native" framework.
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
This is why we have renderers: wxRendererNative is a class which virtualizes the
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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
|
2008-03-08 09:43:31 -05:00
|
|
|
renderer but it may be changed or extended by the user, see
|
2008-06-20 22:38:44 -04:00
|
|
|
@ref page_samples_render.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
All drawing functions take some standard parameters:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-06-20 22:38:44 -04:00
|
|
|
@li @a win - The window being drawn. It is normally not used and when
|
2008-03-08 09:43:31 -05:00
|
|
|
it is it should only be used as a generic wxWindow
|
2008-03-08 08:52:38 -05:00
|
|
|
(in order to get its low level handle, for example), but you should
|
|
|
|
not assume that it is of some given type as the same renderer
|
|
|
|
function may be reused for drawing different kinds of control.
|
2008-06-20 22:38:44 -04:00
|
|
|
@li @a dc - The wxDC to draw on. Only this device
|
2008-03-08 08:52:38 -05:00
|
|
|
context should be used for drawing. It is not necessary to restore
|
|
|
|
pens and brushes for it on function exit but, on the other hand, you
|
|
|
|
shouldn't assume that it is in any specific state on function entry:
|
|
|
|
the rendering functions should always prepare it.
|
2008-06-20 22:38:44 -04:00
|
|
|
@li @a rect - The bounding rectangle for the element to be drawn.
|
|
|
|
@li @a flags - The optional flags (none by default) which can be a
|
|
|
|
combination of the @ref wxCONTROL_FLAGS.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Note that each drawing function restores the wxDC attributes if
|
|
|
|
it changes them, so it is safe to assume that the same pen, brush and colours
|
|
|
|
that were active before the call to this function are still in effect after it.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{gdi}
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxRendererNative
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Virtual destructor as for any base class.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxRendererNative();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-08-02 17:51:22 -04:00
|
|
|
Draw a check box.
|
2008-06-20 22:38:44 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a flags may have the @c wxCONTROL_CHECKED, @c wxCONTROL_CURRENT or
|
2008-06-20 22:38:44 -04:00
|
|
|
@c wxCONTROL_UNDETERMINED bit set, see @ref wxCONTROL_FLAGS.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void DrawCheckBox(wxWindow* win, wxDC& dc, const wxRect& rect,
|
|
|
|
int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Draw a button like the one used by wxComboBox to show a
|
|
|
|
drop down window. The usual appearance is a downwards pointing arrow.
|
2008-06-20 22:38:44 -04:00
|
|
|
|
|
|
|
@a flags may have the @c wxCONTROL_PRESSED or @c wxCONTROL_CURRENT bit set,
|
|
|
|
see @ref wxCONTROL_FLAGS.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
virtual void DrawComboBoxDropButton(wxWindow* win, wxDC& dc,
|
2008-10-28 11:36:26 -04:00
|
|
|
const wxRect& rect, int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Draw a drop down arrow that is suitable for use outside a combo box. Arrow will
|
2008-06-20 22:38:44 -04:00
|
|
|
have transparent background.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a rect is not entirely filled by the arrow. Instead, you should use bounding
|
2008-03-08 08:52:38 -05:00
|
|
|
rectangle of a drop down button which arrow matches the size you need.
|
2008-06-20 22:38:44 -04:00
|
|
|
|
|
|
|
@a flags may have the @c wxCONTROL_PRESSED or @c wxCONTROL_CURRENT bit set,
|
|
|
|
see @ref wxCONTROL_FLAGS.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
virtual void DrawDropArrow(wxWindow* win, wxDC& dc, const wxRect& rect,
|
2008-10-28 11:36:26 -04:00
|
|
|
int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Draw a focus rectangle using the specified rectangle.
|
2008-06-20 22:38:44 -04:00
|
|
|
wxListCtrl.
|
|
|
|
|
|
|
|
The only supported flags is @c wxCONTROL_SELECTED for items which are selected.
|
|
|
|
see @ref wxCONTROL_FLAGS.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect,
|
2008-10-27 17:26:54 -04:00
|
|
|
int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-06-20 22:38:44 -04:00
|
|
|
Draw the header control button (used, for example, by wxListCtrl).
|
|
|
|
|
|
|
|
Depending on platforms the @a flags parameter may support the @c wxCONTROL_SELECTED
|
|
|
|
@c wxCONTROL_DISABLED and @c wxCONTROL_CURRENT bits, see @ref wxCONTROL_FLAGS.
|
|
|
|
|
|
|
|
@return
|
2011-03-22 10:08:30 -04:00
|
|
|
The optimal width to contain the unabbreviated label text or
|
2008-06-20 22:38:44 -04:00
|
|
|
bitmap, the sort arrow if present, and internal margins.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual int DrawHeaderButton(wxWindow* win, wxDC& dc, const wxRect& rect,
|
|
|
|
int flags = 0,
|
|
|
|
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = NULL) = 0;
|
2008-06-20 22:38:44 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Draw the contents of a header control button (label, sort arrows,
|
|
|
|
etc.). This function is normally only called by DrawHeaderButton().
|
|
|
|
|
|
|
|
Depending on platforms the @a flags parameter may support the @c wxCONTROL_SELECTED
|
|
|
|
@c wxCONTROL_DISABLED and @c wxCONTROL_CURRENT bits, see @ref wxCONTROL_FLAGS.
|
|
|
|
|
|
|
|
@return
|
2011-03-22 10:08:30 -04:00
|
|
|
The optimal width to contain the unabbreviated label text or
|
2008-06-20 22:38:44 -04:00
|
|
|
bitmap, the sort arrow if present, and internal margins.
|
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual int DrawHeaderButtonContents(wxWindow* win, wxDC& dc,
|
2008-06-20 22:38:44 -04:00
|
|
|
const wxRect& rect, int flags = 0,
|
2008-10-13 09:24:43 -04:00
|
|
|
wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = NULL) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Draw a selection rectangle underneath the text as used e.g. in a
|
2008-06-20 22:38:44 -04:00
|
|
|
wxListCtrl.
|
|
|
|
|
|
|
|
The supported @a flags are @c wxCONTROL_SELECTED for items
|
|
|
|
which are selected (e.g. often a blue rectangle) and @c wxCONTROL_CURRENT
|
|
|
|
for the item that has the focus (often a dotted line around the item's text).
|
|
|
|
@c wxCONTROL_FOCUSED may be used to indicate if the control has the focus
|
2011-03-22 10:08:30 -04:00
|
|
|
(otherwise the selection rectangle is e.g. often grey and not blue).
|
2008-06-20 22:38:44 -04:00
|
|
|
This may be ignored by the renderer or deduced by the code directly from
|
|
|
|
the @a win.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
virtual void DrawItemSelectionRect(wxWindow* win, wxDC& dc,
|
2008-10-27 17:26:54 -04:00
|
|
|
const wxRect& rect, int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Draw a blank push button that looks very similar to wxButton.
|
2008-06-20 22:38:44 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a flags may have the @c wxCONTROL_PRESSED, @c wxCONTROL_CURRENT or
|
2008-06-20 22:38:44 -04:00
|
|
|
@c wxCONTROL_ISDEFAULT bit set, see @ref wxCONTROL_FLAGS.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void DrawPushButton(wxWindow* win, wxDC& dc, const wxRect& rect,
|
|
|
|
int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Draw the border for sash window: this border must be such that the sash
|
2008-06-20 22:38:44 -04:00
|
|
|
drawn by DrawSplitterSash() blends into it well.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual void DrawSplitterBorder(wxWindow* win, wxDC& dc, const wxRect& rect,
|
|
|
|
int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Draw a sash. The @a orient parameter defines whether the sash should be
|
|
|
|
vertical or horizontal and how the @a position should be interpreted.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual void DrawSplitterSash(wxWindow* win, wxDC& dc, const wxSize& size,
|
|
|
|
wxCoord position, wxOrientation orient,
|
|
|
|
int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-06-20 22:38:44 -04:00
|
|
|
Draw the expanded/collapsed icon for a tree control item.
|
|
|
|
|
|
|
|
To draw an expanded button the @a flags parameter must contain @c wxCONTROL_EXPANDED bit,
|
|
|
|
see @ref wxCONTROL_FLAGS.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual void DrawTreeItemButton(wxWindow* win, wxDC& dc, const wxRect& rect,
|
|
|
|
int flags = 0) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-03-01 11:46:49 -05:00
|
|
|
/**
|
2009-01-28 11:44:10 -05:00
|
|
|
Draw a native wxChoice
|
|
|
|
*/
|
2009-08-19 20:44:22 -04:00
|
|
|
virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
|
2009-01-28 11:44:10 -05:00
|
|
|
|
2009-03-01 11:46:49 -05:00
|
|
|
/**
|
2009-01-28 11:44:10 -05:00
|
|
|
Draw a native wxComboBox
|
|
|
|
*/
|
2009-08-19 20:44:22 -04:00
|
|
|
virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
|
2009-01-28 11:44:10 -05:00
|
|
|
|
2009-03-01 11:46:49 -05:00
|
|
|
/**
|
2009-01-28 11:44:10 -05:00
|
|
|
Draw a native wxTextCtrl frame
|
|
|
|
*/
|
2009-08-19 20:44:22 -04:00
|
|
|
virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
|
2009-01-28 11:44:10 -05:00
|
|
|
|
|
|
|
/**
|
2009-08-19 20:44:22 -04:00
|
|
|
Draw a native wxRadioButton bitmap.
|
2009-01-28 11:44:10 -05:00
|
|
|
*/
|
2009-08-19 20:44:22 -04:00
|
|
|
virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) = 0;
|
2009-01-28 11:44:10 -05:00
|
|
|
|
2009-10-19 04:59:25 -04:00
|
|
|
/**
|
|
|
|
Draw a title bar button in the given state.
|
|
|
|
|
|
|
|
This function is currently only available under MSW and OS X (and only
|
|
|
|
for wxTITLEBAR_BUTTON_CLOSE under the latter), its best replacement for
|
|
|
|
the other platforms is to use wxArtProvider to retrieve the bitmaps for
|
|
|
|
@c wxART_HELP and @c wxART_CLOSE (but not any other title bar buttons
|
|
|
|
and not for any state but normal, i.e. not pressed and not current one).
|
|
|
|
|
|
|
|
The presence of this function is indicated by @c
|
|
|
|
wxHAS_DRAW_TITLE_BAR_BITMAP symbol being defined.
|
|
|
|
|
|
|
|
Also notice that PNG handler must be enabled using wxImage::AddHandler()
|
|
|
|
to use this function under OS X currently as the bitmaps are embedded
|
|
|
|
in the library itself in PNG format.
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
virtual void DrawTitleBarBitmap(wxWindow *win,
|
|
|
|
wxDC& dc,
|
|
|
|
const wxRect& rect,
|
|
|
|
wxTitleBarButton button,
|
|
|
|
int flags = 0) = 0;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Return the currently used renderer.
|
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
static wxRendererNative& Get();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Return the default (native) implementation for this platform -- this is also
|
2008-03-08 09:43:31 -05:00
|
|
|
the one used by default but this may be changed by calling
|
2008-03-08 08:52:38 -05:00
|
|
|
Set() in which case the return value of this
|
|
|
|
method may be different from the return value of Get().
|
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
static wxRendererNative& GetDefault();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
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().
|
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
static wxRendererNative& GetGeneric();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-08-02 17:51:22 -04:00
|
|
|
/**
|
|
|
|
Returns the size of a check box.
|
2009-03-02 15:09:10 -05:00
|
|
|
The @a win parameter is not used currently and can be @NULL.
|
2008-08-02 17:51:22 -04:00
|
|
|
*/
|
2009-03-02 15:09:10 -05:00
|
|
|
virtual wxSize GetCheckBoxSize(wxWindow* win) = 0;
|
2008-08-02 17:51:22 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Returns the height of a header button, either a fixed platform height if
|
2009-03-02 15:09:10 -05:00
|
|
|
available, or a generic height based on the @a win window's font.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual int GetHeaderButtonHeight(wxWindow* win) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2010-10-30 11:57:32 -04:00
|
|
|
/**
|
|
|
|
Returns the horizontal margin on the left and right sides of header
|
|
|
|
button's label.
|
|
|
|
|
|
|
|
@since 2.9.2
|
|
|
|
*/
|
|
|
|
virtual int GetHeaderButtonMargin(wxWindow *win) = 0;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2009-03-02 15:09:10 -05:00
|
|
|
Get the splitter parameters, see wxSplitterRenderParams.
|
|
|
|
The @a win parameter should be a wxSplitterWindow.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow* win) = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
This function is used for version checking: Load()
|
2008-03-08 08:52:38 -05:00
|
|
|
refuses to load any shared libraries implementing an older or incompatible
|
|
|
|
version.
|
2008-06-20 22:38:44 -04:00
|
|
|
|
|
|
|
@remarks
|
2008-03-08 08:52:38 -05:00
|
|
|
The implementation of this method is always the same in all renderers (simply
|
2008-06-20 22:38:44 -04:00
|
|
|
construct wxRendererVersion using the @c 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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual wxRendererVersion GetVersion() const = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
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.
|
2008-06-20 22:38:44 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
The @a name should be just the base name of the renderer and not the full
|
2008-03-08 09:43:31 -05:00
|
|
|
name of the DLL file which is constructed differently (using
|
2008-06-20 22:38:44 -04:00
|
|
|
wxDynamicLibrary::CanonicalizePluginName())
|
2008-03-08 08:52:38 -05:00
|
|
|
on different systems.
|
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
static wxRendererNative* Load(const wxString& name);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set the renderer to use, passing @NULL reverts to using the default
|
|
|
|
renderer (the global renderer must always exist).
|
2008-06-20 22:38:44 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Return the previous renderer used with Set() or @NULL if none.
|
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
static wxRendererNative* Set(wxRendererNative* renderer);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-06-20 22:38:44 -04:00
|
|
|
@struct wxRendererVersion
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
This simple struct represents the wxRendererNative
|
|
|
|
interface version and is only used as the return value of
|
2008-06-20 22:38:44 -04:00
|
|
|
wxRendererNative::GetVersion().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
The version has two components: the version itself and the age. If the main
|
|
|
|
program and the renderer have different versions they are never compatible with
|
|
|
|
each other because the version is only changed when an existing virtual
|
|
|
|
function is modified or removed. The age, on the other hand, is incremented
|
|
|
|
each time a new virtual method is added and so, at least for the compilers
|
|
|
|
using a common C++ object model, the calling program is compatible with any
|
|
|
|
renderer which has the age greater or equal to its age. This verification is
|
2008-03-10 11:24:38 -04:00
|
|
|
done by IsCompatible() method.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
2008-06-20 22:38:44 -04:00
|
|
|
@category{gdi}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
struct wxRendererVersion
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Checks if the main program is compatible with the renderer having the version
|
2008-03-08 08:52:38 -05:00
|
|
|
@e ver, returns @true if it is and @false otherwise.
|
2008-06-20 22:38:44 -04:00
|
|
|
|
|
|
|
This method is used by wxRendererNative::Load() to determine whether a
|
2008-03-08 08:52:38 -05:00
|
|
|
renderer can be used.
|
|
|
|
*/
|
|
|
|
static bool IsCompatible(const wxRendererVersion& ver);
|
|
|
|
|
|
|
|
/**
|
|
|
|
The age component.
|
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
const int age;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
The version component.
|
|
|
|
*/
|
2008-06-20 22:38:44 -04:00
|
|
|
const int version;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|