]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/dvrenderer.h
proper default for iphone
[wxWidgets.git] / include / wx / osx / dvrenderer.h
CommitLineData
6eec70b9
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/osx/dvrenderer.h
3// Purpose: wxDataViewRenderer for OS X wxDataViewCtrl implementations
4// Author: Vadim Zeitlin
5// Created: 2009-11-07 (extracted from wx/osx/dataview.h)
6eec70b9
VZ
6// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
7// Licence: wxWindows licence
8///////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_OSX_DVRENDERER_H_
11#define _WX_OSX_DVRENDERER_H_
12
13class wxDataViewRendererNativeData;
14
15// ----------------------------------------------------------------------------
16// wxDataViewRenderer
17// ----------------------------------------------------------------------------
18
19class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase
20{
21public:
22 // constructors / destructor
23 // -------------------------
24
25 wxDataViewRenderer(const wxString& varianttype,
26 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
27 int align = wxDVR_DEFAULT_ALIGNMENT);
28
29 virtual ~wxDataViewRenderer();
30
31 // inherited methods from wxDataViewRendererBase
32 // ---------------------------------------------
33
34 virtual int GetAlignment() const
35 {
36 return m_alignment;
37 }
38 virtual wxDataViewCellMode GetMode() const
39 {
40 return m_mode;
41 }
42 virtual bool GetValue(wxVariant& value) const
43 {
44 value = m_value;
45 return true;
46 }
47
48 // NB: in Carbon this is always identical to the header alignment
49 virtual void SetAlignment(int align);
50 virtual void SetMode(wxDataViewCellMode mode);
51 virtual bool SetValue(const wxVariant& newValue)
52 {
53 m_value = newValue;
54 return true;
55 }
56
57 virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
58 virtual wxEllipsizeMode GetEllipsizeMode() const;
59
60 // implementation
61 // --------------
62
63 const wxVariant& GetValue() const
64 {
65 return m_value;
66 }
67
68 wxDataViewRendererNativeData* GetNativeData() const
69 {
70 return m_NativeDataPtr;
71 }
72
73 // a call to the native data browser function to render the data;
74 // returns true if the data value could be rendered, false otherwise
75 virtual bool MacRender() = 0;
76
77 void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr);
78
79
80#if wxOSX_USE_COCOA
81 // called when a value was edited by user
82 virtual void OSXOnCellChanged(NSObject *value,
83 const wxDataViewItem& item,
84 unsigned col);
b0607dd2
VZ
85
86 // called to ensure that the given attribute will be used for rendering the
87 // next cell (which had been already associated with this renderer before)
88 virtual void OSXApplyAttr(const wxDataViewItemAttr& attr);
98f8e666
VZ
89
90 // called to set the state of the next cell to be rendered
91 virtual void OSXApplyEnabled(bool enabled);
6eec70b9
VZ
92#endif // Cocoa
93
94private:
95 // contains the alignment flags
96 int m_alignment;
97
98 // storing the mode that determines how the cell is going to be shown
99 wxDataViewCellMode m_mode;
100
101 // data used by implementation of the native renderer
102 wxDataViewRendererNativeData* m_NativeDataPtr;
103
104 // value that is going to be rendered
105 wxVariant m_value;
106
107 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
108};
109
110#endif // _WX_OSX_DVRENDERER_H_
111