2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TREEMODELSORT_H
4 #define _GTKMM_TREEMODELSORT_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.
28 #include <gtkmm/treeiter.h>
29 #include <gtkmm/treemodel.h>
30 #include <gtkmm/treesortable.h>
31 // We couldn't include it in treemodel.h, but doing it here makes it easier for people.
32 #include <gtkmm/treepath.h>
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 typedef struct _GtkTreeModelSort GtkTreeModelSort;
37 typedef struct _GtkTreeModelSortClass GtkTreeModelSortClass;
38 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
42 { class TreeModelSort_Class; } // namespace Gtk
46 /** A wrapper which makes an underlying Gtk::TreeModel sortable.
50 class TreeModelSort : public Glib::Object, public TreeModel, public TreeSortable
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
56 typedef TreeModelSort CppObjectType;
57 typedef TreeModelSort_Class CppClassType;
58 typedef GtkTreeModelSort BaseObjectType;
59 typedef GtkTreeModelSortClass BaseClassType;
61 private: friend class TreeModelSort_Class;
62 static CppClassType treemodelsort_class_;
66 TreeModelSort(const TreeModelSort&);
67 TreeModelSort& operator=(const TreeModelSort&);
70 explicit TreeModelSort(const Glib::ConstructParams& construct_params);
71 explicit TreeModelSort(GtkTreeModelSort* castitem);
73 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
76 virtual ~TreeModelSort();
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79 static GType get_type() G_GNUC_CONST;
80 static GType get_base_type() G_GNUC_CONST;
83 ///Provides access to the underlying C GObject.
84 GtkTreeModelSort* gobj() { return reinterpret_cast<GtkTreeModelSort*>(gobject_); }
86 ///Provides access to the underlying C GObject.
87 const GtkTreeModelSort* gobj() const { return reinterpret_cast<GtkTreeModelSort*>(gobject_); }
89 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
90 GtkTreeModelSort* gobj_copy();
96 explicit TreeModelSort(const Glib::RefPtr<TreeModel>& model);
100 static Glib::RefPtr<TreeModelSort> create(const Glib::RefPtr<TreeModel>& model);
103 /** Returns the model the Gtk::TreeModelSort is sorting.
104 * @return The "child model" being sorted.
106 Glib::RefPtr<TreeModel> get_model();
108 /** Returns the model the Gtk::TreeModelSort is sorting.
109 * @return The "child model" being sorted.
111 Glib::RefPtr<const TreeModel> get_model() const;
114 /** Converts @a child_path to a path relative to @a tree_model_sort . That is,
115 * @a child_path points to a path in the child model. The returned path will
116 * point to the same row in the sorted model. If @a child_path isn't a valid path
117 * on the child model, then <tt>0</tt> is returned.
118 * @param child_path A Gtk::TreePath to convert.
119 * @return A newly allocated Gtk::TreePath, or <tt>0</tt>.
121 Path convert_child_path_to_path(const Path& child_path) const;
123 /** Gets an iterator that points to the sorted row that corresponds to the child row pointed at by child_iter.
125 * @param child_iter A valid iterator pointing to a row on the child model.
126 * @result A valid iterator that points to the row in this sorted model.
128 iterator convert_child_iter_to_iter(const iterator& child_iter) const;
131 /** Converts @a sorted_path to a path on the child model of @a tree_model_sort . That
132 * is, @a sorted_path points to a location in @a tree_model_sort . The returned path
133 * will point to the same location in the model not being sorted. If @a sorted_path
134 * does not point to a location in the child model, <tt>0</tt> is returned.
135 * @param sorted_path A Gtk::TreePath to convert.
136 * @return A newly allocated Gtk::TreePath, or <tt>0</tt>.
138 Path convert_path_to_child_path(const Path& sorted_path) const;
140 /** Gets an iterator that points to the child row that corresponds to the sorted row pointed at by sorted_iter.
142 * @param sorted_iter A valid iterator pointing to a row on the sorted model.
143 * @result A valid iterator that points to the row in the child model.
145 iterator convert_iter_to_child_iter(const iterator& sorted_iter) const;
148 /** This resets the default sort function to be in the 'unsorted' state. That
149 * is, it is in the same order as the child model. It will re-sort the model
150 * to be in the same order as the child model only if the Gtk::TreeModelSort
151 * is in 'unsorted' state.
153 void reset_default_sort_func();
155 /** This function should almost never be called. It clears the @a tree_model_sort
156 * of any cached iterators that haven't been reffed with
157 * ref_node(). This might be useful if the child model being
158 * sorted is static (and doesn't change often) and there has been a lot of
159 * unreffed access to nodes. As a side effect of this function, all unreffed
160 * iters will be invalid.
165 /** WARNING: This function is slow. Only use it for debugging and/or testing
168 * Checks if the given iter is a valid iter for this Gtk::TreeModelSort.
169 * @param iter A Gtk::TreeIter.
170 * @return <tt>true</tt> if the iter is valid, <tt>false</tt> if the iter is invalid.
174 bool iter_is_valid(const iterator& iter) const;
177 virtual void set_value_impl(const iterator& row, int column, const Glib::ValueBase& value);
183 //C++ methods used to invoke GTK+ virtual functions:
186 //GTK+ Virtual Functions (override these to change behaviour):
188 //Default Signal Handlers::
198 /** @relates Gtk::TreeModelSort
199 * @param object The C instance
200 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
201 * @result A C++ instance that wraps this C instance.
203 Glib::RefPtr<Gtk::TreeModelSort> wrap(GtkTreeModelSort* object, bool take_copy = false);
207 #endif /* _GTKMM_TREEMODELSORT_H */