~ubuntu-branches/ubuntu/vivid/ardour/vivid-proposed

« back to all changes in this revision

Viewing changes to libs/gtkmm2/gtk/gtkmm/liststore.cc

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Jaromír Mikeš, Felipe Sateler
  • Date: 2014-05-22 14:39:25 UTC
  • mfrom: (29 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: package-import@ubuntu.com-20140522143925-vwqfo9287pmkrroe
Tags: 1:2.8.16+git20131003-3
* Team upload

[ Jaromír Mikeš ]
* Add -dbg package

[ Felipe Sateler ]
* Upload to experimental

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Generated by gtkmmproc -- DO NOT MODIFY!
 
2
 
 
3
#include <gtkmm/liststore.h>
 
4
#include <gtkmm/private/liststore_p.h>
 
5
 
 
6
// -*- c++ -*-
 
7
/* $Id$ */
 
8
 
 
9
/* Copyright 1998-2002 The gtkmm Development Team
 
10
 *
 
11
 * This library is free software; you can redistribute it and/or
 
12
 * modify it under the terms of the GNU Library General Public
 
13
 * License as published by the Free Software Foundation; either
 
14
 * version 2 of the License, or (at your option) any later version.
 
15
 *
 
16
 * This library is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
19
 * Library General Public License for more details.
 
20
 *
 
21
 * You should have received a copy of the GNU Library General Public
 
22
 * License along with this library; if not, write to the Free
 
23
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
24
 */
 
25
 
 
26
#include <gtk/gtkliststore.h>
 
27
 
 
28
 
 
29
namespace Gtk
 
30
{
 
31
 
 
32
ListStore::ListStore(const TreeModelColumnRecord& columns)
 
33
:
 
34
  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
 
35
  Glib::Object(Glib::ConstructParams(liststore_class_.init(), (char*) 0))
 
36
{
 
37
  gtk_list_store_set_column_types(gobj(), columns.size(), const_cast<GType*>(columns.types()));
 
38
}
 
39
 
 
40
void ListStore::set_column_types(const TreeModelColumnRecord& columns)
 
41
{
 
42
   gtk_list_store_set_column_types(gobj(), columns.size(), const_cast<GType*>(columns.types()));
 
43
}
 
44
  
 
45
 
 
46
TreeModel::iterator ListStore::erase(const iterator& iter)
 
47
{
 
48
  g_assert(iter.get_gobject_if_not_end() != 0);
 
49
 
 
50
  iterator next(iter);
 
51
  ++next;
 
52
 
 
53
  GtkTreeIter tmp = *iter.gobj();
 
54
  gtk_list_store_remove(gobj(), &tmp);
 
55
 
 
56
  return next;
 
57
}
 
58
 
 
59
TreeModel::iterator ListStore::insert(const iterator& iter)
 
60
{
 
61
  iterator new_pos(this);
 
62
 
 
63
  // get_gobject_if_not_end() returns 0 if iter is an end iterator, which
 
64
  // is in turn interpreted by gtk_list_store_insert_before() as a request to
 
65
  // insert at the end of the list.
 
66
 
 
67
  gtk_list_store_insert_before(
 
68
      gobj(), new_pos.gobj(),
 
69
      const_cast<GtkTreeIter*>(iter.get_gobject_if_not_end()));
 
70
 
 
71
  // GtkTreeIter::stamp should always have a value if it's valid.
 
72
  // For end iterators, we need to remember the iter's parent, and
 
73
  // this is what setup_end_iterator() does.
 
74
 
 
75
  if(new_pos.gobj()->stamp == 0)
 
76
    new_pos.setup_end_iterator(iter);
 
77
 
 
78
  return new_pos;
 
79
}
 
80
 
 
81
TreeModel::iterator ListStore::insert_after(const iterator& iter)
 
82
{
 
83
  iterator new_pos(this);
 
84
 
 
85
  // get_gobject_if_not_end() returns 0 if iter is an end iterator, which
 
86
  // is in turn interpreted by gtk_list_store_insert_after() as a request to
 
87
  // insert at the beginning of the list.
 
88
 
 
89
  gtk_list_store_insert_after(
 
90
      gobj(), new_pos.gobj(),
 
91
      const_cast<GtkTreeIter*>(iter.get_gobject_if_not_end()));
 
92
 
 
93
  // GtkTreeIter::stamp should always have a value if it's valid.
 
94
  // For end iterators, we need to remember the iter's parent, and
 
95
  // this is what setup_end_iterator() does.
 
96
 
 
97
  if(new_pos.gobj()->stamp == 0)
 
98
    new_pos.setup_end_iterator(iter);
 
99
 
 
100
  return new_pos;
 
101
}
 
102
 
 
103
TreeModel::iterator ListStore::prepend()
 
104
{
 
105
  iterator new_pos(this);
 
106
  gtk_list_store_prepend(gobj(), new_pos.gobj());
 
107
  return new_pos;
 
108
}
 
109
 
 
110
TreeModel::iterator ListStore::append()
 
111
{
 
112
  iterator new_pos(this);
 
113
  gtk_list_store_append(gobj(), new_pos.gobj());
 
114
  return new_pos;
 
115
}
 
116
 
 
117
void ListStore::move(const iterator& source, const iterator& destination)
 
118
{
 
119
  gtk_list_store_move_before(gobj(),
 
120
      const_cast<GtkTreeIter*>(source.get_gobject_if_not_end()),
 
121
      const_cast<GtkTreeIter*>(destination.get_gobject_if_not_end()));
 
122
}
 
123
 
 
124
void ListStore::reorder(const Glib::ArrayHandle<int>& new_order)
 
125
{
 
126
  gtk_list_store_reorder(gobj(), const_cast<int*>(new_order.data()));
 
127
}
 
128
 
 
129
void ListStore::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
 
130
{
 
131
  gtk_list_store_set_value(
 
132
      gobj(), const_cast<GtkTreeIter*>(row.gobj()),
 
133
      column, const_cast<GValue*>(value.gobj()));
 
134
}
 
135
 
 
136
} // namespace Gtk
 
137
 
 
138
 
 
139
namespace
 
140
{
 
141
} // anonymous namespace
 
142
 
 
143
 
 
144
namespace Glib
 
145
{
 
146
 
 
147
Glib::RefPtr<Gtk::ListStore> wrap(GtkListStore* object, bool take_copy)
 
148
{
 
149
  return Glib::RefPtr<Gtk::ListStore>( dynamic_cast<Gtk::ListStore*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
 
150
  //We use dynamic_cast<> in case of multiple inheritance.
 
151
}
 
152
 
 
153
} /* namespace Glib */
 
154
 
 
155
 
 
156
namespace Gtk
 
157
{
 
158
 
 
159
 
 
160
/* The *_Class implementation: */
 
161
 
 
162
const Glib::Class& ListStore_Class::init()
 
163
{
 
164
  if(!gtype_) // create the GType if necessary
 
165
  {
 
166
    // Glib::Class has to know the class init function to clone custom types.
 
167
    class_init_func_ = &ListStore_Class::class_init_function;
 
168
 
 
169
    // This is actually just optimized away, apparently with no harm.
 
170
    // Make sure that the parent type has been created.
 
171
    //CppClassParent::CppObjectType::get_type();
 
172
 
 
173
    // Create the wrapper type, with the same class/instance size as the base type.
 
174
    register_derived_type(gtk_list_store_get_type());
 
175
 
 
176
    // Add derived versions of interfaces, if the C type implements any interfaces:
 
177
  TreeModel::add_interface(get_type());
 
178
  TreeSortable::add_interface(get_type());
 
179
  TreeDragSource::add_interface(get_type());
 
180
  TreeDragDest::add_interface(get_type());
 
181
  }
 
182
 
 
183
  return *this;
 
184
}
 
185
 
 
186
void ListStore_Class::class_init_function(void* g_class, void* class_data)
 
187
{
 
188
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
 
189
  CppClassParent::class_init_function(klass, class_data);
 
190
 
 
191
}
 
192
 
 
193
 
 
194
Glib::ObjectBase* ListStore_Class::wrap_new(GObject* object)
 
195
{
 
196
  return new ListStore((GtkListStore*)object);
 
197
}
 
198
 
 
199
 
 
200
/* The implementation: */
 
201
 
 
202
GtkListStore* ListStore::gobj_copy()
 
203
{
 
204
  reference();
 
205
  return gobj();
 
206
}
 
207
 
 
208
ListStore::ListStore(const Glib::ConstructParams& construct_params)
 
209
:
 
210
  Glib::Object(construct_params)
 
211
{}
 
212
 
 
213
ListStore::ListStore(GtkListStore* castitem)
 
214
:
 
215
  Glib::Object((GObject*)(castitem))
 
216
{}
 
217
 
 
218
ListStore::~ListStore()
 
219
{}
 
220
 
 
221
 
 
222
ListStore::CppClassType ListStore::liststore_class_; // initialize static member
 
223
 
 
224
GType ListStore::get_type()
 
225
{
 
226
  return liststore_class_.init().get_type();
 
227
}
 
228
 
 
229
GType ListStore::get_base_type()
 
230
{
 
231
  return gtk_list_store_get_type();
 
232
}
 
233
 
 
234
 
 
235
ListStore::ListStore()
 
236
:
 
237
  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
 
238
  Glib::Object(Glib::ConstructParams(liststore_class_.init()))
 
239
{
 
240
  }
 
241
 
 
242
Glib::RefPtr<ListStore> ListStore::create(const TreeModelColumnRecord& columns)
 
243
{
 
244
  return Glib::RefPtr<ListStore>( new ListStore(columns) );
 
245
}
 
246
void ListStore::iter_swap(const iterator& a, const iterator& b)
 
247
{
 
248
  gtk_list_store_swap(gobj(), const_cast<GtkTreeIter*>((a).gobj()), const_cast<GtkTreeIter*>((b).gobj()));
 
249
}
 
250
 
 
251
void ListStore::clear()
 
252
{
 
253
  gtk_list_store_clear(gobj());
 
254
}
 
255
 
 
256
bool ListStore::iter_is_valid(const iterator& iter) const
 
257
{
 
258
  return gtk_list_store_iter_is_valid(const_cast<GtkListStore*>(gobj()), const_cast<GtkTreeIter*>((iter).gobj()));
 
259
}
 
260
 
 
261
 
 
262
} // namespace Gtk
 
263
 
 
264