]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/renderer.tex
Updated configure and aclocal.m4 for new 0.1.8 Bakefile on account of
[wxWidgets.git] / docs / latex / wx / renderer.tex
CommitLineData
3e6c2880
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: renderer.tex
3%% Purpose: wxRenderer and wxRendererNative documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 06.08.03
7%% RCS-ID: $Id$
8%% Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
8795498c 9%% License: wxWindows license
3e6c2880
VZ
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
bc51e42e 12\section{\class{wxRendererNative}}\label{wxrenderernative}
3e6c2880 13
684761db 14First, a brief introduction to wxRenderer and why it is needed.
3e6c2880 15
fc2171bd 16Usually wxWidgets uses the underlying low level GUI system to draw all the
dceb1c09 17controls - this is what we mean when we say that it is a ``native'' framework.
3e6c2880 18However not all controls exist under all (or even any) platforms and in this
fc2171bd
JS
19case wxWidgets provides a default, generic, implementation of them written in
20wxWidgets itself.
3e6c2880 21
684761db
JS
22These controls don't have the native appearance if only the standard
23line drawing and other graphics primitives are used, because the native
3e6c2880
VZ
24appearance is different under different platforms while the lines are always
25drawn in the same way.
26
27This is why we have renderers: wxRenderer is a class which virtualizes the
684761db
JS
28drawing, i.e. it abstracts the drawing operations and allows you to draw say, a
29button, without caring about exactly how this is done. Of course, as we
3e6c2880
VZ
30can draw the button differently in different renderers, this also allows us to
31emulate the native look and feel.
32
684761db 33So the renderers work by exposing a large set of high-level drawing functions
3e6c2880
VZ
34which are used by the generic controls. There is always a default global
35renderer but it may be changed or extended by the user, see
36\helpref{Render sample}{samplerender}.
37
bc51e42e
VZ
38All drawing functions take some standard parameters:
39\begin{itemize}
d2c2afc9
JS
40\item \arg{win} is the window being drawn. It is normally not used and when
41it is it should only be used as a generic \helpref{wxWindow}{wxwindow}
42(in order to get its low level handle, for example), but you should
43\emph{not} assume that it is of some given type as the same renderer
44function may be reused for drawing different kinds of control.
45\item \arg{dc} is the \helpref{wxDC}{wxdc} to draw on. Only this device
46context should be used for drawing. It is not necessary to restore
47pens and brushes for it on function exit but, on the other hand, you
48shouldn't assume that it is in any specific state on function entry:
49the rendering functions should always prepare it.
50\item \arg{rect} the bounding rectangle for the element to be drawn.
51\item \arg{flags} the optional flags (none by default) which can be a
52combination of the \texttt{wxCONTROL\_XXX} constants below.
bc51e42e
VZ
53\end{itemize}
54
55\wxheading{Constants}
56
57The following rendering flags are defined:
d2c2afc9 58
bc51e42e
VZ
59\begin{verbatim}
60enum
61{
62 wxCONTROL_DISABLED = 0x00000001, // control is disabled
63 wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus
64 wxCONTROL_PRESSED = 0x00000004, // (button) is pressed
65 wxCONTROL_ISDEFAULT = 0x00000008, // only applies to the buttons
66 wxCONTROL_ISSUBMENU = wxCONTROL_ISDEFAULT, // only for menu items
67 wxCONTROL_EXPANDED = wxCONTROL_ISDEFAULT, // only for the tree items
68 wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control
69 wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox
70 wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked
71 wxCONTROL_CHECKABLE = 0x00000080 // (menu) item can be checked
72};
73\end{verbatim}
74
bc51e42e
VZ
75\wxheading{Derived from}
76
77No base class
78
79\wxheading{Include files}
80
81<wx/renderer.h>
82
83
84\latexignore{\rtfignore{\wxheading{Members}}}
85
86
87\membersection{wxRendererNative::\destruct{wxRendererNative}}\label{wxrenderernativedtor}
88
89\func{}{\destruct{wxRendererNative}}{\void}
90
91Virtual destructor as for any base class.
92
93
5e091b2b 94\membersection{wxRendererNative::DrawComboBoxDropButton}\label{wxrenderernativedrawcomboboxdropbutton}
f33cef9f
VZ
95
96\func{void}{DrawComboBoxDropButton}{\param{wxWindow *}{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags}}
97
98Draw a button like the one used by \helpref{wxComboBox}{wxcombobox} to show a
99drop down window. The usual appearance is a downwards pointing arrow.
100
101\arg{flags} may have the \texttt{wxCONTROL\_PRESSED} bit set.
102
103
bc51e42e
VZ
104\membersection{wxRendererNative::DrawHeaderButton}\label{wxrenderernativedrawheaderbutton}
105
106\func{void}{DrawHeaderButton}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
107
108Draw the header control button (used by \helpref{wxListCtrl}{wxlistctrl}).
109
110
111\membersection{wxRendererNative::DrawSplitterBorder}\label{wxrenderernativedrawsplitterborder}
112
113\func{void}{DrawSplitterBorder}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
114
115Draw the border for sash window: this border must be such that the sash
116drawn by \helpref{DrawSash}{wxrenderernativedrawsplittersash} blends into it
117well.
118
119
120\membersection{wxRendererNative::DrawSplitterSash}\label{wxrenderernativedrawsplittersash}
121
122\func{void}{DrawSplitterSash}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxSize\& }{size}, \param{wxCoord }{position}, \param{wxOrientation }{orient}, \param{int }{flags = 0}}
123
124Draw a sash. The \arg{orient} parameter defines whether the sash should be
125vertical or horizontal and how should the \arg{position} be interpreted.
126
127
128\membersection{wxRendererNative::DrawTreeItemButton}\label{wxrenderernativedrawtreeitembutton}
129
130\func{void}{DrawTreeItemButton}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
131
132Draw the expanded/collapsed icon for a tree control item. To draw an expanded
133button the \arg{flags} parameter must contain {\tt wxCONTROL\_EXPANDED} bit.
134
135
136\membersection{wxRendererNative::Get}\label{wxrenderernativeget}
137
138\func{wxRendererNative\&}{Get}{\void}
139
140Return the currently used renderer.
141
142
143\membersection{wxRendererNative::GetDefault}\label{wxrenderernativegetdefault}
144
145\func{wxRendererNative\&}{GetDefault}{\void}
146
147Return the default (native) implementation for this platform -- this is also
148the one used by default but this may be changed by calling
149\helpref{Set}{wxrenderernativeset} in which case the return value of this
150method may be different from the return value of \helpref{Get}{wxrenderernativeget}.
151
152
153\membersection{wxRendererNative::GetGeneric}\label{wxrenderernativegetgeneric}
154
155\func{wxRendererNative\&}{GetGeneric}{\void}
156
157Return the generic implementation of the renderer. Under some platforms, this
158is the default renderer implementation, others have platform-specific default
159renderer which can be retrieved by calling \helpref{GetDefault}{wxrenderernativegetdefault}.
160
161
162\membersection{wxRendererNative::GetSplitterParams}\label{wxrenderernativegetsplitterparams}
163
164\func{wxSplitterRenderParams}{GetSplitterParams}{\param{const wxWindow* }{win}}
165
166Get the splitter parameters, see
167\helpref{wxSplitterRenderParams}{wxsplitterrenderparams}.
168
169
170\membersection{wxRendererNative::GetVersion}\label{wxrenderernativegetversion}
171
172\constfunc{wxRendererVersion}{GetVersion}{\void}
173
174This function is used for version checking: \helpref{Load}{wxrenderernativeload}
175refuses to load any shared libraries implementing an older or incompatible
176version.
177
178The implementation of this method is always the same in all renderers (simply
179construct \helpref{wxRendererVersion}{wxrendererversion} using the
180{\tt wxRendererVersion::Current\_XXX} values), but it has to be in the derived,
181not base, class, to detect mismatches between the renderers versions and so you
182have to implement it anew in all renderers.
183
184
185\membersection{wxRendererNative::Load}\label{wxrenderernativeload}
186
187\func{wxRendererNative*}{Load}{\param{const wxString\& }{name}}
188
189Load the renderer from the specified DLL, the returned pointer must be
190deleted by caller if not {\tt NULL} when it is not used any more.
191
192The \arg{name} should be just the base name of the renderer and not the full
193name of the DLL file which is constructed differently (using
194\helpref{wxDynamicLibrary::CanonicalizePluginName}{wxdynamiclibrarycanonicalizepluginname})
195on different systems.
196
197
198\membersection{wxRendererNative::Set}\label{wxrenderernativeset}
199
200\func{wxRendererNative*}{Set}{\param{wxRendererNative* }{renderer}}
201
202Set the renderer to use, passing {\tt NULL} reverts to using the default
203renderer (the global renderer must always exist).
204
205Return the previous renderer used with Set() or {\tt NULL} if none.
3e6c2880 206