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
}{wxdataviewicontextrenderer
},
11 \helpref{wxDataViewToggleRenderer
}{wxdataviewtogglerenderer
},
12 \helpref{wxDataViewProgressRenderer
}{wxdataviewprogressrenderer
},
13 \helpref{wxDataViewBitmapRenderer
}{wxdataviewbitmaprenderer
},
14 \helpref{wxDataViewDateRenderer
}{wxdataviewdaterenderer
}.
15 \helpref{wxDataViewSpinRenderer
}{wxdataviewspinrenderer
}.
17 Additionally, the user can write own renderers by deriving from
18 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}.
20 The
{\it wxDataViewCellMode
} flag controls, what actions
21 the cell data allows.
{\it wxDATAVIEW
\_CELL\_ACTIVATABLE}
22 indicates that the user can double click the cell and
23 something will happen (e.g. a window for editing a date
24 will pop up).
{\it wxDATAVIEW
\_CELL\_EDITABLE} indicates
25 that the user can edit the data in-place, i.e. an control
26 will show up after a slow click on the cell. This behaviour
27 is best known from changing the filename in most file
34 enum wxDataViewCellMode
36 wxDATAVIEW_CELL_INERT,
37 wxDATAVIEW_CELL_ACTIVATABLE,
38 wxDATAVIEW_CELL_EDITABLE
43 The
{\it wxDataViewCellRenderState
} flag controls how the
44 the renderer should display its contents in a cell:
48 enum wxDataViewCellRenderState
50 wxDATAVIEW_CELL_SELECTED =
1,
51 wxDATAVIEW_CELL_PRELIT =
2,
52 wxDATAVIEW_CELL_INSENSITIVE =
4,
53 wxDATAVIEW_CELL_FOCUSED =
8
59 \wxheading{Derived from
}
61 \helpref{wxObject
}{wxobject
}
63 \wxheading{Include files
}
69 \helpref{wxAdv
}{librarieslist
}
73 \latexignore{\rtfignore{\wxheading{Members
}}}
75 \membersection{wxDataViewRenderer::wxDataViewRenderer
}\label{wxdataviewrendererwxdataviewrenderer
}
77 \func{}{wxDataViewRenderer
}{\param{const wxString\&
}{varianttype
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{alignment = wxALIGN
\_LEFT|wxALIGN
\_CENTRE\_VERTICAL}}
81 \membersection{wxDataViewRenderer::GetMode
}\label{wxdataviewrenderergetmode
}
83 \func{virtual wxDataViewCellMode
}{GetMode
}{\void}
85 Returns the cell mode.
87 \membersection{wxDataViewRenderer::GetOwner
}\label{wxdataviewrenderergetowner
}
89 \func{virtual wxDataViewColumn*
}{GetOwner
}{\void}
91 Returns pointer to the owning
\helpref{wxDataViewColumn
}{wxdataviewcolumn
}.
93 \membersection{wxDataViewRenderer::GetValue
}\label{wxdataviewrenderergetvalue
}
95 \func{virtual bool
}{GetValue
}{\param{wxVariant\&
}{value
}}
97 This methods retrieves the value from the renderer in order to
98 transfer the value back to the data model. Returns
{\it false
}
101 \membersection{wxDataViewRenderer::GetVariantType
}\label{wxdataviewrenderergetvarianttype
}
103 \func{virtual wxString
}{GetVariantType
}{\void}
105 Returns a string with the type of the
\helpref{wxVariant
}{wxvariant
}
106 supported by this renderer.
108 \membersection{wxDataViewRenderer::SetOwner
}\label{wxdataviewrenderersetowner
}
110 \func{virtual void
}{SetOwner
}{\param{wxDataViewColumn*
}{owner
}}
112 Sets the owning
\helpref{wxDataViewColumn
}{wxdataviewcolumn
}. This
113 is usually called from within wxDataViewColumn.
115 \membersection{wxDataViewRenderer::SetValue
}\label{wxdataviewrenderersetvalue
}
117 \func{virtual bool
}{SetValue
}{\param{const wxVariant\&
}{value
}}
119 Set the value of the renderer (and thus its cell) to
{\it value
}.
120 The internal code will then render this cell with this data.
123 \membersection{wxDataViewRenderer::Validate
}\label{wxdataviewrenderervalidate
}
125 \func{virtual bool
}{Validate
}{\param{wxVariant\&
}{value
}}
127 Before data is committed to the data model, it is passed to this
128 method where it can be checked for validity. This can also be
129 used for checking a valid range or limiting the user input in
130 a certain aspect (e.g. max number of characters or only alphanumeric
131 input, ASCII only etc.). Return
{\it false
} if the value is
134 Please note that due to implementation limitations, this validation
135 is done after the editing control already is destroyed and the
136 editing process finished.
139 \section{\class{wxDataViewTextRenderer
}}\label{wxdataviewtextrenderer
}
141 wxDataViewTextRenderer is used for rendering text. It supports
142 in-place editing if desired.
145 \wxheading{Derived from
}
147 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
148 \helpref{wxObject
}{wxobject
}
150 \wxheading{Include files
}
156 \helpref{wxAdv
}{librarieslist
}
159 \latexignore{\rtfignore{\wxheading{Members
}}}
161 \membersection{wxDataViewTextRenderer::wxDataViewTextRenderer
}\label{wxdataviewtextrendererwxdataviewtextrenderer
}
163 \func{}{wxDataViewTextRenderer
}{\param{const wxString\&
}{varianttype = wxT("string")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
167 \section{\class{wxDataViewProgressRenderer
}}\label{wxdataviewprogressrenderer
}
169 wxDataViewProgressRenderer
172 \wxheading{Derived from
}
174 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
175 \helpref{wxObject
}{wxobject
}
177 \wxheading{Include files
}
183 \helpref{wxAdv
}{librarieslist
}
186 \latexignore{\rtfignore{\wxheading{Members
}}}
188 \membersection{wxDataViewProgressRenderer::wxDataViewProgressRenderer
}\label{wxdataviewprogressrendererwxdataviewprogressrenderer
}
190 \func{}{wxDataViewProgressRenderer
}{\param{const wxString\&
}{label = wxEmptyString
},
\param{const wxString\&
}{varianttype = wxT("long")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
193 \section{\class{wxDataViewIconText
}}\label{wxdataviewicontext
}
195 wxDataViewIconText is used by
196 \helpref{wxDataViewIconTextRenderer
}{wxdataviewicontextrenderer
}
197 for data transfer. This class can be converted to a from
198 a
\helpref{wxVariant
}{wxvariant
}.
200 \wxheading{Derived from
}
202 \helpref{wxObject
}{wxobject
}
204 \wxheading{Include files
}
208 \membersection{wxDataViewIconText::wxDataViewIconText
}\label{wxdataviewicontextwxdataviewicontext
}
210 \func{}{wxDataViewIconText
}{\param{const wxString\&
}{text = wxEmptyString
},
\param{const wxIcon\&
}{icon = wxNullIcon
}}
212 \func{}{wxDataViewIconText
}{\param{const wxDataViewIconText\&
}{other
}}
216 \membersection{wxDataViewIconText::GetIcon
}\label{wxdataviewicontextgeticon
}
218 \constfunc{const wxIcon\&
}{GetIcon
}{\void}
222 \membersection{wxDataViewIconText::GetText
}\label{wxdataviewicontextgettext
}
224 \constfunc{wxString
}{GetText
}{\void}
228 \membersection{wxDataViewIconText::SetIcon
}\label{wxdataviewicontextseticon
}
230 \func{void
}{SetIcon
}{\param{const wxIcon\&
}{icon
}}
234 \membersection{wxDataViewIconText::SetText
}\label{wxdataviewicontextsettext
}
236 \func{void
}{SetText
}{\param{const wxString\&
}{text
}}
240 \section{\class{wxDataViewIconTextRenderer
}}\label{wxdataviewicontextrenderer
}
242 The wxDataViewIconTextRenderer class is used to display text with
243 a small icon next to it as it is typically done in a file manager.
244 This classes uses the
\helpref{wxDataViewIconText
}{wxdataviewicontext
}
245 helper class to store its data. wxDataViewIonText can be converted
246 to a from a
\helpref{wxVariant
}{wxvariant
} using the left shift
249 \wxheading{Derived from
}
251 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
252 \helpref{wxObject
}{wxobject
}
254 \wxheading{Include files
}
260 \helpref{wxAdv
}{librarieslist
}
263 \latexignore{\rtfignore{\wxheading{Members
}}}
265 \membersection{wxDataViewIconTextRenderer::wxDataViewIconTextRenderer
}\label{wxdataviewtogglerendererwxdataviewicontextrenderer
}
267 \func{}{wxDataViewIconTextRenderer
}{\param{const wxString\&
}{varianttype = wxT("wxDataViewIconText")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
270 \section{\class{wxDataViewToggleRenderer
}}\label{wxdataviewtogglerenderer
}
272 wxDataViewToggleRenderer
274 \wxheading{Derived from
}
276 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
277 \helpref{wxObject
}{wxobject
}
279 \wxheading{Include files
}
285 \helpref{wxAdv
}{librarieslist
}
288 \latexignore{\rtfignore{\wxheading{Members
}}}
290 \membersection{wxDataViewToggleRenderer::wxDataViewToggleRenderer
}\label{wxdataviewtogglerendererwxdataviewtogglerenderer
}
292 \func{}{wxDataViewToggleRenderer
}{\param{const wxString\&
}{varianttype = wxT("bool")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
295 \section{\class{wxDataViewBitmapRenderer
}}\label{wxdataviewbitmaprenderer
}
297 wxDataViewBitmapRenderer
299 \wxheading{Derived from
}
301 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
302 \helpref{wxObject
}{wxobject
}
304 \wxheading{Include files
}
310 \helpref{wxAdv
}{librarieslist
}
313 \latexignore{\rtfignore{\wxheading{Members
}}}
315 \membersection{wxDataViewBitmapRenderer::wxDataViewBitmapRenderer
}\label{wxdataviewbitmaprendererwxdataviewbitmaprenderer
}
317 \func{}{wxDataViewBitmapRenderer
}{\param{const wxString\&
}{varianttype = wxT("wxBitmap")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
320 \section{\class{wxDataViewDateRenderer
}}\label{wxdataviewdaterenderer
}
322 wxDataViewDateRenderer
325 \wxheading{Derived from
}
327 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
328 \helpref{wxObject
}{wxobject
}
330 \wxheading{Include files
}
336 \helpref{wxAdv
}{librarieslist
}
339 \latexignore{\rtfignore{\wxheading{Members
}}}
341 \membersection{wxDataViewDateRenderer::wxDataViewDateRenderer
}\label{wxdataviewdaterendererwxdataviewdaterenderer
}
343 \func{}{wxDataViewDateRenderer
}{\param{const wxString\&
}{varianttype = wxT("datetime")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE}}
346 \section{\class{wxDataViewCustomRenderer
}}\label{wxdataviewcustomrenderer
}
348 You need to derive a new class from wxDataViewCustomRenderer in
349 order to write a new renderer. You need to override at least
350 \helpref{SetValue
}{wxdataviewrenderersetvalue
},
351 \helpref{GetValue
}{wxdataviewrenderergetvalue
},
352 \helpref{GetSize
}{wxdataviewcustomrenderergetsize
}
353 and
\helpref{Render
}{wxdataviewcustomrendererrender
}.
355 If you want your renderer to support in-place editing then you
356 also need to override
357 \helpref{HasEditorCtrl
}{wxdataviewcustomrendererhaseditorctrl
},
358 \helpref{CreateEditorCtrl
}{wxdataviewcustomrenderercreateeditorctrl
}
359 and
\helpref{GetValueFromEditorCtrl
}{wxdataviewcustomrenderergetvaluefromeditorctrl
}.
360 Note that a special event handler will be pushed onto that
361 editor control which handles <ENTER> and focus out events
362 in order to end the editing.
364 \wxheading{Derived from
}
366 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
367 \helpref{wxObject
}{wxobject
}
369 \wxheading{Include files
}
375 \helpref{wxAdv
}{librarieslist
}
378 \latexignore{\rtfignore{\wxheading{Members
}}}
380 \membersection{wxDataViewCustomRenderer::wxDataViewCustomRenderer
}\label{wxdataviewcustomrendererwxdataviewcustomrenderer
}
382 \func{}{wxDataViewCustomRenderer
}{\param{const wxString\&
}{varianttype = wxT("string")
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{bool
}{no
\_init = false
}}
386 \membersection{wxDataViewCustomRenderer::
\destruct{wxDataViewCustomRenderer
}}\label{wxdataviewcustomrendererdtor
}
388 \func{}{\destruct{wxDataViewCustomRenderer
}}{\void}
393 \membersection{wxDataViewCustomRenderer::HasEditorCtrl
}\label{wxdataviewcustomrendererhaseditorctrl
}
395 \func{virtual bool
}{HasEditorCtrl
}{\void}
397 Override this and make it return
{\it true
} in order to
398 indicate that this renderer supports in-place editing.
400 \membersection{wxDataViewCustomRenderer::CreateEditorCtrl
}\label{wxdataviewcustomrenderercreateeditorctrl
}
402 \func{virtual wxControl*
}{CreateEditorCtrl
}{\param{wxWindow *
}{parent
},
\param{wxRect
}{labelRect
},
\param{const wxVariant \&
}{value
}}
404 Override this to create the actual editor control once editing
405 is about to start.
{\it parent
} is the parent of the editor
406 control,
{\it labelRect
} indicates the position and
407 size of the editor control and
{\it value
} is its initial value:
413 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
414 labelRect.GetTopLeft(), labelRect.GetSize(),
0,
0,
100, l );
419 \membersection{wxDataViewCustomRenderer::GetValueFromEditorCtrl
}\label{wxdataviewcustomrenderergetvaluefromeditorctrl
}
421 \func{virtual bool
}{GetValueFromEditorCtrl
}{\param{wxControl*
}{editor
},
\param{wxVariant \&
}{value
}}
423 Overrride this so that the renderer can get the value
424 from the editor control (pointed to by
{\it editor
}):
429 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
430 long l = sc->GetValue();
437 \membersection{wxDataViewCustomRenderer::Activate
}\label{wxdataviewcustomrendereractivate
}
439 \func{virtual bool
}{Activate
}{\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
441 Override this to react to double clicks or <ENTER>.
443 \membersection{wxDataViewCustomRenderer::GetDC
}\label{wxdataviewcustomrenderergetdc
}
445 \func{virtual wxDC*
}{GetDC
}{\void}
447 Create DC on request. Internal.
450 \membersection{wxDataViewCustomRenderer::GetSize
}\label{wxdataviewcustomrenderergetsize
}
452 \func{virtual wxSize
}{GetSize
}{\void}
454 Return size required to show content.
457 \membersection{wxDataViewCustomRenderer::LeftClick
}\label{wxdataviewcustomrendererleftclick
}
459 \func{virtual bool
}{LeftClick
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
461 Overrride this to react to a left click.
463 \membersection{wxDataViewCustomRenderer::Render
}\label{wxdataviewcustomrendererrender
}
465 \func{virtual bool
}{Render
}{\param{wxRect
}{cell
},
\param{wxDC*
}{dc
},
\param{int
}{state
}}
467 Override this to render the cell. Before this is called,
468 \helpref{SetValue
}{wxdataviewrenderersetvalue
} was called
469 so that this instance knows what to render.
471 \membersection{wxDataViewCustomRenderer::RenderText
}\label{wxdataviewcustomrendererrender
}
473 \func{bool
}{RenderText
}{\param{const wxString\&
}{text
},
\param{int
}{xoffset
},
\param{wxRect
}{cell
},
\param{wxDC*
}{dc
},
\param{int
}{state
}}
475 This method should be called from within
\helpref{Render
}{wxdataviewcustomrendererrender
}
476 whenever you need to render simple text. This will ensure that the
477 correct colour, font and vertical alignment will be chosen so the
478 text will look the same as text drawn by native renderers.
480 \membersection{wxDataViewCustomRenderer::RightClick
}\label{wxdataviewcustomrendererrightclick
}
482 \func{virtual bool
}{RightClick
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
484 Overrride this to react to a right click.
486 \membersection{wxDataViewCustomRenderer::StartDrag
}\label{wxdataviewcustomrendererstartdrag
}
488 \func{virtual bool
}{StartDrag
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
490 Overrride this to start a drag operation.
493 \section{\class{wxDataViewSpinRenderer
}}\label{wxdataviewspinrenderer
}
495 This is a specialized renderer for rendering integer values. It
496 supports modifying the values in-place by using a wxSpinCtrl.
497 The renderer only support variants of type
{\it long
}.
499 \wxheading{Derived from
}
501 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}
503 \wxheading{Include files
}
507 \wxheading{Data structures
}
509 \latexignore{\rtfignore{\wxheading{Members
}}}
512 \membersection{wxDataViewSpinRenderer::wxDataViewSpinRenderer
}\label{wxdataviewspinrendererwxdataviewspinrenderer
}
514 \func{}{wxDataViewSpinRenderer
}{\param{int
}{min
},
\param{int
}{max
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_EDITABLE},
\param{int
}{alignment = wxDVR
\_DEFAULT\_ALIGNMENT}}
516 Constructor.
{\it min
} and
{\it max
} indicate the minimum und
517 maximum values of for the wxSpinCtrl.