]>
Commit | Line | Data |
---|---|---|
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) | |
6 | // RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $ | |
7 | // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> | |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_OSX_DVRENDERER_H_ | |
12 | #define _WX_OSX_DVRENDERER_H_ | |
13 | ||
14 | class wxDataViewRendererNativeData; | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // wxDataViewRenderer | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase | |
21 | { | |
22 | public: | |
23 | // constructors / destructor | |
24 | // ------------------------- | |
25 | ||
26 | wxDataViewRenderer(const wxString& varianttype, | |
27 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
28 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
29 | ||
30 | virtual ~wxDataViewRenderer(); | |
31 | ||
32 | // inherited methods from wxDataViewRendererBase | |
33 | // --------------------------------------------- | |
34 | ||
35 | virtual int GetAlignment() const | |
36 | { | |
37 | return m_alignment; | |
38 | } | |
39 | virtual wxDataViewCellMode GetMode() const | |
40 | { | |
41 | return m_mode; | |
42 | } | |
43 | virtual bool GetValue(wxVariant& value) const | |
44 | { | |
45 | value = m_value; | |
46 | return true; | |
47 | } | |
48 | ||
49 | // NB: in Carbon this is always identical to the header alignment | |
50 | virtual void SetAlignment(int align); | |
51 | virtual void SetMode(wxDataViewCellMode mode); | |
52 | virtual bool SetValue(const wxVariant& newValue) | |
53 | { | |
54 | m_value = newValue; | |
55 | return true; | |
56 | } | |
57 | ||
58 | virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE); | |
59 | virtual wxEllipsizeMode GetEllipsizeMode() const; | |
60 | ||
61 | // implementation | |
62 | // -------------- | |
63 | ||
64 | const wxVariant& GetValue() const | |
65 | { | |
66 | return m_value; | |
67 | } | |
68 | ||
69 | wxDataViewRendererNativeData* GetNativeData() const | |
70 | { | |
71 | return m_NativeDataPtr; | |
72 | } | |
73 | ||
74 | // a call to the native data browser function to render the data; | |
75 | // returns true if the data value could be rendered, false otherwise | |
76 | virtual bool MacRender() = 0; | |
77 | ||
78 | void SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr); | |
79 | ||
80 | ||
81 | #if wxOSX_USE_COCOA | |
82 | // called when a value was edited by user | |
83 | virtual void OSXOnCellChanged(NSObject *value, | |
84 | const wxDataViewItem& item, | |
85 | unsigned col); | |
86 | #endif // Cocoa | |
87 | ||
88 | private: | |
89 | // contains the alignment flags | |
90 | int m_alignment; | |
91 | ||
92 | // storing the mode that determines how the cell is going to be shown | |
93 | wxDataViewCellMode m_mode; | |
94 | ||
95 | // data used by implementation of the native renderer | |
96 | wxDataViewRendererNativeData* m_NativeDataPtr; | |
97 | ||
98 | // value that is going to be rendered | |
99 | wxVariant m_value; | |
100 | ||
101 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) | |
102 | }; | |
103 | ||
104 | #endif // _WX_OSX_DVRENDERER_H_ | |
105 |