Ardour  9.0-pre0-350-gf17a656217
treepath.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
3 #ifndef _GTKMM_TREEPATH_H
4 #define _GTKMM_TREEPATH_H
5 
6 #include <gtkmmconfig.h>
7 
8 
9 #include <glibmm/ustring.h>
10 #include <sigc++/sigc++.h>
11 
12 /* $Id: treepath.hg,v 1.15 2006/02/25 12:38:11 murrayc Exp $ */
13 
14 /* Copyright(C) 1998-2002 The gtkmm Development Team
15  *
16  * This library is free software, ) you can redistribute it and/or
17  * modify it under the terms of the GNU Lesser General Public
18  * License as published by the Free Software Foundation, ) either
19  * version 2.1 of the License, or(at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY, ) without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  * Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public
27  * License along with this library, ) if not, write to the Free
28  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29  */
30 
31 // This is for including the config header before any code (such as
32 // the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
33 
34 
35 #include <gtkmm/selectiondata.h>
36 #include <gtkmm/treemodel.h>
37 
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 extern "C" { typedef struct _GtkTreePath GtkTreePath; }
40 #endif
41 
42 namespace Gtk
43 {
44 
56 class TreePath
57 {
58  public:
59 #ifndef DOXYGEN_SHOULD_SKIP_THIS
60  typedef TreePath CppObjectType;
61  typedef GtkTreePath BaseObjectType;
62 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
63 
66  static GType get_type() G_GNUC_CONST;
67 
69 
70  explicit TreePath(GtkTreePath* gobject, bool make_a_copy = true);
71 
72  TreePath(const TreePath& other);
73  TreePath& operator=(const TreePath& other);
74 
76 
77  void swap(TreePath& other);
78 
80  GtkTreePath* gobj() { return gobject_; }
81 
83  const GtkTreePath* gobj() const { return gobject_; }
84 
87 
88 protected:
90 
91 private:
92 
93 
94 public:
95  typedef unsigned int size_type;
96  typedef int difference_type;
97 
98  typedef int value_type;
99  typedef int& reference;
100  typedef const int& const_reference;
101 
102  // Use plain pointers for simplicity.
103  typedef int* iterator;
104  typedef const int* const_iterator;
105 
106 #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
107 
108  typedef std::reverse_iterator<iterator> reverse_iterator;
109  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
110 
111 #else
112 
113  typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
114  int, int&, int*, ptrdiff_t> reverse_iterator;
115 
116  typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
117  int, const int&, const int*, ptrdiff_t> const_reverse_iterator;
118 
119 #endif /* GLIBMM_HAVE_SUN_REVERSE_ITERATOR */
120 
121  explicit TreePath(size_type n, value_type value = 0);
122  explicit TreePath(const Glib::ustring& path);
123  explicit TreePath(const TreeModel::iterator& iter);
124 
125  template <class In> inline TreePath(In pbegin, In pend);
126 
127  void clear();
128 
129  // I think it's OK for this assignment to be implicit. It's very useful.
131 
134  operator bool() const;
135 
136  template <class In> inline void assign(In pbegin, In pend);
137  template <class In> void append(In pbegin, In pend);
138 
139 
145  void push_back(int index);
146 
152  void push_front(int index);
153 
154  size_type size() const;
155  bool empty() const;
156 
159 
164 
165  // Note: there is no advantage in not inlining these methods.
166  // We can't change them without breaking ABI anyway.
171 
172  reference front() { return *begin(); }
173  const_reference front() const { return *begin(); }
174  reference back() { return *rbegin(); }
175  const_reference back() const { return *rbegin(); }
176 
177 
180  void next();
181 
187  bool prev();
188 
193  bool up();
194 
197  void down();
198 
199 
205  bool is_ancestor(const TreePath& descendant) const;
206 
212  bool is_descendant(const TreePath& ancestor) const;
213 
214 
220  Glib::ustring to_string() const;
221 
222 
223 #ifndef GTKMM_DISABLE_DEPRECATED
224 
232  void append_index(int index);
233 #endif // GTKMM_DISABLE_DEPRECATED
234 
235 
236 #ifndef GTKMM_DISABLE_DEPRECATED
237 
245  void prepend_index(int index);
246 #endif // GTKMM_DISABLE_DEPRECATED
247 
248 
249 #ifndef GTKMM_DISABLE_DEPRECATED
250 
257  int get_depth() const;
258 #endif // GTKMM_DISABLE_DEPRECATED
259 
260 
261 #ifndef GTKMM_DISABLE_DEPRECATED
262 
264  Glib::ArrayHandle<int> get_indices() const;
265 #endif // GTKMM_DISABLE_DEPRECATED
266 
267 
285  static bool get_from_selection_data(const SelectionData& selection_data, Glib::RefPtr<TreeModel>& model, TreePath& path);
286  //TODO: Add an override that takes a const TreeModel (and deprecate the current version).
287 
289  static bool get_from_selection_data(const SelectionData& selection_data, TreePath& path);
290 
300  bool set_in_selection_data(SelectionData& selection_data, const Glib::RefPtr<const TreeModel>& model) const;
301 
302 
303 };
304 
305 #ifndef DOXYGEN_SHOULD_SKIP_THIS
306 
307 template <class In>
308 void TreePath::append(In pbegin, In pend)
309 {
310  // push_back() can't throw -- if it could, this code wouldn't be strongly exception-safe.
311  for(; pbegin != pend; ++pbegin)
312  this->push_back(*pbegin);
313 }
314 
315 template <class In> inline
316 TreePath::TreePath(In pbegin, In pend)
317 {
318  this->append(pbegin, pend);
319 }
320 
321 template <class In> inline
322 void TreePath::assign(In pbegin, In pend)
323 {
324  TreePath temp (pbegin, pend);
325  this->swap(temp);
326 }
327 
328 
329 /* Traits for use of TreePath in a Glib::ListHandle<>.
330  */
331 struct TreePath_Traits
332 {
333  typedef TreePath CppType;
334  typedef const GtkTreePath* CType;
335  typedef GtkTreePath* CTypeNonConst;
336 
337  static CType to_c_type(const CppType& item)
338  { return item.gobj(); }
339 
340  static CType to_c_type(CType item)
341  { return item; }
342 
343  static CppType to_cpp_type(CType item)
344  { return CppType(const_cast<CTypeNonConst>(item)); }
345 
346  static void release_c_type(CType item)
347  { gtk_tree_path_free(const_cast<CTypeNonConst>(item)); }
348 };
349 
350 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
351 
352 
353 } // namespace Gtk
354 
355 
356 namespace Gtk
357 {
358 
364 bool operator==(const TreePath& lhs, const TreePath& rhs);
365 
371 bool operator!=(const TreePath& lhs, const TreePath& rhs);
372 
378 bool operator<(const TreePath& lhs, const TreePath& rhs);
379 
385 bool operator>(const TreePath& lhs, const TreePath& rhs);
386 
392 bool operator<=(const TreePath& lhs, const TreePath& rhs);
393 
399 bool operator>=(const TreePath& lhs, const TreePath& rhs);
400 
401 
402 } // namespace Gtk
403 
404 
405 namespace Gtk
406 {
407 
412 inline void swap(TreePath& lhs, TreePath& rhs)
413  { lhs.swap(rhs); }
414 
415 } // namespace Gtk
416 
417 namespace Glib
418 {
419 
428 Gtk::TreePath wrap(GtkTreePath* object, bool take_copy = false);
429 
430 #ifndef DOXYGEN_SHOULD_SKIP_THIS
431 template <>
432 class Value<Gtk::TreePath> : public Glib::Value_Boxed<Gtk::TreePath>
433 {};
434 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
435 
436 } // namespace Glib
437 
438 
439 #endif /* _GTKMM_TREEPATH_H */
440 
bool is_ancestor(const TreePath &descendant) const
TreePath & operator=(const TreeModel::iterator &iter)
bool empty() const
reverse_iterator rbegin()
Definition: treepath.h:167
static bool get_from_selection_data(const SelectionData &selection_data, Glib::RefPtr< TreeModel > &model, TreePath &path)
bool operator!=(const TreePath &lhs, const TreePath &rhs)
void push_back(int index)
TreePath(const TreeModel::iterator &iter)
Gtk::TreePath wrap(GtkTreePath *object, bool take_copy=false)
size_type size() const
int * iterator
Definition: treepath.h:103
int get_depth() const
GtkTreePath * gobj_copy() const
Provides access to the underlying C instance. The caller is responsible for freeing it....
static bool get_from_selection_data(const SelectionData &selection_data, TreePath &path)
See description in the other overload.
void assign(In pbegin, In pend)
const_reverse_iterator rbegin() const
Definition: treepath.h:169
bool is_descendant(const TreePath &ancestor) const
iterator begin()
void prepend_index(int index)
void swap(TreePath &other)
bool operator>=(const TreePath &lhs, const TreePath &rhs)
iterator end()
GtkTreePath * gobj()
Provides access to the underlying C instance.
Definition: treepath.h:80
const GtkTreePath * gobj() const
Provides access to the underlying C instance.
Definition: treepath.h:83
const_reverse_iterator rend() const
Definition: treepath.h:170
int difference_type
Definition: treepath.h:96
reference front()
Definition: treepath.h:172
int & reference
Definition: treepath.h:99
bool operator<(const TreePath &lhs, const TreePath &rhs)
bool operator>(const TreePath &lhs, const TreePath &rhs)
const int & const_reference
Definition: treepath.h:100
unsigned int size_type
Definition: treepath.h:95
void push_front(int index)
TreePath(size_type n, value_type value=0)
Glib::ArrayHandle< int > get_indices() const
Glib::ustring to_string() const
TreePath(In pbegin, In pend)
bool set_in_selection_data(SelectionData &selection_data, const Glib::RefPtr< const TreeModel > &model) const
bool operator==(const TreePath &lhs, const TreePath &rhs)
reverse_iterator rend()
Definition: treepath.h:168
const_reference front() const
Definition: treepath.h:173
TreePath(const Glib::ustring &path)
const_reference back() const
Definition: treepath.h:175
reference operator[](size_type i)
static GType get_type() G_GNUC_CONST
const_iterator begin() const
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: treepath.h:109
void append(In pbegin, In pend)
int value_type
Definition: treepath.h:98
void append_index(int index)
const_reference operator[](size_type i) const
bool operator<=(const TreePath &lhs, const TreePath &rhs)
reference back()
Definition: treepath.h:174
const_iterator end() const
GtkTreePath * gobject_
Definition: treepath.h:89
const int * const_iterator
Definition: treepath.h:104
std::reverse_iterator< iterator > reverse_iterator
Definition: treepath.h:108
void swap(TreePath &lhs, TreePath &rhs)
Definition: treepath.h:412
struct _GtkTreePath GtkTreePath
Definition: gtktreemodel.h:44
void gtk_tree_path_free(GtkTreePath *path)
Definition: ardour_ui.h:187
Definition: lobject.h:100