add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / treerowreference.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/treerowreference.h>
5 #include <gtkmm/private/treerowreference_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* Copyright (C) 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 <gtk/gtktreemodel.h>
28
29
30 namespace Gtk
31 {
32
33 TreeRowReference::TreeRowReference(const Glib::RefPtr<TreeModel>& model, const TreeModel::Path& path)
34 :
35   gobject_ ( gtk_tree_row_reference_new(model->gobj(), const_cast<GtkTreePath*>(path.gobj())) )
36 {}
37
38 TreeRowReference::operator bool() const
39 {
40   return is_valid();
41 }
42
43 } // namespace Gtk
44
45
46 namespace
47 {
48 } // anonymous namespace
49
50
51 namespace Glib
52 {
53
54 Gtk::TreeRowReference wrap(GtkTreeRowReference* object, bool take_copy)
55 {
56   return Gtk::TreeRowReference(object, take_copy);
57 }
58
59 } // namespace Glib
60
61
62 namespace Gtk
63 {
64
65
66 // static
67 GType TreeRowReference::get_type()
68 {
69   return gtk_tree_row_reference_get_type();
70 }
71
72 TreeRowReference::TreeRowReference()
73 :
74   gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
75 {}
76
77 TreeRowReference::TreeRowReference(const TreeRowReference& other)
78 :
79   gobject_ ((other.gobject_) ? gtk_tree_row_reference_copy(other.gobject_) : 0)
80 {}
81
82 TreeRowReference::TreeRowReference(GtkTreeRowReference* gobject, bool make_a_copy)
83 :
84   // For BoxedType wrappers, make_a_copy is true by default.  The static
85   // BoxedType wrappers must always take a copy, thus make_a_copy = true
86   // ensures identical behaviour if the default argument is used.
87   gobject_ ((make_a_copy && gobject) ? gtk_tree_row_reference_copy(gobject) : gobject)
88 {}
89
90 TreeRowReference& TreeRowReference::operator=(const TreeRowReference& other)
91 {
92   TreeRowReference temp (other);
93   swap(temp);
94   return *this;
95 }
96
97 TreeRowReference::~TreeRowReference()
98 {
99   if(gobject_)
100     gtk_tree_row_reference_free(gobject_);
101 }
102
103 void TreeRowReference::swap(TreeRowReference& other)
104 {
105   GtkTreeRowReference *const temp = gobject_;
106   gobject_ = other.gobject_;
107   other.gobject_ = temp;
108 }
109
110 GtkTreeRowReference* TreeRowReference::gobj_copy() const
111 {
112   return gtk_tree_row_reference_copy(gobject_);
113 }
114
115
116 TreeModel::Path TreeRowReference::get_path() const
117 {
118   return Gtk::TreePath(gtk_tree_row_reference_get_path(const_cast<GtkTreeRowReference*>(gobj())), false);
119 }
120
121 Glib::RefPtr<TreeModel> TreeRowReference::get_model()
122 {
123   return Glib::wrap(gtk_tree_row_reference_get_model(gobj()));
124 }
125
126 Glib::RefPtr<const TreeModel> TreeRowReference::get_model() const
127 {
128   return const_cast<TreeRowReference*>(this)->get_model();
129 }
130
131 bool TreeRowReference::is_valid() const
132 {
133   return gtk_tree_row_reference_valid(const_cast<GtkTreeRowReference*>(gobj()));
134 }
135
136
137 } // namespace Gtk
138
139