1
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#include <gtkmm/liststore.h>
4
#include <gtkmm/private/liststore_p.h>
9
/* Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
26
#include <gtk/gtkliststore.h>
32
ListStore::ListStore(const TreeModelColumnRecord& columns)
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))
37
gtk_list_store_set_column_types(gobj(), columns.size(), const_cast<GType*>(columns.types()));
40
void ListStore::set_column_types(const TreeModelColumnRecord& columns)
42
gtk_list_store_set_column_types(gobj(), columns.size(), const_cast<GType*>(columns.types()));
46
TreeModel::iterator ListStore::erase(const iterator& iter)
48
g_assert(iter.get_gobject_if_not_end() != 0);
53
GtkTreeIter tmp = *iter.gobj();
54
gtk_list_store_remove(gobj(), &tmp);
59
TreeModel::iterator ListStore::insert(const iterator& iter)
61
iterator new_pos(this);
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.
67
gtk_list_store_insert_before(
68
gobj(), new_pos.gobj(),
69
const_cast<GtkTreeIter*>(iter.get_gobject_if_not_end()));
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.
75
if(new_pos.gobj()->stamp == 0)
76
new_pos.setup_end_iterator(iter);
81
TreeModel::iterator ListStore::insert_after(const iterator& iter)
83
iterator new_pos(this);
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.
89
gtk_list_store_insert_after(
90
gobj(), new_pos.gobj(),
91
const_cast<GtkTreeIter*>(iter.get_gobject_if_not_end()));
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.
97
if(new_pos.gobj()->stamp == 0)
98
new_pos.setup_end_iterator(iter);
103
TreeModel::iterator ListStore::prepend()
105
iterator new_pos(this);
106
gtk_list_store_prepend(gobj(), new_pos.gobj());
110
TreeModel::iterator ListStore::append()
112
iterator new_pos(this);
113
gtk_list_store_append(gobj(), new_pos.gobj());
117
void ListStore::move(const iterator& source, const iterator& destination)
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()));
124
void ListStore::reorder(const Glib::ArrayHandle<int>& new_order)
126
gtk_list_store_reorder(gobj(), const_cast<int*>(new_order.data()));
129
void ListStore::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
131
gtk_list_store_set_value(
132
gobj(), const_cast<GtkTreeIter*>(row.gobj()),
133
column, const_cast<GValue*>(value.gobj()));
141
} // anonymous namespace
147
Glib::RefPtr<Gtk::ListStore> wrap(GtkListStore* object, bool take_copy)
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.
153
} /* namespace Glib */
160
/* The *_Class implementation: */
162
const Glib::Class& ListStore_Class::init()
164
if(!gtype_) // create the GType if necessary
166
// Glib::Class has to know the class init function to clone custom types.
167
class_init_func_ = &ListStore_Class::class_init_function;
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();
173
// Create the wrapper type, with the same class/instance size as the base type.
174
register_derived_type(gtk_list_store_get_type());
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());
186
void ListStore_Class::class_init_function(void* g_class, void* class_data)
188
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
189
CppClassParent::class_init_function(klass, class_data);
194
Glib::ObjectBase* ListStore_Class::wrap_new(GObject* object)
196
return new ListStore((GtkListStore*)object);
200
/* The implementation: */
202
GtkListStore* ListStore::gobj_copy()
208
ListStore::ListStore(const Glib::ConstructParams& construct_params)
210
Glib::Object(construct_params)
213
ListStore::ListStore(GtkListStore* castitem)
215
Glib::Object((GObject*)(castitem))
218
ListStore::~ListStore()
222
ListStore::CppClassType ListStore::liststore_class_; // initialize static member
224
GType ListStore::get_type()
226
return liststore_class_.init().get_type();
229
GType ListStore::get_base_type()
231
return gtk_list_store_get_type();
235
ListStore::ListStore()
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()))
242
Glib::RefPtr<ListStore> ListStore::create(const TreeModelColumnRecord& columns)
244
return Glib::RefPtr<ListStore>( new ListStore(columns) );
246
void ListStore::iter_swap(const iterator& a, const iterator& b)
248
gtk_list_store_swap(gobj(), const_cast<GtkTreeIter*>((a).gobj()), const_cast<GtkTreeIter*>((b).gobj()));
251
void ListStore::clear()
253
gtk_list_store_clear(gobj());
256
bool ListStore::iter_is_valid(const iterator& iter) const
258
return gtk_list_store_iter_is_valid(const_cast<GtkListStore*>(gobj()), const_cast<GtkTreeIter*>((iter).gobj()));