Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / targetentry.cc
1 // -*- c++ -*-
2 /* $Id$ */
3
4 /* targetentry.cc
5  *
6  * Copyright (C) 1998-2002 The gtkmm Development Team
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23 #include <gtkmm/targetentry.h>
24 #include <cstring>
25
26 namespace Gtk
27 {
28
29 TargetEntry::TargetEntry()
30 {
31   memset(&gobject_, 0, sizeof(gobject_));
32 }
33
34 TargetEntry::TargetEntry(const Glib::ustring& target, Gtk::TargetFlags flags, guint info)
35 {
36   set_target(target);
37   set_flags(flags);
38   set_info(info);
39 }
40
41 TargetEntry::TargetEntry(const GtkTargetEntry& gobject)
42 {
43   set_target(gobject.target);
44   set_info(gobject.info);
45   set_flags(TargetFlags(gobject.flags));
46 }
47
48 TargetEntry::TargetEntry(const TargetEntry& src)
49 {
50   set_target(src.get_target());
51   set_info(src.get_info());
52   set_flags(src.get_flags());
53 }
54
55 TargetEntry::~TargetEntry()
56 {
57   g_free(gobject_.target);
58 }
59
60 TargetEntry& TargetEntry::operator=(const TargetEntry& src)
61 {
62   if(&src != this)
63   {
64     set_target(src.get_target());
65     set_info(src.get_info());
66     set_flags(src.get_flags());
67   }
68
69   return *this;
70 }
71
72 Glib::ustring TargetEntry::get_target() const
73 {
74   return gobject_.target;
75 }
76
77 void TargetEntry::set_target(const Glib::ustring& target)
78 {
79   gobject_.target = g_strdup(target.c_str());
80 }
81
82 Gtk::TargetFlags TargetEntry::get_flags() const
83 {
84   return (Gtk::TargetFlags)(gobject_.flags);
85 }
86
87 void TargetEntry::set_flags(Gtk::TargetFlags flags)
88 {
89   gobject_.flags = (guint)(flags);
90 }
91
92 guint TargetEntry::get_info() const
93 {
94   return gobject_.info;
95 }
96
97 void TargetEntry::set_info(guint info)
98 {
99   gobject_.info = info;
100 }
101
102 GtkTargetEntry* TargetEntry::gobj()
103 {
104   return &gobject_;
105 }
106
107 const GtkTargetEntry* TargetEntry::gobj() const
108 {
109   return &gobject_;
110 }
111
112 } /* namespace Gtk */
113