Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / treestore.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_TREESTORE_H
4 #define _GTKMM_TREESTORE_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 #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>
34
35
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 typedef struct _GtkTreeStore GtkTreeStore;
38 typedef struct _GtkTreeStoreClass GtkTreeStoreClass;
39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40
41
42 namespace Gtk
43 { class TreeStore_Class; } // namespace Gtk
44 namespace Gtk
45 {
46
47 /**
48  * @ingroup TreeView
49  */
50
51 class TreeStore :
52   public Glib::Object,
53   public Gtk::TreeModel,
54   public TreeSortable,
55   public TreeDragSource,
56   public TreeDragDest
57 {
58   
59 #ifndef DOXYGEN_SHOULD_SKIP_THIS
60
61 public:
62   typedef TreeStore CppObjectType;
63   typedef TreeStore_Class CppClassType;
64   typedef GtkTreeStore BaseObjectType;
65   typedef GtkTreeStoreClass BaseClassType;
66
67 private:  friend class TreeStore_Class;
68   static CppClassType treestore_class_;
69
70 private:
71   // noncopyable
72   TreeStore(const TreeStore&);
73   TreeStore& operator=(const TreeStore&);
74
75 protected:
76   explicit TreeStore(const Glib::ConstructParams& construct_params);
77   explicit TreeStore(GtkTreeStore* castitem);
78
79 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
80
81 public:
82   virtual ~TreeStore();
83
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85   static GType get_type()      G_GNUC_CONST;
86   static GType get_base_type() G_GNUC_CONST;
87 #endif
88
89   ///Provides access to the underlying C GObject.
90   GtkTreeStore*       gobj()       { return reinterpret_cast<GtkTreeStore*>(gobject_); }
91
92   ///Provides access to the underlying C GObject.
93   const GtkTreeStore* gobj() const { return reinterpret_cast<GtkTreeStore*>(gobject_); }
94
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();
97
98 private:
99
100   
101 protected:
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.
107    */
108   TreeStore();
109   
110   explicit TreeStore(const TreeModelColumnRecord& columns);
111
112 public:
113   /** Instantiate a new TreeStore.
114    * @param columns The column types for this tree model.
115    * @result The new TreeStore.
116    */
117   
118   static Glib::RefPtr<TreeStore> create(const TreeModelColumnRecord& columns);
119
120
121   void set_column_types(const TreeModelColumnRecord& columns);
122   
123
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.
127    */
128   iterator erase(const iterator& iter);
129   
130
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().
136    *
137    * @param iter An iterator to the row before which the new row will be inserted.
138    * @result An iterator to the new row.
139    */
140   iterator insert(const iterator& iter);
141   
142
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().
147    *
148    * @param iter An iterator to the row after which the new row will be inserted.
149    * @result An iterator to the new row.
150    */
151   iterator insert_after(const iterator& iter);
152   
153
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().
157    *
158    * @result An iterator to the new row.
159    */
160   iterator prepend();
161
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().
165    *
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.
168    */
169   iterator prepend(const TreeNodeChildren& node);
170
171
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().
175    *
176    * @result An iterator to the new row.
177    */
178   iterator append();
179
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().
183    *
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.
186    */  
187   iterator append(const TreeNodeChildren& node);
188
189   
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.
192    * 
193    * Since: 2.2
194    * @param a A Gtk::TreeIter.
195    * @param b Another Gtk::TreeIter.
196    */
197   void iter_swap(const iterator& a, const iterator& b);
198
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.
204    */
205   void move(const iterator& source, const iterator& destination);
206
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.
209    */
210   void reorder(const TreeNodeChildren& node, const Glib::ArrayHandle<int>& new_order);
211
212   
213   /** Removes all rows from @a tree_store 
214    */
215   void clear();
216   
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 .
222    */
223   bool is_ancestor(const iterator& iter, const iterator& descendant) const;
224   
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 .
229    */
230   int iter_depth(const iterator& iter) const;
231
232   
233   /** WARNING: This function is slow. Only use it for debugging and/or testing
234    * purposes.
235    * 
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.
239    * 
240    * Since: 2.2.
241    */
242   bool iter_is_valid(const iterator& iter) const;
243
244 protected:
245   virtual void set_value_impl(const iterator& row, int column, const Glib::ValueBase& value);
246   
247
248 public:
249
250 public:
251   //C++ methods used to invoke GTK+ virtual functions:
252
253 protected:
254   //GTK+ Virtual Functions (override these to change behaviour):
255
256   //Default Signal Handlers::
257
258
259 };
260
261 } // namespace Gtk
262
263
264 namespace Glib
265 {
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.
270    */
271   Glib::RefPtr<Gtk::TreeStore> wrap(GtkTreeStore* object, bool take_copy = false);
272 }
273
274
275 #endif /* _GTKMM_TREESTORE_H */
276