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{wxDataViewTextRendererAttr
}{wxdataviewtextrendererattr
},
11 \helpref{wxDataViewIconTextRenderer
}{wxdataviewicontextrenderer
},
12 \helpref{wxDataViewToggleRenderer
}{wxdataviewtogglerenderer
},
13 \helpref{wxDataViewProgressRenderer
}{wxdataviewprogressrenderer
},
14 \helpref{wxDataViewBitmapRenderer
}{wxdataviewbitmaprenderer
},
15 \helpref{wxDataViewDateRenderer
}{wxdataviewdaterenderer
}.
16 \helpref{wxDataViewSpinRenderer
}{wxdataviewspinrenderer
}.
18 Additionally, the user can write own renderers by deriving from
19 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}.
21 The
{\it wxDataViewCellMode
} flag controls, what actions
22 the cell data allows.
{\it wxDATAVIEW
\_CELL\_ACTIVATABLE}
23 indicates that the user can double click the cell and
24 something will happen (e.g. a window for editing a date
25 will pop up).
{\it wxDATAVIEW
\_CELL\_EDITABLE} indicates
26 that the user can edit the data in-place, i.e. an control
27 will show up after a slow click on the cell. This behaviour
28 is best known from changing the filename in most file
35 enum wxDataViewCellMode
37 wxDATAVIEW_CELL_INERT,
38 wxDATAVIEW_CELL_ACTIVATABLE,
39 wxDATAVIEW_CELL_EDITABLE
44 The
{\it wxDataViewCellRenderState
} flag controls how the
45 the renderer should display its contents in a cell:
49 enum wxDataViewCellRenderState
51 wxDATAVIEW_CELL_SELECTED =
1,
52 wxDATAVIEW_CELL_PRELIT =
2,
53 wxDATAVIEW_CELL_INSENSITIVE =
4,
54 wxDATAVIEW_CELL_FOCUSED =
8
60 \wxheading{Derived from
}
62 \helpref{wxObject
}{wxobject
}
64 \wxheading{Include files
}
70 \helpref{wxAdv
}{librarieslist
}
74 \latexignore{\rtfignore{\wxheading{Members
}}}
76 \membersection{wxDataViewRenderer::wxDataViewRenderer
}\label{wxdataviewrendererwxdataviewrenderer
}
78 \func{}{wxDataViewRenderer
}{\param{const wxString\&
}{varianttype
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{alignment = wxALIGN
\_LEFT|wxALIGN
\_CENTRE\_VERTICAL}}
82 \membersection{wxDataViewRenderer::GetMode
}\label{wxdataviewrenderergetmode
}
84 \func{virtual wxDataViewCellMode
}{GetMode
}{\void}
86 Returns the cell mode.
88 \membersection{wxDataViewRenderer::GetOwner
}\label{wxdataviewrenderergetowner
}
90 \func{virtual wxDataViewColumn*
}{GetOwner
}{\void}
92 Returns pointer to the owning
\helpref{wxDataViewColumn
}{wxdataviewcolumn
}.
94 \membersection{wxDataViewRenderer::GetValue
}\label{wxdataviewrenderergetvalue
}
96 \func{virtual bool
}{GetValue
}{\param{wxVariant\&
}{value
}}
98 This methods retrieves the value from the renderer in order to
99 transfer the value back to the data model. Returns
{\it false
}
102 \membersection{wxDataViewRenderer::GetVariantType
}\label{wxdataviewrenderergetvarianttype
}
104 \func{virtual wxString
}{GetVariantType
}{\void}
106 Returns a string with the type of the
\helpref{wxVariant
}{wxvariant
}
107 supported by this renderer.
109 \membersection{wxDataViewRenderer::SetOwner
}\label{wxdataviewrenderersetowner
}
111 \func{virtual void
}{SetOwner
}{\param{wxDataViewColumn*
}{owner
}}
113 Sets the owning
\helpref{wxDataViewColumn
}{wxdataviewcolumn
}. This
114 is usually called from within wxDataViewColumn.
116 \membersection{wxDataViewRenderer::SetValue
}\label{wxdataviewrenderersetvalue
}
118 \func{virtual bool
}{SetValue
}{\param{const wxVariant\&
}{value
}}
120 Set the value of the renderer (and thus its cell) to
{\it value
}.
121 The internal code will then render this cell with this data.
124 \membersection{wxDataViewRenderer::Validate
}\label{wxdataviewrenderervalidate
}
126 \func{virtual bool
}{Validate
}{\param{wxVariant\&
}{value
}}
128 Before data is committed to the data model, it is passed to this
129 method where it can be checked for validity. This can also be
130 used for checking a valid range or limiting the user input in
131 a certain aspect (e.g. max number of characters or only alphanumeric
132 input, ASCII only etc.). Return
{\it false
} if the value is
135 Please note that due to implementation limitations, this validation
136 is done after the editing control already is destroyed and the
137 editing process finished.
140 \section{\class{wxDataViewTextRenderer
}}\label{wxdataviewtextrenderer
}
142 wxDataViewTextRenderer is used for rendering text. It supports
143 in-place editing if desired.
146 \wxheading{Derived from
}
148 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
149 \helpref{wxObject
}{wxobject
}
151 \wxheading{Include files
}
157 \helpref{wxAdv
}{librarieslist
}
160 \latexignore{\rtfignore{\wxheading{Members
}}}
162 \membersection{wxDataViewTextRenderer::wxDataViewTextRenderer
}\label{wxdataviewtextrendererwxdataviewtextrenderer
}
164 \func{}{wxDataViewTextRenderer
}{\param{const wxString\&
}{varianttype = "string"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
167 \section{\class{wxDataViewTextRendererAttr
}}\label{wxdataviewtextrendererattr
}
169 The same as
\helpref{wxDataViewTextRenderer
}{wxdataviewtextrenderer
} but with
170 support for font attributes. Font attributes are currently only supported
173 See also
\helpref{wxDataViewModel::GetAttr
}{wxdataviewmodelgetattr
} and
174 \helpref{wxDataViewItemAttr
}{wxdataviewitemattr
}.
176 \wxheading{Derived from
}
178 \helpref{wxDataViewTextRenderer
}{wxdataviewtextrenderer
}
180 \wxheading{Include files
}
186 \helpref{wxAdv
}{librarieslist
}
188 \wxheading{Data structures
}
190 \latexignore{\rtfignore{\wxheading{Members
}}}
193 \membersection{wxDataViewTextRendererAttr::wxDataViewTextRendererAttr
}\label{wxdataviewtextrendererattrwxdataviewtextrendererattr
}
195 \func{}{wxDataViewTextRendererAttr
}{\param{const wxString\&
}{varianttype = "string"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{int
}{align = wxDVR
\_DEFAULT\_ALIGNMENT}}
198 \section{\class{wxDataViewProgressRenderer
}}\label{wxdataviewprogressrenderer
}
200 wxDataViewProgressRenderer
203 \wxheading{Derived from
}
205 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
206 \helpref{wxObject
}{wxobject
}
208 \wxheading{Include files
}
214 \helpref{wxAdv
}{librarieslist
}
217 \latexignore{\rtfignore{\wxheading{Members
}}}
219 \membersection{wxDataViewProgressRenderer::wxDataViewProgressRenderer
}\label{wxdataviewprogressrendererwxdataviewprogressrenderer
}
221 \func{}{wxDataViewProgressRenderer
}{\param{const wxString\&
}{label = wxEmptyString
},
\param{const wxString\&
}{varianttype = long"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
224 \section{\class{wxDataViewIconText
}}\label{wxdataviewicontext
}
226 wxDataViewIconText is used by
227 \helpref{wxDataViewIconTextRenderer
}{wxdataviewicontextrenderer
}
228 for data transfer. This class can be converted to a from
229 a
\helpref{wxVariant
}{wxvariant
}.
231 \wxheading{Derived from
}
233 \helpref{wxObject
}{wxobject
}
235 \wxheading{Include files
}
239 \membersection{wxDataViewIconText::wxDataViewIconText
}\label{wxdataviewicontextwxdataviewicontext
}
241 \func{}{wxDataViewIconText
}{\param{const wxString\&
}{text = wxEmptyString
},
\param{const wxIcon\&
}{icon = wxNullIcon
}}
243 \func{}{wxDataViewIconText
}{\param{const wxDataViewIconText\&
}{other
}}
247 \membersection{wxDataViewIconText::GetIcon
}\label{wxdataviewicontextgeticon
}
249 \constfunc{const wxIcon\&
}{GetIcon
}{\void}
253 \membersection{wxDataViewIconText::GetText
}\label{wxdataviewicontextgettext
}
255 \constfunc{wxString
}{GetText
}{\void}
259 \membersection{wxDataViewIconText::SetIcon
}\label{wxdataviewicontextseticon
}
261 \func{void
}{SetIcon
}{\param{const wxIcon\&
}{icon
}}
265 \membersection{wxDataViewIconText::SetText
}\label{wxdataviewicontextsettext
}
267 \func{void
}{SetText
}{\param{const wxString\&
}{text
}}
271 \section{\class{wxDataViewIconTextRenderer
}}\label{wxdataviewicontextrenderer
}
273 The wxDataViewIconTextRenderer class is used to display text with
274 a small icon next to it as it is typically done in a file manager.
275 This classes uses the
\helpref{wxDataViewIconText
}{wxdataviewicontext
}
276 helper class to store its data. wxDataViewIonText can be converted
277 to a from a
\helpref{wxVariant
}{wxvariant
} using the left shift
280 \wxheading{Derived from
}
282 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
283 \helpref{wxObject
}{wxobject
}
285 \wxheading{Include files
}
291 \helpref{wxAdv
}{librarieslist
}
294 \latexignore{\rtfignore{\wxheading{Members
}}}
296 \membersection{wxDataViewIconTextRenderer::wxDataViewIconTextRenderer
}\label{wxdataviewtogglerendererwxdataviewicontextrenderer
}
298 \func{}{wxDataViewIconTextRenderer
}{\param{const wxString\&
}{varianttype = "wxDataViewIconText"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
301 \section{\class{wxDataViewToggleRenderer
}}\label{wxdataviewtogglerenderer
}
303 wxDataViewToggleRenderer
305 \wxheading{Derived from
}
307 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
308 \helpref{wxObject
}{wxobject
}
310 \wxheading{Include files
}
316 \helpref{wxAdv
}{librarieslist
}
319 \latexignore{\rtfignore{\wxheading{Members
}}}
321 \membersection{wxDataViewToggleRenderer::wxDataViewToggleRenderer
}\label{wxdataviewtogglerendererwxdataviewtogglerenderer
}
323 \func{}{wxDataViewToggleRenderer
}{\param{const wxString\&
}{varianttype = "bool"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
326 \section{\class{wxDataViewBitmapRenderer
}}\label{wxdataviewbitmaprenderer
}
328 wxDataViewBitmapRenderer
330 \wxheading{Derived from
}
332 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
333 \helpref{wxObject
}{wxobject
}
335 \wxheading{Include files
}
341 \helpref{wxAdv
}{librarieslist
}
344 \latexignore{\rtfignore{\wxheading{Members
}}}
346 \membersection{wxDataViewBitmapRenderer::wxDataViewBitmapRenderer
}\label{wxdataviewbitmaprendererwxdataviewbitmaprenderer
}
348 \func{}{wxDataViewBitmapRenderer
}{\param{const wxString\&
}{varianttype = "wxBitmap"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT}}
351 \section{\class{wxDataViewDateRenderer
}}\label{wxdataviewdaterenderer
}
353 wxDataViewDateRenderer
356 \wxheading{Derived from
}
358 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
359 \helpref{wxObject
}{wxobject
}
361 \wxheading{Include files
}
367 \helpref{wxAdv
}{librarieslist
}
370 \latexignore{\rtfignore{\wxheading{Members
}}}
372 \membersection{wxDataViewDateRenderer::wxDataViewDateRenderer
}\label{wxdataviewdaterendererwxdataviewdaterenderer
}
374 \func{}{wxDataViewDateRenderer
}{\param{const wxString\&
}{varianttype = "datetime"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_ACTIVATABLE}}
377 \section{\class{wxDataViewCustomRenderer
}}\label{wxdataviewcustomrenderer
}
379 You need to derive a new class from wxDataViewCustomRenderer in
380 order to write a new renderer. You need to override at least
381 \helpref{SetValue
}{wxdataviewrenderersetvalue
},
382 \helpref{GetValue
}{wxdataviewrenderergetvalue
},
383 \helpref{GetSize
}{wxdataviewcustomrenderergetsize
}
384 and
\helpref{Render
}{wxdataviewcustomrendererrender
}.
386 If you want your renderer to support in-place editing then you
387 also need to override
388 \helpref{HasEditorCtrl
}{wxdataviewcustomrendererhaseditorctrl
},
389 \helpref{CreateEditorCtrl
}{wxdataviewcustomrenderercreateeditorctrl
}
390 and
\helpref{GetValueFromEditorCtrl
}{wxdataviewcustomrenderergetvaluefromeditorctrl
}.
391 Note that a special event handler will be pushed onto that
392 editor control which handles <ENTER> and focus out events
393 in order to end the editing.
395 \wxheading{Derived from
}
397 \helpref{wxDataViewRenderer
}{wxdataviewrenderer
}\\
398 \helpref{wxObject
}{wxobject
}
400 \wxheading{Include files
}
406 \helpref{wxAdv
}{librarieslist
}
409 \latexignore{\rtfignore{\wxheading{Members
}}}
411 \membersection{wxDataViewCustomRenderer::wxDataViewCustomRenderer
}\label{wxdataviewcustomrendererwxdataviewcustomrenderer
}
413 \func{}{wxDataViewCustomRenderer
}{\param{const wxString\&
}{varianttype = "string"
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_INERT},
\param{bool
}{no
\_init = false
}}
417 \membersection{wxDataViewCustomRenderer::
\destruct{wxDataViewCustomRenderer
}}\label{wxdataviewcustomrendererdtor
}
419 \func{}{\destruct{wxDataViewCustomRenderer
}}{\void}
424 \membersection{wxDataViewCustomRenderer::HasEditorCtrl
}\label{wxdataviewcustomrendererhaseditorctrl
}
426 \func{virtual bool
}{HasEditorCtrl
}{\void}
428 Override this and make it return
{\it true
} in order to
429 indicate that this renderer supports in-place editing.
431 \membersection{wxDataViewCustomRenderer::CreateEditorCtrl
}\label{wxdataviewcustomrenderercreateeditorctrl
}
433 \func{virtual wxControl*
}{CreateEditorCtrl
}{\param{wxWindow *
}{parent
},
\param{wxRect
}{labelRect
},
\param{const wxVariant \&
}{value
}}
435 Override this to create the actual editor control once editing
436 is about to start.
{\it parent
} is the parent of the editor
437 control,
{\it labelRect
} indicates the position and
438 size of the editor control and
{\it value
} is its initial value:
444 return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString,
445 labelRect.GetTopLeft(), labelRect.GetSize(),
0,
0,
100, l );
450 \membersection{wxDataViewCustomRenderer::GetValueFromEditorCtrl
}\label{wxdataviewcustomrenderergetvaluefromeditorctrl
}
452 \func{virtual bool
}{GetValueFromEditorCtrl
}{\param{wxControl*
}{editor
},
\param{wxVariant \&
}{value
}}
454 Overrride this so that the renderer can get the value
455 from the editor control (pointed to by
{\it editor
}):
460 wxSpinCtrl *sc = (wxSpinCtrl*) editor;
461 long l = sc->GetValue();
468 \membersection{wxDataViewCustomRenderer::Activate
}\label{wxdataviewcustomrendereractivate
}
470 \func{virtual bool
}{Activate
}{\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
472 Override this to react to double clicks or <ENTER>.
474 \membersection{wxDataViewCustomRenderer::GetDC
}\label{wxdataviewcustomrenderergetdc
}
476 \func{virtual wxDC*
}{GetDC
}{\void}
478 Create DC on request. Internal.
481 \membersection{wxDataViewCustomRenderer::GetSize
}\label{wxdataviewcustomrenderergetsize
}
483 \func{virtual wxSize
}{GetSize
}{\void}
485 Return size required to show content.
488 \membersection{wxDataViewCustomRenderer::LeftClick
}\label{wxdataviewcustomrendererleftclick
}
490 \func{virtual bool
}{LeftClick
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
492 Overrride this to react to a left click.
494 \membersection{wxDataViewCustomRenderer::Render
}\label{wxdataviewcustomrendererrender
}
496 \func{virtual bool
}{Render
}{\param{wxRect
}{cell
},
\param{wxDC*
}{dc
},
\param{int
}{state
}}
498 Override this to render the cell. Before this is called,
499 \helpref{SetValue
}{wxdataviewrenderersetvalue
} was called
500 so that this instance knows what to render.
502 \membersection{wxDataViewCustomRenderer::RenderText
}\label{wxdataviewcustomrendererrender
}
504 \func{bool
}{RenderText
}{\param{const wxString\&
}{text
},
\param{int
}{xoffset
},
\param{wxRect
}{cell
},
\param{wxDC*
}{dc
},
\param{int
}{state
}}
506 This method should be called from within
\helpref{Render
}{wxdataviewcustomrendererrender
}
507 whenever you need to render simple text. This will ensure that the
508 correct colour, font and vertical alignment will be chosen so the
509 text will look the same as text drawn by native renderers.
511 \membersection{wxDataViewCustomRenderer::RightClick
}\label{wxdataviewcustomrendererrightclick
}
513 \func{virtual bool
}{RightClick
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
515 Overrride this to react to a right click.
517 \membersection{wxDataViewCustomRenderer::StartDrag
}\label{wxdataviewcustomrendererstartdrag
}
519 \func{virtual bool
}{StartDrag
}{\param{wxPoint
}{cursor
},
\param{wxRect
}{cell
},
\param{wxDataViewModel*
}{model
},
\param{unsigned int
}{col
},
\param{unsigned int
}{row
}}
521 Overrride this to start a drag operation.
524 \section{\class{wxDataViewSpinRenderer
}}\label{wxdataviewspinrenderer
}
526 This is a specialized renderer for rendering integer values. It
527 supports modifying the values in-place by using a wxSpinCtrl.
528 The renderer only support variants of type
{\it long
}.
530 \wxheading{Derived from
}
532 \helpref{wxDataViewCustomRenderer
}{wxdataviewcustomrenderer
}
534 \wxheading{Include files
}
538 \wxheading{Data structures
}
540 \latexignore{\rtfignore{\wxheading{Members
}}}
543 \membersection{wxDataViewSpinRenderer::wxDataViewSpinRenderer
}\label{wxdataviewspinrendererwxdataviewspinrenderer
}
545 \func{}{wxDataViewSpinRenderer
}{\param{int
}{min
},
\param{int
}{max
},
\param{wxDataViewCellMode
}{mode = wxDATAVIEW
\_CELL\_EDITABLE},
\param{int
}{alignment = wxDVR
\_DEFAULT\_ALIGNMENT}}
547 Constructor.
{\it min
} and
{\it max
} indicate the minimum und
548 maximum values of for the wxSpinCtrl.