]> git.saurik.com Git - wxWidgets.git/blob - src/common/datavcmn.cpp
wxDataViewCtrl WIP.
[wxWidgets.git] / src / common / datavcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/datavcmn.cpp
3 // Purpose: wxDataViewCtrl base classes and common parts
4 // Author: Robert Roebling
5 // Created: 2006/02/20
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006, Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #include "wx/dataview.h"
19 #include "wx/log.h"
20 #include "wx/image.h"
21
22 // ---------------------------------------------------------
23 // wxDataViewModel
24 // ---------------------------------------------------------
25
26 IMPLEMENT_ABSTRACT_CLASS(wxDataViewModel, wxObject)
27
28 // ---------------------------------------------------------
29 // wxDataViewListModel
30 // ---------------------------------------------------------
31
32 IMPLEMENT_ABSTRACT_CLASS(wxDataViewListModel, wxDataViewModel)
33
34 wxDataViewListModel::wxDataViewListModel()
35 {
36 m_notifier = NULL;
37 }
38
39 wxDataViewListModel::~wxDataViewListModel()
40 {
41 if (m_notifier)
42 delete m_notifier;
43 }
44
45 bool wxDataViewListModel::RowAppended()
46 {
47 if (m_notifier)
48 return m_notifier->RowAppended();
49
50 return false;
51 }
52
53 bool wxDataViewListModel::RowPrepended()
54 {
55 if (m_notifier)
56 return m_notifier->RowPrepended();
57
58 return false;
59 }
60
61 bool wxDataViewListModel::RowInserted( size_t before )
62 {
63 if (m_notifier)
64 return m_notifier->RowInserted( before );
65
66 return false;
67 }
68
69 bool wxDataViewListModel::RowDeleted( size_t row )
70 {
71 if (m_notifier)
72 return m_notifier->RowDeleted( row );
73
74 return false;
75 }
76
77 bool wxDataViewListModel::RowChanged( size_t row )
78 {
79 if (m_notifier)
80 return m_notifier->RowChanged( row );
81
82 return false;
83 }
84
85 bool wxDataViewListModel::ValueChanged( size_t row, size_t col )
86 {
87 if (m_notifier)
88 return m_notifier->RowAppended();
89
90 return false;
91 }
92
93 bool wxDataViewListModel::Cleared()
94 {
95 if (m_notifier)
96 return m_notifier->Cleared();
97
98 return false;
99 }
100
101 void wxDataViewListModel::SetNotifier( wxDataViewListModelNotifier *notifier )
102 {
103 if (m_notifier)
104 delete m_notifier;
105
106 m_notifier = notifier;
107 }
108
109 wxDataViewListModelNotifier* wxDataViewListModel::GetNotifier()
110 {
111 return m_notifier;
112 }
113
114 // ---------------------------------------------------------
115 // wxDataViewCtrlBase
116 // ---------------------------------------------------------
117
118 IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl)
119
120 wxDataViewCtrlBase::wxDataViewCtrlBase()
121 {
122 m_model = NULL;
123 }
124
125 wxDataViewCtrlBase::~wxDataViewCtrlBase()
126 {
127 if (m_model)
128 delete m_model;
129 }
130
131 bool wxDataViewCtrlBase::AssociateModel( wxDataViewModel *model )
132 {
133 if (m_model)
134 delete m_model;
135
136 m_model = model;
137
138 return true;
139 }
140
141 wxDataViewModel* wxDataViewCtrlBase::GetModel()
142 {
143 return m_model;
144 }
145