]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/renderer.tex
Regenerated Makefile.in after printps.cpp changes
[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>
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
bc51e42e 12\section{\class{wxRendererNative}}\label{wxrenderernative}
3e6c2880
VZ
13
14First, a brief introduction into what is wxRenderer and why is it needed.
15
16Usually wxWindows uses the underlying low level GUI system to draw all the
17controls -- this is what we mean when we say that it is a ``native'' framework.
18However not all controls exist under all (or even any) platforms and in this
19case wxWindows provides a default, generic, implementation of them written in
20wxWindows itself.
21
22These controls however don't have the native appearance if only the standard
23line drawing and other graphics primitives are used if only because the native
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
28drawing, i.e. it abstracts the drawing operations and allows you to draw a,
29say, button, without caring about how exactly this is done. Of course, as we
30can draw the button differently in different renderers, this also allows us to
31emulate the native look and feel.
32
33
34So the renderers work by exposing a big set of high-level drawing functions
35which are used by the generic controls. There is always a default global
36renderer but it may be changed or extended by the user, see
37\helpref{Render sample}{samplerender}.
38
bc51e42e
VZ
39All drawing functions take some standard parameters:
40\begin{itemize}
41 \item \arg{win} is the window being drawn. it is normally not used and when
42 it is it should only be used as a generic \helpref{wxWindow}{wxwindow}
43 (in order to get its low level handle, for example), but you should
44 \emph{not} assume that it is of some given type as the same renderer
45 function may be reused for drawing different kinds of control.
46 \item \arg{dc} is the \helpref{wxDC}{wxdc} to draw on, only this device
47 context should be used for drawing. It is not necessary to restore
48 pens and brushes for it on function exit but, on the other hand, you
49 shouldn't assume that it is in any specific state on function entry
50 neither: the rendering functions should always prepare it.
51 \item \arg{rect} the bounding rectangle for the element to be drawn
52 \item \arg{flags} the optional flags (none by default) which can be a
53 combination of the \texttt{wxCONTROL\_XXX} constants below
54\end{itemize}
55
56\wxheading{Constants}
57
58The following rendering flags are defined:
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
75
76\wxheading{Derived from}
77
78No base class
79
80\wxheading{Include files}
81
82<wx/renderer.h>
83
84
85\latexignore{\rtfignore{\wxheading{Members}}}
86
87
88\membersection{wxRendererNative::\destruct{wxRendererNative}}\label{wxrenderernativedtor}
89
90\func{}{\destruct{wxRendererNative}}{\void}
91
92Virtual destructor as for any base class.
93
94
95\membersection{wxRendererNative::DrawHeaderButton}\label{wxrenderernativedrawheaderbutton}
96
97\func{void}{DrawHeaderButton}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
98
99Draw the header control button (used by \helpref{wxListCtrl}{wxlistctrl}).
100
101
102\membersection{wxRendererNative::DrawSplitterBorder}\label{wxrenderernativedrawsplitterborder}
103
104\func{void}{DrawSplitterBorder}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
105
106Draw the border for sash window: this border must be such that the sash
107drawn by \helpref{DrawSash}{wxrenderernativedrawsplittersash} blends into it
108well.
109
110
111\membersection{wxRendererNative::DrawSplitterSash}\label{wxrenderernativedrawsplittersash}
112
113\func{void}{DrawSplitterSash}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxSize\& }{size}, \param{wxCoord }{position}, \param{wxOrientation }{orient}, \param{int }{flags = 0}}
114
115Draw a sash. The \arg{orient} parameter defines whether the sash should be
116vertical or horizontal and how should the \arg{position} be interpreted.
117
118
119\membersection{wxRendererNative::DrawTreeItemButton}\label{wxrenderernativedrawtreeitembutton}
120
121\func{void}{DrawTreeItemButton}{\param{wxWindow* }{win}, \param{wxDC\& }{dc}, \param{const wxRect\& }{rect}, \param{int }{flags = 0}}
122
123Draw the expanded/collapsed icon for a tree control item. To draw an expanded
124button the \arg{flags} parameter must contain {\tt wxCONTROL\_EXPANDED} bit.
125
126
127\membersection{wxRendererNative::Get}\label{wxrenderernativeget}
128
129\func{wxRendererNative\&}{Get}{\void}
130
131Return the currently used renderer.
132
133
134\membersection{wxRendererNative::GetDefault}\label{wxrenderernativegetdefault}
135
136\func{wxRendererNative\&}{GetDefault}{\void}
137
138Return the default (native) implementation for this platform -- this is also
139the one used by default but this may be changed by calling
140\helpref{Set}{wxrenderernativeset} in which case the return value of this
141method may be different from the return value of \helpref{Get}{wxrenderernativeget}.
142
143
144\membersection{wxRendererNative::GetGeneric}\label{wxrenderernativegetgeneric}
145
146\func{wxRendererNative\&}{GetGeneric}{\void}
147
148Return the generic implementation of the renderer. Under some platforms, this
149is the default renderer implementation, others have platform-specific default
150renderer which can be retrieved by calling \helpref{GetDefault}{wxrenderernativegetdefault}.
151
152
153\membersection{wxRendererNative::GetSplitterParams}\label{wxrenderernativegetsplitterparams}
154
155\func{wxSplitterRenderParams}{GetSplitterParams}{\param{const wxWindow* }{win}}
156
157Get the splitter parameters, see
158\helpref{wxSplitterRenderParams}{wxsplitterrenderparams}.
159
160
161\membersection{wxRendererNative::GetVersion}\label{wxrenderernativegetversion}
162
163\constfunc{wxRendererVersion}{GetVersion}{\void}
164
165This function is used for version checking: \helpref{Load}{wxrenderernativeload}
166refuses to load any shared libraries implementing an older or incompatible
167version.
168
169The implementation of this method is always the same in all renderers (simply
170construct \helpref{wxRendererVersion}{wxrendererversion} using the
171{\tt wxRendererVersion::Current\_XXX} values), but it has to be in the derived,
172not base, class, to detect mismatches between the renderers versions and so you
173have to implement it anew in all renderers.
174
175
176\membersection{wxRendererNative::Load}\label{wxrenderernativeload}
177
178\func{wxRendererNative*}{Load}{\param{const wxString\& }{name}}
179
180Load the renderer from the specified DLL, the returned pointer must be
181deleted by caller if not {\tt NULL} when it is not used any more.
182
183The \arg{name} should be just the base name of the renderer and not the full
184name of the DLL file which is constructed differently (using
185\helpref{wxDynamicLibrary::CanonicalizePluginName}{wxdynamiclibrarycanonicalizepluginname})
186on different systems.
187
188
189\membersection{wxRendererNative::Set}\label{wxrenderernativeset}
190
191\func{wxRendererNative*}{Set}{\param{wxRendererNative* }{renderer}}
192
193Set the renderer to use, passing {\tt NULL} reverts to using the default
194renderer (the global renderer must always exist).
195
196Return the previous renderer used with Set() or {\tt NULL} if none.
3e6c2880 197