Debian Codegraph @

gtk/gtkmm/accelmap.cc

raw symbols SCIP
1 /* Copyright (C) 2002 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/accelmap.h>
18 #include <gtk/gtk.h>
19
20 namespace Gtk
21 {
22
23 namespace AccelMap
24 {
25
26 void add_entry(const std::string& accel_path,
27 guint accel_key,
28 Gdk::ModifierType accel_mods)
29 {
30 gtk_accel_map_add_entry(accel_path.c_str(), accel_key,
31 (GdkModifierType)accel_mods);
32 }
33
34 bool change_entry(const std::string& accel_path,
35 guint accel_key,
36 Gdk::ModifierType accel_mods,
37 bool replace)
38 {
39 return gtk_accel_map_change_entry(accel_path.c_str(), accel_key,
40 (GdkModifierType)accel_mods, replace);
41 }
42
43 void load(const std::string& filename)
44 {
45 gtk_accel_map_load(filename.c_str());
46 }
47
48 void save(const std::string& filename)
49 {
50 gtk_accel_map_save(filename.c_str());
51 }
52
53 void lock_path(const std::string& accel_path)
54 {
55 gtk_accel_map_lock_path(accel_path.c_str());
56 }
57
58 void unlock_path(const std::string& accel_path)
59 {
60 gtk_accel_map_unlock_path(accel_path.c_str());
61 }
62
63 bool lookup_entry(const Glib::ustring& accel_path, Gtk::AccelKey& key)
64 {
65 GtkAccelKey gkey = {GDK_KEY_VoidSymbol, GdkModifierType (0), 0};
66 const bool known = gtk_accel_map_lookup_entry(accel_path.c_str(), &gkey);
67
68 if(known)
69 key = AccelKey(gkey.accel_key, Gdk::ModifierType (gkey.accel_mods));
70 else
71 key = AccelKey(GDK_KEY_VoidSymbol, Gdk::ModifierType (0));
72
73 return known;
74 }
75
76 bool lookup_entry(const Glib::ustring& accel_path)
77 {
78 return gtk_accel_map_lookup_entry(accel_path.c_str(), nullptr /* "optional", according to the C docs. */);
79 }
80
81 } // namespace AccelMap
82
83 } // namespace Gtk