2 \section{\class{wxDataViewRenderer
}}\label{wxdataviewrenderer
}
5 This class is used by
\helpref{wxDataViewCtrl
}{wxdataviewctrl
} to
6 render the individual cells. One instance of a renderer class is
7 owned by
\helpref{wxDataViewColumn
}{wxdataviewcolumn
}. There is
8 a number of ready-to-use renderers provided:
9 \helpref{wxDataViewTextRenderer
}{wxdataviewtextrenderer
},
10 \helpref{wxDataViewIconTextRenderer
}{wxdataviewtextrenderer
},
11 \helpref{wxDataViewToggleRenderer
}{wxdataviewtogglerenderer
},
12 \helpref{wxDataViewProgressRenderer
}{wxdataviewprogressrenderer
},
13 \helpref{wxDataViewBitmapRenderer
}{wxdataviewbitmaprenderer
},
14 \helpref{wxDataViewDateRenderer
}{wxdataviewdaterenderer
}.
16 Additionally, the user can write own renderers by deriving from
17 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}.
19 The
{\it wxDataViewCellMode
} flag controls, what actions
20 the cell data allows.
{\it wxDATAVIEW
\_CELL\_ACTIVATABLE}
21 indicates that the user can double click the cell and
22 something will happen (e.g. a window for editing a date
23 will pop up).
{\it wxDATAVIEW
\_CELL\_EDITABLE} indicates
24 that the user can edit the data in-place, i.e. an control
25 will show up after a slow click on the cell. This behaviour
26 is best known from changing the filename in most file
33 enum wxDataViewCellMode
35 wxDATAVIEW_CELL_INERT,
36 wxDATAVIEW_CELL_ACTIVATABLE,
37 wxDATAVIEW_CELL_EDITABLE
42 The
{\it wxDataViewCellRenderState
} flag controls how the
43 the renderer should display its contents in a cell:
47 enum wxDataViewCellRenderState
49 wxDATAVIEW_CELL_SELECTED =
1,
50 wxDATAVIEW_CELL_PRELIT =
2,
51 wxDATAVIEW_CELL_INSENSITIVE =
4,
52 wxDATAVIEW_CELL_FOCUSED =
8
58 \wxheading{Derived from
}
60 \helpref{wxObject
}{wxobject
}
62 \wxheading{Include files
}
68 \helpref{wxAdv
}{librarieslist
}
72 \latexignore{\rtfignore{\wxheading{Members
}}}
74 \membersection{wxDataViewRenderer::wxDataViewRenderer
}\label{wxdataviewrendererwxdataviewrenderer
}
76 \func{}{wxDataViewRenderer
}{\param{const wxString\&
}{varianttype
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
80 \membersection{wxDataViewRenderer::GetMode
}\label{wxdataviewrenderergetmode
}
82 \func{virtual wxDataViewCellMode
}{GetMode
}{\void}
84 Returns the cell mode.
86 \membersection{wxDataViewRenderer::GetOwner
}\label{wxdataviewrenderergetowner
}
88 \func{virtual wxDataViewColumn*
}{GetOwner
}{\void}
90 Returns pointer to the owning
\helpref{wxDataViewColumn
}{wxdataviewcolumn
}.
92 \membersection{wxDataViewRenderer::GetValue
}\label{wxdataviewrenderergetvalue
}
94 \func{virtual bool
}{GetValue
}{\param{wxVariant\&
}{value
}}
96 This methods retrieves the value from the renderer in order to
97 transfer the value back to the data model. Returns
{\it false
}
100 \membersection{wxDataViewRenderer::GetVariantType
}\label{wxdataviewrenderergetvarianttype
}
102 \func{virtual wxString
}{GetVariantType
}{\void}
104 Returns a string with the type of the
\helpref{wxVariant
}{wxvariant
}
105 supported by this renderer.
107 \membersection{wxDataViewRenderer::SetOwner
}\label{wxdataviewrenderersetowner
}
109 \func{virtual void
}{SetOwner
}{\param{wxDataViewColumn*
}{owner
}}
111 Sets the owning
\helpref{wxDataViewColumn
}{wxdataviewcolumn
}. This
112 is usually called from within wxDataViewColumn.
114 \membersection{wxDataViewRenderer::SetValue
}\label{wxdataviewrenderersetvalue
}
116 \func{virtual bool
}{SetValue
}{\param{const wxVariant\&
}{value
}}
118 Set the value of the renderer (and thus its cell) to
{\it value
}.
119 The internal code will then render this cell with this data.
122 \membersection{wxDataViewRenderer::Validate
}\label{wxdataviewrenderervalidate
}
124 \func{virtual bool
}{Validate
}{\param{wxVariant\&
}{value
}}
126 Before data is committed to the data model, it is passed to this
127 method where it can be checked for validity. This can also be
128 used for checking a valid range or limiting the user input in
129 a certain aspect (e.g. max number of characters or only alphanumeric
130 input, ASCII only etc.). Return
{\it false
} if the value is
133 Please note that due to implementation limitations, this validation
134 is done after the editing control already is destroyed and the
135 editing process finished.
138 \section{\class{wxDataViewTextRenderer
}}\label{wxdataviewtextrenderer
}
140 wxDataViewTextRenderer is used for rendering text. It supports
141 in-place editing if desired.
144 \wxheading{Derived from
}
146 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
147 \helpref{wxObject
}{wxobject
}
149 \wxheading{Include files
}
155 \helpref{wxAdv
}{librarieslist
}
158 \latexignore{\rtfignore{\wxheading{Members
}}}
160 \membersection{wxDataViewTextRenderer::wxDataViewTextRenderer
}\label{wxdataviewtextrendererwxdataviewtextrenderer
}
162 \func{}{wxDataViewTextRenderer
}{\param{const wxString\&
}{varianttype = wxT("string")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
166 \section{\class{wxDataViewProgressRenderer
}}\label{wxdataviewprogressrenderer
}
168 wxDataViewProgressRenderer
171 \wxheading{Derived from
}
173 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
174 \helpref{wxObject
}{wxobject
}
176 \wxheading{Include files
}
182 \helpref{wxAdv
}{librarieslist
}
185 \latexignore{\rtfignore{\wxheading{Members
}}}
187 \membersection{wxDataViewProgressRenderer::wxDataViewProgressRenderer
}\label{wxdataviewprogressrendererwxdataviewprogressrenderer
}
189 \func{}{wxDataViewProgressRenderer
}{\param{const wxString\&
}{label = wxEmptyString
},
\param{const wxString\&
}{varianttype = wxT("long")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
192 \section{\class{wxDataViewIconText
}}\label{wxdataviewicontext
}
194 wxDataViewIconText is used by
195 \helpref{wxDataViewIconTextRenderer
}{wxdataviewicontextrenderer
}
196 for data transfer. This class can be converted to a from
197 a
\helpref{wxVariant
}{wxvariant
}.
199 \wxheading{Derived from
}
201 \helpref{wxObject
}{wxobject
}
203 \wxheading{Include files
}
207 \membersection{wxDataViewIconText::wxDataViewIconText
}\label{wxdataviewicontextwxdataviewicontext
}
209 \func{}{wxDataViewIconText
}{\param{const wxString\&
}{text = wxEmptyString
},
\param{const wxIcon\&
}{icon = wxNullIcon
}}
211 \func{}{wxDataViewIconText
}{\param{const wxDataViewIconText\&
}{other
}}
215 \membersection{wxDataViewIconText::GetIcon
}\label{wxdataviewicontextgeticon
}
217 \constfunc{const wxIcon\&
}{GetIcon
}{\void}
221 \membersection{wxDataViewIconText::GetText
}\label{wxdataviewicontextgettext
}
223 \constfunc{wxString
}{GetText
}{\void}
227 \membersection{wxDataViewIconText::SetIcon
}\label{wxdataviewicontextseticon
}
229 \func{void
}{SetIcon
}{\param{const wxIcon\&
}{icon
}}
233 \membersection{wxDataViewIconText::SetText
}\label{wxdataviewicontextsettext
}
235 \func{void
}{SetText
}{\param{const wxString\&
}{text
}}
239 \section{\class{wxDataViewIconTextRenderer
}}\label{wxdataviewicontextrenderer
}
241 The wxDataViewIconTextRenderer class is used to display text with
242 a small icon next to it as it is typically done in a file manager.
243 This classes uses the
\helpref{wxDataViewIconText
}{wxdataviewicontext
}
244 helper class to store its data. wxDataViewIonText can be converted
245 to a from a
\helpref{wxVariant
}{wxvariant
} using the left shift
248 \wxheading{Derived from
}
250 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
251 \helpref{wxObject
}{wxobject
}
253 \wxheading{Include files
}
259 \helpref{wxAdv
}{librarieslist
}
262 \latexignore{\rtfignore{\wxheading{Members
}}}
264 \membersection{wxDataViewIconTextRenderer::wxDataViewIconTextRenderer
}\label{wxdataviewtogglerendererwxdataviewicontextrenderer
}
266 \func{}{wxDataViewIconTextRenderer
}{\param{const wxString\&
}{varianttype = wxT("wxDataViewIconText")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
269 \section{\class{wxDataViewToggleRenderer
}}\label{wxdataviewtogglerenderer
}
271 wxDataViewToggleRenderer
273 \wxheading{Derived from
}
275 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
276 \helpref{wxObject
}{wxobject
}
278 \wxheading{Include files
}
284 \helpref{wxAdv
}{librarieslist
}
287 \latexignore{\rtfignore{\wxheading{Members
}}}
289 \membersection{wxDataViewToggleRenderer::wxDataViewToggleRenderer
}\label{wxdataviewtogglerendererwxdataviewtogglerenderer
}
291 \func{}{wxDataViewToggleRenderer
}{\param{const wxString\&
}{varianttype = wxT("bool")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
294 \section{\class{wxDataViewBitmapRenderer
}}\label{wxdataviewbitmaprenderer
}
296 wxDataViewBitmapRenderer
298 \wxheading{Derived from
}
300 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
301 \helpref{wxObject
}{wxobject
}
303 \wxheading{Include files
}
309 \helpref{wxAdv
}{librarieslist
}
312 \latexignore{\rtfignore{\wxheading{Members
}}}
314 \membersection{wxDataViewBitmapRenderer::wxDataViewBitmapRenderer
}\label{wxdataviewbitmaprendererwxdataviewbitmaprenderer
}
316 \func{}{wxDataViewBitmapRenderer
}{\param{const wxString\&
}{varianttype = wxT("wxBitmap")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
319 \section{\class{wxDataViewDateRenderer
}}\label{wxdataviewdaterenderer
}
321 wxDataViewDateRenderer
324 \wxheading{Derived from
}
326 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
327 \helpref{wxObject
}{wxobject
}
329 \wxheading{Include files
}
335 \helpref{wxAdv
}{librarieslist
}
338 \latexignore{\rtfignore{\wxheading{Members
}}}
340 \membersection{wxDataViewDateRenderer::wxDataViewDateRenderer
}\label{wxdataviewdaterendererwxdataviewdaterenderer
}
342 \func{}{wxDataViewDateRenderer
}{\param{const wxString\&
}{varianttype = wxT("datetime")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE}}
345 \section{\class{wxDataViewCustomRenderer
}}\label{wxdataviewcustomrenderer
}
347 You need to derive a new class from wxDataViewCustomRenderer in
348 order to write a new renderer. You need to override at least
349 \helpref{SetValue
}{wxdataviewrenderersetvalue
},
350 \helpref{GetValue
}{wxdataviewrenderergetvalue
},
351 \helpref{GetSize
}{wxdataviewcustomrenderergetsize
}
352 and
\helpref{Render
}{wxdataviewcustomrendererrender
}.
354 If you want your renderer to support in-place editing then you
355 also need to override
356 \helpref{HasEditorCtrl
}{wxdataviewcustomrendererhaseditorctrl
},
357 \helpref{CreateEditorCtrl
}{wxdataviewcustomrenderercreateeditorctrl
}
358 and
\helpref{GetValueFromEditorCtrl
}{wxdataviewcustomrenderergetvaluefromeditorctrl
}.
359 Note that a special event handler will be pushed onto that
360 editor control which handles <ENTER> and focus out events
361 in order to end the editing.
363 \wxheading{Derived from
}
365 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
366 \helpref{wxObject
}{wxobject
}
368 \wxheading{Include files
}
374 \helpref{wxAdv
}{librarieslist
}
377 \latexignore{\rtfignore{\wxheading{Members
}}}
379 \membersection{wxDataViewCustomRenderer::wxDataViewCustomRenderer
}\label{wxdataviewcustomrendererwxdataviewcustomrenderer
}
381 \func{}{wxDataViewCustomRenderer
}{\param{const wxString\&
}{varianttype = wxT("string")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{bool
}{no
\_init = false
}}
385 \membersection{wxDataViewCustomRenderer::
\destruct{wxDataViewCustomRenderer
}}\label{wxdataviewcustomrendererdtor
}
387 \func{}{\destruct{wxDataViewCustomRenderer
}}{\void}
392 \membersection{wxDataViewCustomRenderer::HasEditorCtrl
}\label{wxdataviewcustomrendererhaseditorctrl
}
394 \func{virtual bool
}{HasEditorCtrl
}{\void}
396 Override this and make it return
{\it true
} in order to
397 indicate that this renderer supports in-place editing.
399 \membersection{wxDataViewCustomRenderer::CreateEditorCtrl
}\label{wxdataviewcustomrenderercreateeditorctrl
}
401 \func{virtual wxControl*
}{CreateEditorCtrl
}{\param{wxWindow *
}{parent
},
\param{wxRect
}{labelRect
},
\param{const wxVariant \&
}{value
}}
403 Override this to create the actual editor control once editing
404 is about to start.
{\it parent
} is the parent of the editor
405 control,
{\it labelRect
} indicates the position and
406 size of the editor control and
{\it value
} is its initial value:
412 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
413 labelRect.GetTopLeft(), labelRect.GetSize(),
0,
0,
100, l );
418 \membersection{wxDataViewCustomRenderer::GetValueFromEditorCtrl
}\label{wxdataviewcustomrenderergetvaluefromeditorctrl
}
420 \func{virtual bool
}{GetValueFromEditorCtrl
}{\param{wxControl*
}{editor
},
\param{wxVariant \&
}{value
}}
422 Overrride this so that the renderer can get the value
423 from the editor control (pointed to by
{\it editor
}):
428 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
429 long l = sc->GetValue();
436 \membersection{wxDataViewCustomRenderer::Activate
}\label{wxdataviewcustomrendereractivate
}
438 \func{virtual bool
}{Activate
}{\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
440 Override this to react to double clicks or <ENTER>.
442 \membersection{wxDataViewCustomRenderer::GetDC
}\label{wxdataviewcustomrenderergetdc
}
444 \func{virtual wxDC*
}{GetDC
}{\void}
446 Create DC on request. Internal.
449 \membersection{wxDataViewCustomRenderer::GetSize
}\label{wxdataviewcustomrenderergetsize
}
451 \func{virtual wxSize
}{GetSize
}{\void}
453 Return size required to show content.
456 \membersection{wxDataViewCustomRenderer::LeftClick
}\label{wxdataviewcustomrendererleftclick
}
458 \func{virtual bool
}{LeftClick
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
460 Overrride this to react to a left click.
462 \membersection{wxDataViewCustomRenderer::Render
}\label{wxdataviewcustomrendererrender
}
464 \func{virtual bool
}{Render
}{\param{wxRect
}{cell
},
\param{wxDC*
}{dc
},
\param{int
}{state
}}
466 Override this to render the cell. Before this is called,
467 \helpref{SetValue
}{wxdataviewrenderersetvalue
} was called
468 so that this instance knows what to render.
470 \membersection{wxDataViewCustomRenderer::RightClick
}\label{wxdataviewcustomrendererrightclick
}
472 \func{virtual bool
}{RightClick
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
474 Overrride this to react to a right click.
476 \membersection{wxDataViewCustomRenderer::StartDrag
}\label{wxdataviewcustomrendererstartdrag
}
478 \func{virtual bool
}{StartDrag
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
480 Overrride this to start a drag operation.