2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TREESTORE_H
4 #define _GTKMM_TREESTORE_H
10 /* Copyright(C) 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 <gtkmm/treeiter.h>
28 #include <gtkmm/treemodel.h>
29 #include <gtkmm/treesortable.h>
30 #include <gtkmm/treedragdest.h>
31 #include <gtkmm/treedragsource.h>
32 // We couldn't include it in treemodel.h, but doing it here makes it easier for people.
33 #include <gtkmm/treepath.h>
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 typedef struct _GtkTreeStore GtkTreeStore;
38 typedef struct _GtkTreeStoreClass GtkTreeStoreClass;
39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
43 { class TreeStore_Class; } // namespace Gtk
53 public Gtk::TreeModel,
55 public TreeDragSource,
59 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 typedef TreeStore CppObjectType;
63 typedef TreeStore_Class CppClassType;
64 typedef GtkTreeStore BaseObjectType;
65 typedef GtkTreeStoreClass BaseClassType;
67 private: friend class TreeStore_Class;
68 static CppClassType treestore_class_;
72 TreeStore(const TreeStore&);
73 TreeStore& operator=(const TreeStore&);
76 explicit TreeStore(const Glib::ConstructParams& construct_params);
77 explicit TreeStore(GtkTreeStore* castitem);
79 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85 static GType get_type() G_GNUC_CONST;
86 static GType get_base_type() G_GNUC_CONST;
89 ///Provides access to the underlying C GObject.
90 GtkTreeStore* gobj() { return reinterpret_cast<GtkTreeStore*>(gobject_); }
92 ///Provides access to the underlying C GObject.
93 const GtkTreeStore* gobj() const { return reinterpret_cast<GtkTreeStore*>(gobject_); }
95 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
96 GtkTreeStore* gobj_copy();
102 /** When using this constructor, you must use set_column_types() immediately afterwards.
103 * This can be useful when deriving from this class, with a fixed TreeModelColumnRecord
104 * that is a member of the class.
105 * There is no create() method that corresponds to this constructor, because this
106 * constructor should only be used by derived classes.
110 explicit TreeStore(const TreeModelColumnRecord& columns);
113 /** Instantiate a new TreeStore.
114 * @param columns The column types for this tree model.
115 * @result The new TreeStore.
118 static Glib::RefPtr<TreeStore> create(const TreeModelColumnRecord& columns);
121 void set_column_types(const TreeModelColumnRecord& columns);
124 /** Removes the given row from the list store.
125 * @param iter The iterator to the row to be removed.
126 * @result An iterator to the next row, or end() if there is none.
128 iterator erase(const iterator& iter);
131 //TODO: Make this documentation similar to documentation for Standard C++ insert methods.
132 /** Creates a new row before the position.
133 * If iter is end() then a new row will be appended to the list.
134 * The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value().
135 * See also prepend() and append().
137 * @param iter An iterator to the row before which the new row will be inserted.
138 * @result An iterator to the new row.
140 iterator insert(const iterator& iter);
143 /** Creates a new row after the position.
144 * If iter is end() then a new row will be prepended to the list.
145 * The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value().
146 * See also prepend() and append().
148 * @param iter An iterator to the row after which the new row will be inserted.
149 * @result An iterator to the new row.
151 iterator insert_after(const iterator& iter);
154 /** Creates a new row at the start of the top-level.
155 * The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value().
156 * See also insert() and append().
158 * @result An iterator to the new row.
162 /** Creates a new row at the start of the row's children.
163 * The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value().
164 * See also insert() and append().
166 * @param node The list of the parent row's children, as returned by Gtk::TreeModel::iterator::children().
167 * @result An iterator to the new row.
169 iterator prepend(const TreeNodeChildren& node);
172 /** Creates a new row at the end of the top-level.
173 * The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value().
174 * See also insert() and prepend().
176 * @result An iterator to the new row.
180 /** Creates a new row at the end of the row's children.
181 * The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value().
182 * See also insert() and prepend().
184 * @param node The list of the parent row's children, as returned by Gtk::TreeModel::iterator::children().
185 * @result An iterator to the new row.
187 iterator append(const TreeNodeChildren& node);
190 /** Swaps @a a and @a b in the same level of @a tree_store . Note that this function
191 * only works with unsorted stores.
194 * @param a A Gtk::TreeIter.
195 * @param b Another Gtk::TreeIter.
197 void iter_swap(const iterator& a, const iterator& b);
199 /** Moves @a source to the position at @a destination.
200 * @a source and @a destination should be at the same level.
201 * Note that this function only works with unsorted stores.
202 * @param source The row that should be moved.
203 * @param destination The position to move to.
205 void move(const iterator& source, const iterator& destination);
207 /** Reorders the children of @a node to follow the order indicated by @a new_order.
208 * Note that this function only works with unsorted stores.
210 void reorder(const TreeNodeChildren& node, const Glib::ArrayHandle<int>& new_order);
213 /** Removes all rows from @a tree_store
217 /** Returns <tt>true</tt> if @a iter is an ancestor of @a descendant . That is, @a iter is the
218 * parent (or grandparent or great-grandparent) of @a descendant .
219 * @param iter A valid Gtk::TreeIter.
220 * @param descendant A valid Gtk::TreeIter.
221 * @return <tt>true</tt>, if @a iter is an ancestor of @a descendant .
223 bool is_ancestor(const iterator& iter, const iterator& descendant) const;
225 /** Returns the depth of @a iter . This will be 0 for anything on the root level, 1
226 * for anything down a level, etc.
227 * @param iter A valid Gtk::TreeIter.
228 * @return The depth of @a iter .
230 int iter_depth(const iterator& iter) const;
233 /** WARNING: This function is slow. Only use it for debugging and/or testing
236 * Checks if the given iter is a valid iter for this Gtk::TreeStore.
237 * @param iter A Gtk::TreeIter.
238 * @return <tt>true</tt> if the iter is valid, <tt>false</tt> if the iter is invalid.
242 bool iter_is_valid(const iterator& iter) const;
245 virtual void set_value_impl(const iterator& row, int column, const Glib::ValueBase& value);
251 //C++ methods used to invoke GTK+ virtual functions:
254 //GTK+ Virtual Functions (override these to change behaviour):
256 //Default Signal Handlers::
266 /** @relates Gtk::TreeStore
267 * @param object The C instance
268 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
269 * @result A C++ instance that wraps this C instance.
271 Glib::RefPtr<Gtk::TreeStore> wrap(GtkTreeStore* object, bool take_copy = false);
275 #endif /* _GTKMM_TREESTORE_H */