2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TREESORTABLE_H
4 #define _GTKMM_TREESORTABLE_H
11 /* Copyright (C) 1998-2002 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <glibmm/interface.h>
29 #include <gtkmm/enums.h>
30 #include <gtkmm/treemodelcolumn.h>
31 #include <gtkmm/treemodel.h>
32 #include <gtkmm/treeiter.h>
33 #include <gtk/gtktreesortable.h>
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 typedef struct _GtkTreeSortable GtkTreeSortable;
38 typedef struct _GtkTreeSortableClass GtkTreeSortableClass;
39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
43 { class TreeSortable_Class; } // namespace Gtk
51 class TreeSortable : public Glib::Interface
54 #ifndef DOXYGEN_SHOULD_SKIP_THIS
57 typedef TreeSortable CppObjectType;
58 typedef TreeSortable_Class CppClassType;
59 typedef GtkTreeSortable BaseObjectType;
60 typedef GtkTreeSortableIface BaseClassType;
63 friend class TreeSortable_Class;
64 static CppClassType treesortable_class_;
67 TreeSortable(const TreeSortable&);
68 TreeSortable& operator=(const TreeSortable&);
71 TreeSortable(); // you must derive from this class
72 explicit TreeSortable(GtkTreeSortable* castitem);
74 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
77 virtual ~TreeSortable();
79 static void add_interface(GType gtype_implementer);
81 #ifndef DOXYGEN_SHOULD_SKIP_THIS
82 static GType get_type() G_GNUC_CONST;
83 static GType get_base_type() G_GNUC_CONST;
86 ///Provides access to the underlying C GObject.
87 GtkTreeSortable* gobj() { return reinterpret_cast<GtkTreeSortable*>(gobject_); }
89 ///Provides access to the underlying C GObject.
90 const GtkTreeSortable* gobj() const { return reinterpret_cast<GtkTreeSortable*>(gobject_); }
99 /// See set_default_sort_func() and set_sort_column().
100 DEFAULT_SORT_COLUMN_ID = -1,
101 DEFAULT_UNSORTED_COLUMN_ID = -2
102 }; //See GTK+ implementation.
105 /** Fills in @a sort_column_id and @a order with the current sort column and the
106 * order. It returns <tt>true</tt> unless the @a sort_column_id is
107 * Gtk::TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or
108 * Gtk::TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.
109 * @param sort_column_id The sort column id to be filled in.
110 * @param order The Gtk::SortType to be filled in.
111 * @return <tt>true</tt> if the sort column is not one of the special sort
114 bool get_sort_column_id(int& sort_column_id, SortType& order) const;
117 /** Sets the current sort column to be @a sort_column_id . The @a sortable will
118 * resort itself to reflect this change, after emitting a
119 * GtkTreeSortable::sort_column_changed signal. If @a sort_column_id is
120 * Gtk::TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the default sort function
121 * will be used, if it is set.
122 * @param sort_column_id The sort column id to set.
123 * @param order The sort order of the column.
125 void set_sort_column(const TreeModelColumnBase& sort_column_id, SortType order);
127 /** Sets the current sort column to be @a sort_column_id . The @a sortable will
128 * resort itself to reflect this change, after emitting a
129 * GtkTreeSortable::sort_column_changed signal. If @a sort_column_id is
130 * Gtk::TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the default sort function
131 * will be used, if it is set.
132 * @param sort_column_id The sort column id to set.
133 * @param order The sort order of the column.
135 void set_sort_column(int sort_column_id, SortType order);
137 #ifndef GTKMM_DISABLE_DEPRECATED
138 /** @deprecated Use set_sort_column() instead.
140 void set_sort_column_id(const TreeModelColumnBase& sort_column_id, SortType order);
142 /** @deprecated Use set_sort_column() instead.
144 void set_sort_column_id(int sort_column_id, SortType order);
145 #endif //GTKMM_DISABLE_DEPRECATED
147 /** This callback should return -1 if b compares before a, 0 if they compare equal, 1 if a compares after b.
148 * For instance, int on_sort_compare(const Gtk::TreeModel::iterator& a, const Gtk::TreeModel::iterator& b);
150 typedef sigc::slot<int, const Gtk::TreeModel::iterator&, const Gtk::TreeModel::iterator&> SlotCompare;
153 /** Sets the comparison function used when sorting a certain column.
154 * If the current sort column is the same as @a sort_column, then the model will sort using this function.
155 * @param sort_column the sort column to set the function for
156 * @param slot The sorting slot callback.
158 void set_sort_func(const TreeModelColumnBase& sort_column, const SlotCompare& slot);
160 /** Sets the comparison function used when sorting a certain column.
161 * If the current sort column id is the same as @a sort_column_id, then the model will sort using this function.
162 * @param sort_column_id the sort column id to set the function for
163 * @param slot The sorting slot callback.
165 void set_sort_func(int sort_column_id, const SlotCompare& slot);
167 /** Sets the default comparison function used when sorting.
168 * If the current sort column id of sortable is DEFAULT_SORT_COLUMN_ID, then the model will
169 * sort using this function. See also unset_default_sort_func().
171 * @param slot The sorting function
173 void set_default_sort_func(const SlotCompare& slot);
175 /** Sets the default comparison function used when sorting. See set_default_sort_func().
177 * After calling this method there will be no default comparison function. This means that once the model has been sorted,
178 * it can't go back to the default state. In this case, when the current sort column id of sortable is
179 * DEFAULT_SORT_COLUMN_ID, the model will be unsorted.
181 void unset_default_sort_func();
184 /** Returns <tt>true</tt> if the model has a default sort function. This is used
185 * primarily by GtkTreeViewColumns in order to determine if a model can go back
186 * to the default state, or not.
187 * @return <tt>true</tt>, if the model has a default sort function.
189 bool has_default_sort_func() const;
192 /** Emits a GtkTreeSortable::sort_column_changed signal on
194 void sort_column_changed();
197 Glib::SignalProxy0< void > signal_sort_column_changed();
201 virtual bool get_sort_column_id_vfunc(int* sort_column_id, SortType* order) const;
202 virtual void set_sort_column_id_vfunc(int sort_column_id, SortType order);
203 virtual void set_sort_func_vfunc(int sort_column_id, GtkTreeIterCompareFunc func, void* data, GtkDestroyNotify destroy);
204 virtual void set_default_sort_func_vfunc(GtkTreeIterCompareFunc func, void* data, GtkDestroyNotify destroy);
205 virtual bool has_default_sort_func_vfunc() const;
206 virtual void sort_column_changed_vfunc() const;
212 //C++ methods used to invoke GTK+ virtual functions:
215 //GTK+ Virtual Functions (override these to change behaviour):
217 //Default Signal Handlers::
218 virtual void on_sort_column_changed();
228 /** @relates Gtk::TreeSortable
229 * @param object The C instance
230 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
231 * @result A C++ instance that wraps this C instance.
233 Glib::RefPtr<Gtk::TreeSortable> wrap(GtkTreeSortable* object, bool take_copy = false);
237 #endif /* _GTKMM_TREESORTABLE_H */