]> git.saurik.com Git - wxWidgets.git/blame - src/common/datavcmn.cpp
Implemented user dashes for PS print.
[wxWidgets.git] / src / common / datavcmn.cpp
CommitLineData
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
27IMPLEMENT_ABSTRACT_CLASS(wxDataViewModel, wxObject)
28
29// ---------------------------------------------------------
30// wxDataViewListModel
31// ---------------------------------------------------------
32
33IMPLEMENT_ABSTRACT_CLASS(wxDataViewListModel, wxDataViewModel)
34
35wxDataViewListModel::wxDataViewListModel()
36{
37 m_notifier = NULL;
38}
39
40wxDataViewListModel::~wxDataViewListModel()
41{
42 if (m_notifier)
43 delete m_notifier;
44}
45
46bool wxDataViewListModel::RowAppended()
47{
48 if (m_notifier)
49 return m_notifier->RowAppended();
50
51 return false;
52}
53
54bool wxDataViewListModel::RowPrepended()
55{
56 if (m_notifier)
57 return m_notifier->RowPrepended();
58
59 return false;
60}
61
62bool wxDataViewListModel::RowInserted( size_t before )
63{
64 if (m_notifier)
65 return m_notifier->RowInserted( before );
66
67 return false;
68}
69
70bool wxDataViewListModel::RowDeleted( size_t row )
71{
72 if (m_notifier)
73 return m_notifier->RowDeleted( row );
74
75 return false;
76}
77
78bool wxDataViewListModel::RowChanged( size_t row )
79{
80 if (m_notifier)
81 return m_notifier->RowChanged( row );
82
83 return false;
84}
85
a7f61f76 86bool wxDataViewListModel::ValueChanged( size_t col, size_t row )
239eaa41
RR
87{
88 if (m_notifier)
a7f61f76 89 return m_notifier->ValueChanged( col, row );
239eaa41
RR
90
91 return false;
92}
93
94bool wxDataViewListModel::Cleared()
95{
96 if (m_notifier)
97 return m_notifier->Cleared();
98
99 return false;
100}
101
102void wxDataViewListModel::SetNotifier( wxDataViewListModelNotifier *notifier )
103{
104 if (m_notifier)
105 delete m_notifier;
106
107 m_notifier = notifier;
108}
109
110wxDataViewListModelNotifier* wxDataViewListModel::GetNotifier()
111{
112 return m_notifier;
113}
114
6842a71a
RR
115// ---------------------------------------------------------
116// wxDataViewCellBase
117// ---------------------------------------------------------
118
119IMPLEMENT_ABSTRACT_CLASS(wxDataViewCellBase, wxObject)
120
121wxDataViewCellBase::wxDataViewCellBase( const wxString &varianttype, wxDataViewCellMode mode )
122{
123 m_variantType = varianttype;
124 m_mode = mode;
125}
126
fa28826d
RR
127// ---------------------------------------------------------
128// wxDataViewColumnBase
129// ---------------------------------------------------------
130
131IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumnBase, wxObject)
132
6842a71a 133wxDataViewColumnBase::wxDataViewColumnBase( const wxString &title, wxDataViewCell *cell, size_t model_column, int flags)
fa28826d 134{
6842a71a
RR
135 m_cell = cell;
136 m_model_column = model_column;
fa28826d
RR
137 m_flags = flags;
138 m_title = title;
6842a71a
RR
139 m_owner = NULL;
140 m_cell->SetOwner( (wxDataViewColumn*) this );
141}
142
143wxDataViewColumnBase::~wxDataViewColumnBase()
144{
145 if (m_cell)
146 delete m_cell;
fa28826d
RR
147}
148
149void wxDataViewColumnBase::SetTitle( const wxString &title )
150{
151 m_title = title;
152}
153
154wxString wxDataViewColumnBase::GetTitle()
155{
156 return m_title;
157}
158
239eaa41
RR
159// ---------------------------------------------------------
160// wxDataViewCtrlBase
161// ---------------------------------------------------------
162
163IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl)
164
165wxDataViewCtrlBase::wxDataViewCtrlBase()
166{
167 m_model = NULL;
fa28826d 168 m_cols.DeleteContents( true );
239eaa41
RR
169}
170
171wxDataViewCtrlBase::~wxDataViewCtrlBase()
172{
173 if (m_model)
174 delete m_model;
175}
176
6e2e590f 177bool wxDataViewCtrlBase::AssociateModel( wxDataViewListModel *model )
239eaa41
RR
178{
179 if (m_model)
180 delete m_model;
181
182 m_model = model;
183
184 return true;
185}
186
6e2e590f 187wxDataViewListModel* wxDataViewCtrlBase::GetModel()
239eaa41
RR
188{
189 return m_model;
190}
191
6842a71a 192bool wxDataViewCtrlBase::AppendStringColumn( const wxString &label, size_t model_column )
fa28826d 193{
6842a71a 194 return AppendColumn( new wxDataViewColumn( label, new wxDataViewTextCell(), model_column ) );
fa28826d
RR
195}
196
197bool wxDataViewCtrlBase::AppendColumn( wxDataViewColumn *col )
198{
199 m_cols.Append( (wxObject*) col );
6842a71a 200 col->SetOwner( (wxDataViewCtrl*) this );
fa28826d
RR
201 return true;
202}
203
204size_t wxDataViewCtrlBase::GetNumberOfColumns()
205{
206 return m_cols.GetCount();
207}
208
209bool wxDataViewCtrlBase::DeleteColumn( size_t pos )
210{
211 return false;
212}
213
214bool wxDataViewCtrlBase::ClearColumns()
215{
216 return false;
217}
218
219wxDataViewColumn* wxDataViewCtrlBase::GetColumn( size_t pos )
220{
221 return (wxDataViewColumn*) m_cols[ pos ];
222}
223