4 /* Copyright (C) 2002 The gtkmm Development Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <gtkmm/accelmap.h>
22 #include <gtk/gtkaccelmap.h>
30 void add_entry(const std::string& accel_path,
32 Gdk::ModifierType accel_mods)
34 gtk_accel_map_add_entry(accel_path.c_str(), accel_key,
35 (GdkModifierType)accel_mods);
38 bool change_entry(const std::string& accel_path,
40 Gdk::ModifierType accel_mods,
43 return gtk_accel_map_change_entry(accel_path.c_str(), accel_key,
44 (GdkModifierType)accel_mods, replace);
47 void load(const std::string& filename)
49 gtk_accel_map_load(filename.c_str());
52 void save(const std::string& filename)
54 gtk_accel_map_save(filename.c_str());
57 void lock_path(const std::string& accel_path)
59 gtk_accel_map_lock_path(accel_path.c_str());
62 void unlock_path(const std::string& accel_path)
64 gtk_accel_map_unlock_path(accel_path.c_str());
67 bool lookup_entry(const Glib::ustring& accel_path, Gtk::AccelKey& key)
69 GtkAccelKey gkey = {GDK_VoidSymbol, GdkModifierType (0), 0};
70 const bool known = gtk_accel_map_lookup_entry(accel_path.c_str(), &gkey);
73 key = AccelKey(gkey.accel_key, Gdk::ModifierType (gkey.accel_mods));
75 key = AccelKey(GDK_VoidSymbol, Gdk::ModifierType (0));
80 bool lookup_entry(const Glib::ustring& accel_path)
82 return gtk_accel_map_lookup_entry(accel_path.c_str(), 0 /* "optional", according to the C docs. */);
85 } // namespace AccelMap