]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/dvrenderer.h
fixing warning and compile error against 10.4
[wxWidgets.git] / include / wx / generic / dvrenderer.h
CommitLineData
6eec70b9
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/dvrenderer.h
3// Purpose: wxDataViewRenderer for generic wxDataViewCtrl implementation
4// Author: Robert Roebling, Vadim Zeitlin
5// Created: 2009-11-07 (extracted from wx/generic/dataview.h)
b1153ed6 6// RCS-ID: $Id$
6eec70b9
VZ
7// Copyright: (c) 2006 Robert Roebling
8// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_DVRENDERER_H_
13#define _WX_GENERIC_DVRENDERER_H_
14
15// ----------------------------------------------------------------------------
16// wxDataViewRenderer
17// ----------------------------------------------------------------------------
18
19class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewCustomRendererBase
20{
21public:
22 wxDataViewRenderer( const wxString &varianttype,
23 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
24 int align = wxDVR_DEFAULT_ALIGNMENT );
25 virtual ~wxDataViewRenderer();
26
6eec70b9
VZ
27 virtual wxDC *GetDC();
28
6eec70b9
VZ
29 virtual void SetAlignment( int align );
30 virtual int GetAlignment() const;
31
32 virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE)
33 { m_ellipsizeMode = mode; }
34 virtual wxEllipsizeMode GetEllipsizeMode() const
35 { return m_ellipsizeMode; }
36
37 virtual void SetMode( wxDataViewCellMode mode )
38 { m_mode = mode; }
39 virtual wxDataViewCellMode GetMode() const
40 { return m_mode; }
41
42 // implementation
6eec70b9
VZ
43
44 // this is a replacement for dynamic_cast<wxDataViewCustomRenderer> in the
45 // code checking whether the renderer is interested in mouse events, it's
46 // overridden in wxDataViewCustomRenderer to return the object itself but
47 // intentionally returns NULL for all the other renderer classes as the
48 // user should _not_ be able to override Activate/LeftClick() when deriving
49 // from them for consistency with the other ports and while we can't
62186006 50 // prevent this from working at compile-time because all renderers are
6eec70b9
VZ
51 // custom renderers in the generic implementation, we at least make sure
52 // that it doesn't work at run-time because Activate/LeftClick() would
53 // never be called
54 virtual wxDataViewCustomRenderer *WXGetAsCustom() { return NULL; }
55
62186006
VZ
56 // The generic implementation of some standard renderers reacts to item
57 // activation, so provide this internal function which is called by
58 // wxDataViewCtrl for them. It is called with the old value of the cell and
59 // is passed the model and cell coordinates to be able to change the model
60 // value for this cell.
61 virtual void WXOnActivate(wxDataViewModel * WXUNUSED(model),
62 const wxVariant& WXUNUSED(valueOld),
63 const wxDataViewItem& WXUNUSED(item),
64 unsigned int WXUNUSED(col))
65 {
66 }
67
6eec70b9
VZ
68private:
69 int m_align;
70 wxDataViewCellMode m_mode;
71
72 wxEllipsizeMode m_ellipsizeMode;
73
74 wxDC *m_dc;
75
76 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
77};
78
79#endif // _WX_GENERIC_DVRENDERER_H_
80