Public Member Functions

# wxDataViewRenderer Class Reference
[wxDataViewCtrl Related Classes]

`#include <wx/dataview.h>`

Inheritance diagram for wxDataViewRenderer:
[legend]

## Detailed Description

This class is used by wxDataViewCtrl to render the individual cells.

One instance of a renderer class is owned by a wxDataViewColumn. There is a number of ready-to-use renderers provided:

- wxDataViewTextRenderer,
- wxDataViewIconTextRenderer,
- wxDataViewToggleRenderer,
- wxDataViewProgressRenderer,
- wxDataViewBitmapRenderer,
- wxDataViewDateRenderer,
- wxDataViewSpinRenderer.
- wxDataViewChoiceRenderer.

Additionally, the user can write own renderers by deriving from wxDataViewCustomRenderer.

The wxDataViewCellMode and wxDataViewCellRenderState flags accepted by the constructors respectively controls what actions the cell data allows and how the renderer should display its contents in a cell.

##

Library: wxAdvanced
Category: wxDataViewCtrl Related Classes

## Public Member Functions
| wxDataViewRenderer (const wxString &varianttype, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT)
| Constructor.
void | EnableEllipsize (wxEllipsizeMode mode=wxELLIPSIZE_MIDDLE)
| Enable or disable replacing parts of the item text with ellipsis to make it fit the column width.
void | DisableEllipsize ()
| Disable replacing parts of the item text with ellipsis.
virtual int | GetAlignment () const
| Returns the alignment.
wxEllipsizeMode | GetEllipsizeMode () const
| Returns the ellipsize mode used by the renderer.
virtual wxDataViewCellMode | GetMode () const
| Returns the cell mode.
wxDataViewColumn * | GetOwner () const
| Returns pointer to the owning wxDataViewColumn.
virtual bool | GetValue (wxVariant &value) const =0
| This methods retrieves the value from the renderer in order to transfer the value back to the data model.
wxString | GetVariantType () const
| Returns a string with the type of the wxVariant supported by this renderer.
virtual void | SetAlignment (int align)
| Sets the alignment of the renderer's content.
void | SetOwner (wxDataViewColumn *owner)
| Sets the owning wxDataViewColumn.
virtual bool | SetValue (const wxVariant &value)=0
| Set the value of the renderer (and thus its cell) to value.
virtual bool | Validate (wxVariant &value)
| Before data is committed to the data model, it is passed to this method where it can be checked for validity.

List of all members.

## Constructor & Destructor Documentation

wxDataViewRenderer::wxDataViewRenderer | ( | const wxString & | varianttype,
|  | wxDataViewCellMode | mode = `wxDATAVIEW_CELL_INERT`,
|  | int | align = `wxDVR_DEFAULT_ALIGNMENT` |
| ) |  |  |

Constructor.

## Member Function Documentation

void wxDataViewRenderer::DisableEllipsize | ( |  | ) |

Disable replacing parts of the item text with ellipsis.

If ellipsizing is disabled, the string will be truncated if it doesn't fit.

This is the same as

     EnableEllipsize(wxELLIPSIZE_NONE)

.

Since:
  2.9.1

void wxDataViewRenderer::EnableEllipsize | ( | wxEllipsizeMode | mode = `wxELLIPSIZE_MIDDLE` | ) |

Enable or disable replacing parts of the item text with ellipsis to make it fit the column width.

This method only makes sense for the renderers working with text, such as wxDataViewTextRenderer or wxDataViewIconTextRenderer.

By default wxELLIPSIZE_MIDDLE is used.

Parameters:

  | mode | Ellipsization mode, use wxELLIPSIZE_NONE to disable.

Since:
  2.9.1

virtual int wxDataViewRenderer::GetAlignment | ( |  | ) | const`[virtual]`

Returns the alignment.

See SetAlignment()

wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode | ( |  | ) | const

Returns the ellipsize mode used by the renderer.

If the return value is wxELLIPSIZE_NONE, the text is simply truncated if it doesn't fit.

See also:
  EnableEllipsize()

virtual wxDataViewCellMode wxDataViewRenderer::GetMode | ( |  | ) | const`[virtual]`

Returns the cell mode.

wxDataViewColumn* wxDataViewRenderer::GetOwner | ( |  | ) | const

Returns pointer to the owning wxDataViewColumn.

virtual bool wxDataViewRenderer::GetValue | ( | wxVariant & | value | ) | const`[pure virtual]`

This methods retrieves the value from the renderer in order to transfer the value back to the data model.

Returns false on failure.

wxString wxDataViewRenderer::GetVariantType | ( |  | ) | const

Returns a string with the type of the wxVariant supported by this renderer.

virtual void wxDataViewRenderer::SetAlignment | ( | int | align | ) | `[virtual]`

Sets the alignment of the renderer's content.

The default value of `wxDVR_DEFAULT_ALIGMENT` indicates that the content should have the same alignment as the column header.

The method is not implemented under OS X and the renderer always aligns its contents as the column header on that platform. The other platforms support both vertical and horizontal alignment.

void wxDataViewRenderer::SetOwner | ( | wxDataViewColumn * | owner | ) |

Sets the owning wxDataViewColumn.

This is usually called from within wxDataViewColumn.

virtual bool wxDataViewRenderer::SetValue | ( | const wxVariant & | value | ) | `[pure virtual]`

Set the value of the renderer (and thus its cell) to value.

The internal code will then render this cell with this data.

virtual bool wxDataViewRenderer::Validate | ( | wxVariant & | value | ) | `[virtual]`

Before data is committed to the data model, it is passed to this method where it can be checked for validity.

This can also be used for checking a valid range or limiting the user input in a certain aspect (e.g. max number of characters or only alphanumeric input, ASCII only etc.). Return false if the value is not valid.

Please note that due to implementation limitations, this validation is done after the editing control already is destroyed and the editing process finished.

|  | [ top ]