1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/liststore.h>
5 #include <gtkmm/private/liststore_p.h>
10 /* Copyright 1998-2002 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtk/gtkliststore.h>
33 ListStore::ListStore(const TreeModelColumnRecord& columns)
35 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
37 Glib::Object(Glib::ConstructParams(liststore_class_.init()))
39 gtk_list_store_set_column_types(gobj(), columns.size(), const_cast<GType*>(columns.types()));
42 void ListStore::set_column_types(const TreeModelColumnRecord& columns)
44 gtk_list_store_set_column_types(gobj(), columns.size(), const_cast<GType*>(columns.types()));
48 TreeModel::iterator ListStore::erase(const iterator& iter)
50 g_assert(iter.get_gobject_if_not_end() != 0);
55 GtkTreeIter tmp = *iter.gobj();
56 gtk_list_store_remove(gobj(), &tmp);
61 TreeModel::iterator ListStore::insert(const iterator& iter)
63 iterator new_pos(this);
65 // get_gobject_if_not_end() returns 0 if iter is an end iterator, which
66 // is in turn interpreted by gtk_list_store_insert_before() as a request to
67 // insert at the end of the list.
69 gtk_list_store_insert_before(
70 gobj(), new_pos.gobj(),
71 const_cast<GtkTreeIter*>(iter.get_gobject_if_not_end()));
73 // GtkTreeIter::stamp should always have a value if it's valid.
74 // For end iterators, we need to remember the iter's parent, and
75 // this is what setup_end_iterator() does.
77 if(new_pos.gobj()->stamp == 0)
78 new_pos.setup_end_iterator(iter);
83 TreeModel::iterator ListStore::insert_after(const iterator& iter)
85 iterator new_pos(this);
87 // get_gobject_if_not_end() returns 0 if iter is an end iterator, which
88 // is in turn interpreted by gtk_list_store_insert_after() as a request to
89 // insert at the beginning of the list.
91 gtk_list_store_insert_after(
92 gobj(), new_pos.gobj(),
93 const_cast<GtkTreeIter*>(iter.get_gobject_if_not_end()));
95 // GtkTreeIter::stamp should always have a value if it's valid.
96 // For end iterators, we need to remember the iter's parent, and
97 // this is what setup_end_iterator() does.
99 if(new_pos.gobj()->stamp == 0)
100 new_pos.setup_end_iterator(iter);
105 TreeModel::iterator ListStore::prepend()
107 iterator new_pos(this);
108 gtk_list_store_prepend(gobj(), new_pos.gobj());
112 TreeModel::iterator ListStore::append()
114 iterator new_pos(this);
115 gtk_list_store_append(gobj(), new_pos.gobj());
119 void ListStore::move(const iterator& source, const iterator& destination)
121 gtk_list_store_move_before(gobj(),
122 const_cast<GtkTreeIter*>(source.get_gobject_if_not_end()),
123 const_cast<GtkTreeIter*>(destination.get_gobject_if_not_end()));
126 void ListStore::reorder(const Glib::ArrayHandle<int>& new_order)
128 gtk_list_store_reorder(gobj(), const_cast<int*>(new_order.data()));
131 void ListStore::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
133 gtk_list_store_set_value(
134 gobj(), const_cast<GtkTreeIter*>(row.gobj()),
135 column, const_cast<GValue*>(value.gobj()));
143 } // anonymous namespace
149 Glib::RefPtr<Gtk::ListStore> wrap(GtkListStore* object, bool take_copy)
151 return Glib::RefPtr<Gtk::ListStore>( dynamic_cast<Gtk::ListStore*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
152 //We use dynamic_cast<> in case of multiple inheritance.
155 } /* namespace Glib */
162 /* The *_Class implementation: */
164 const Glib::Class& ListStore_Class::init()
166 if(!gtype_) // create the GType if necessary
168 // Glib::Class has to know the class init function to clone custom types.
169 class_init_func_ = &ListStore_Class::class_init_function;
171 // This is actually just optimized away, apparently with no harm.
172 // Make sure that the parent type has been created.
173 //CppClassParent::CppObjectType::get_type();
175 // Create the wrapper type, with the same class/instance size as the base type.
176 register_derived_type(gtk_list_store_get_type());
178 // Add derived versions of interfaces, if the C type implements any interfaces:
179 TreeModel::add_interface(get_type());
180 TreeSortable::add_interface(get_type());
181 TreeDragSource::add_interface(get_type());
182 TreeDragDest::add_interface(get_type());
188 void ListStore_Class::class_init_function(void* g_class, void* class_data)
190 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
191 CppClassParent::class_init_function(klass, class_data);
193 #ifdef GLIBMM_VFUNCS_ENABLED
194 #endif //GLIBMM_VFUNCS_ENABLED
196 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
197 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
200 #ifdef GLIBMM_VFUNCS_ENABLED
201 #endif //GLIBMM_VFUNCS_ENABLED
203 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
204 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
207 Glib::ObjectBase* ListStore_Class::wrap_new(GObject* object)
209 return new ListStore((GtkListStore*)object);
213 /* The implementation: */
215 GtkListStore* ListStore::gobj_copy()
221 ListStore::ListStore(const Glib::ConstructParams& construct_params)
223 Glib::Object(construct_params)
226 ListStore::ListStore(GtkListStore* castitem)
228 Glib::Object((GObject*)(castitem))
231 ListStore::~ListStore()
235 ListStore::CppClassType ListStore::liststore_class_; // initialize static member
237 GType ListStore::get_type()
239 return liststore_class_.init().get_type();
242 GType ListStore::get_base_type()
244 return gtk_list_store_get_type();
248 ListStore::ListStore()
250 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
252 Glib::Object(Glib::ConstructParams(liststore_class_.init()))
256 Glib::RefPtr<ListStore> ListStore::create(const TreeModelColumnRecord& columns)
258 return Glib::RefPtr<ListStore>( new ListStore(columns) );
260 void ListStore::iter_swap(const iterator& a, const iterator& b)
262 gtk_list_store_swap(gobj(), const_cast<GtkTreeIter*>((a).gobj()), const_cast<GtkTreeIter*>((b).gobj()));
265 void ListStore::clear()
267 gtk_list_store_clear(gobj());
270 bool ListStore::iter_is_valid(const iterator& iter) const
272 return gtk_list_store_iter_is_valid(const_cast<GtkListStore*>(gobj()), const_cast<GtkTreeIter*>((iter).gobj()));
276 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
277 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
279 #ifdef GLIBMM_VFUNCS_ENABLED
280 #endif //GLIBMM_VFUNCS_ENABLED