]>
Commit | Line | Data |
---|---|---|
239eaa41 RR |
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 | ||
260b9be7 | 18 | #include "wx/object.h" |
239eaa41 RR |
19 | #include "wx/dataview.h" |
20 | #include "wx/log.h" | |
21 | #include "wx/image.h" | |
22 | ||
23 | // --------------------------------------------------------- | |
24 | // wxDataViewModel | |
25 | // --------------------------------------------------------- | |
26 | ||
27 | IMPLEMENT_ABSTRACT_CLASS(wxDataViewModel, wxObject) | |
28 | ||
29 | // --------------------------------------------------------- | |
30 | // wxDataViewListModel | |
31 | // --------------------------------------------------------- | |
32 | ||
33 | IMPLEMENT_ABSTRACT_CLASS(wxDataViewListModel, wxDataViewModel) | |
34 | ||
35 | wxDataViewListModel::wxDataViewListModel() | |
36 | { | |
37 | m_notifier = NULL; | |
38 | } | |
39 | ||
40 | wxDataViewListModel::~wxDataViewListModel() | |
41 | { | |
42 | if (m_notifier) | |
43 | delete m_notifier; | |
44 | } | |
45 | ||
46 | bool wxDataViewListModel::RowAppended() | |
47 | { | |
48 | if (m_notifier) | |
49 | return m_notifier->RowAppended(); | |
50 | ||
51 | return false; | |
52 | } | |
53 | ||
54 | bool wxDataViewListModel::RowPrepended() | |
55 | { | |
56 | if (m_notifier) | |
57 | return m_notifier->RowPrepended(); | |
58 | ||
59 | return false; | |
60 | } | |
61 | ||
62 | bool wxDataViewListModel::RowInserted( size_t before ) | |
63 | { | |
64 | if (m_notifier) | |
65 | return m_notifier->RowInserted( before ); | |
66 | ||
67 | return false; | |
68 | } | |
69 | ||
70 | bool wxDataViewListModel::RowDeleted( size_t row ) | |
71 | { | |
72 | if (m_notifier) | |
73 | return m_notifier->RowDeleted( row ); | |
74 | ||
75 | return false; | |
76 | } | |
77 | ||
78 | bool wxDataViewListModel::RowChanged( size_t row ) | |
79 | { | |
80 | if (m_notifier) | |
81 | return m_notifier->RowChanged( row ); | |
82 | ||
83 | return false; | |
84 | } | |
85 | ||
86 | bool wxDataViewListModel::ValueChanged( size_t row, size_t col ) | |
87 | { | |
88 | if (m_notifier) | |
89 | return m_notifier->RowAppended(); | |
90 | ||
91 | return false; | |
92 | } | |
93 | ||
94 | bool wxDataViewListModel::Cleared() | |
95 | { | |
96 | if (m_notifier) | |
97 | return m_notifier->Cleared(); | |
98 | ||
99 | return false; | |
100 | } | |
101 | ||
102 | void wxDataViewListModel::SetNotifier( wxDataViewListModelNotifier *notifier ) | |
103 | { | |
104 | if (m_notifier) | |
105 | delete m_notifier; | |
106 | ||
107 | m_notifier = notifier; | |
108 | } | |
109 | ||
110 | wxDataViewListModelNotifier* wxDataViewListModel::GetNotifier() | |
111 | { | |
112 | return m_notifier; | |
113 | } | |
114 | ||
115 | // --------------------------------------------------------- | |
116 | // wxDataViewCtrlBase | |
117 | // --------------------------------------------------------- | |
118 | ||
119 | IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl) | |
120 | ||
121 | wxDataViewCtrlBase::wxDataViewCtrlBase() | |
122 | { | |
123 | m_model = NULL; | |
124 | } | |
125 | ||
126 | wxDataViewCtrlBase::~wxDataViewCtrlBase() | |
127 | { | |
128 | if (m_model) | |
129 | delete m_model; | |
130 | } | |
131 | ||
6e2e590f | 132 | bool wxDataViewCtrlBase::AssociateModel( wxDataViewListModel *model ) |
239eaa41 RR |
133 | { |
134 | if (m_model) | |
135 | delete m_model; | |
136 | ||
137 | m_model = model; | |
138 | ||
139 | return true; | |
140 | } | |
141 | ||
6e2e590f | 142 | wxDataViewListModel* wxDataViewCtrlBase::GetModel() |
239eaa41 RR |
143 | { |
144 | return m_model; | |
145 | } | |
146 |