Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / treemodelsort.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TREEMODELSORT_H
4 #define _GTKMM_TREEMODELSORT_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* Copyright(C) 1998-2002 The gtkmm Development Team
11  *
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.
16  *
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.
21  *
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.
25  */
26
27
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>
33
34
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 typedef struct _GtkTreeModelSort GtkTreeModelSort;
37 typedef struct _GtkTreeModelSortClass GtkTreeModelSortClass;
38 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
39
40
41 namespace Gtk
42 { class TreeModelSort_Class; } // namespace Gtk
43 namespace Gtk
44 {
45
46 /** A wrapper which makes an underlying Gtk::TreeModel sortable.
47  * @ingroup TreeView
48  */
49
50 class TreeModelSort : public Glib::Object, public TreeModel, public TreeSortable
51 {
52   
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54
55 public:
56   typedef TreeModelSort CppObjectType;
57   typedef TreeModelSort_Class CppClassType;
58   typedef GtkTreeModelSort BaseObjectType;
59   typedef GtkTreeModelSortClass BaseClassType;
60
61 private:  friend class TreeModelSort_Class;
62   static CppClassType treemodelsort_class_;
63
64 private:
65   // noncopyable
66   TreeModelSort(const TreeModelSort&);
67   TreeModelSort& operator=(const TreeModelSort&);
68
69 protected:
70   explicit TreeModelSort(const Glib::ConstructParams& construct_params);
71   explicit TreeModelSort(GtkTreeModelSort* castitem);
72
73 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
74
75 public:
76   virtual ~TreeModelSort();
77
78 #ifndef DOXYGEN_SHOULD_SKIP_THIS
79   static GType get_type()      G_GNUC_CONST;
80   static GType get_base_type() G_GNUC_CONST;
81 #endif
82
83   ///Provides access to the underlying C GObject.
84   GtkTreeModelSort*       gobj()       { return reinterpret_cast<GtkTreeModelSort*>(gobject_); }
85
86   ///Provides access to the underlying C GObject.
87   const GtkTreeModelSort* gobj() const { return reinterpret_cast<GtkTreeModelSort*>(gobject_); }
88
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();
91
92 private:
93
94   
95 protected:
96   explicit TreeModelSort(const Glib::RefPtr<TreeModel>& model);
97
98 public:
99   
100   static Glib::RefPtr<TreeModelSort> create(const Glib::RefPtr<TreeModel>& model);
101
102
103   /** Returns the model the Gtk::TreeModelSort is sorting.
104    * @return The "child model" being sorted.
105    */
106   Glib::RefPtr<TreeModel> get_model();
107   
108   /** Returns the model the Gtk::TreeModelSort is sorting.
109    * @return The "child model" being sorted.
110    */
111   Glib::RefPtr<const TreeModel> get_model() const;
112
113   
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>.
120    */
121   Path convert_child_path_to_path(const Path& child_path) const;
122
123   /** Gets an iterator that points to the sorted row that corresponds to the child row pointed at by child_iter.
124    *
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.
127    */
128   iterator convert_child_iter_to_iter(const iterator& child_iter) const;
129
130   
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>.
137    */
138   Path convert_path_to_child_path(const Path& sorted_path) const;
139
140   /** Gets an iterator that points to the child row that corresponds to the sorted row pointed at by sorted_iter.
141    *
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.
144    */
145   iterator convert_iter_to_child_iter(const iterator& sorted_iter) const;
146
147   
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.
152    */
153   void reset_default_sort_func();
154   
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.
161    */
162   void clear_cache();
163
164   
165   /** WARNING: This function is slow. Only use it for debugging and/or testing
166    * purposes.
167    * 
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.
171    * 
172    * Since: 2.2.
173    */
174   bool iter_is_valid(const iterator& iter) const;
175
176 protected:
177   virtual void set_value_impl(const iterator& row, int column, const Glib::ValueBase& value);
178
179
180 public:
181
182 public:
183   //C++ methods used to invoke GTK+ virtual functions:
184
185 protected:
186   //GTK+ Virtual Functions (override these to change behaviour):
187
188   //Default Signal Handlers::
189
190
191 };
192
193 } // namespace Gtk
194
195
196 namespace Glib
197 {
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.
202    */
203   Glib::RefPtr<Gtk::TreeModelSort> wrap(GtkTreeModelSort* object, bool take_copy = false);
204 }
205
206
207 #endif /* _GTKMM_TREEMODELSORT_H */
208