Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / accelkey.cc
1 // -*- c++ -*-
2 /* $Id$ */
3
4 /* 
5  *
6  * Copyright 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/accelkey.h>
24 #include <gtkmm/accelgroup.h>
25
26 namespace Gtk
27 {
28
29 AccelKey::AccelKey()
30 : key_(GDK_VoidSymbol),
31   mod_((Gdk::ModifierType)0)
32 {
33 }
34
35 AccelKey::AccelKey(guint accel_key, Gdk::ModifierType accel_mods,
36                    const Glib::ustring& accel_path)
37 : key_(accel_key),
38   mod_(accel_mods),
39   path_(accel_path)
40 {
41 }
42
43 AccelKey::AccelKey(const Glib::ustring& accelerator, const Glib::ustring& accel_path)
44 : path_(accel_path)
45 {
46   //Get the key and mod by parsing the accelerator string:
47   AccelGroup::parse (accelerator, key_, mod_);
48 }
49
50 AccelKey::AccelKey(const AccelKey& src)
51 {
52   key_ = src.key_;
53   mod_ = src.mod_;
54   path_ = src.path_;
55 }
56
57 AccelKey& AccelKey::operator=(const AccelKey& src)
58 {
59   key_ = src.key_;
60   mod_ = src.mod_;
61   path_ = src.path_;
62
63   return *this;
64 }
65
66 guint AccelKey::get_key() const
67 {
68   return key_;
69 }
70
71 Gdk::ModifierType AccelKey::get_mod() const
72 {
73   return mod_;
74 }
75
76 Glib::ustring AccelKey::get_path() const
77 {
78   return path_;
79 }
80
81 bool AccelKey::is_null() const
82 {
83   return ( (key_ == GDK_VoidSymbol) || !(get_key() > 0) ); //both seem to be invalid.
84 }
85
86 Glib::ustring AccelKey::get_abbrev() const
87 {
88   return AccelGroup::name (key_, mod_);
89 }
90
91
92 } // namespace
93