2 Copyright (C) 2001 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_keyboard_target_h__
22 #define __ardour_keyboard_target_h__
26 #include <sigc++/signal.h>
27 #include <sigc++/slot.h>
29 #include <pbd/xml++.h>
40 KeyboardTarget(Gtk::Window& w, std::string name);
41 virtual ~KeyboardTarget();
43 sigc::signal<void> Hiding;
44 sigc::signal<void> GoingAway;
46 typedef sigc::slot<void> KeyAction;
48 std::string name() const { return _name; }
50 void key_press_event (GdkEventKey *, Keyboard::State&, bool& handled);
51 void key_release_event (GdkEventKey *, Keyboard::State&);
53 int add_binding (std::string keys, std::string name);
54 std::string get_binding (std::string name); /* returns keys bound to name */
56 XMLNode& get_binding_state () const;
57 int set_binding_state (const XMLNode&);
59 static int32_t add_action (std::string, KeyAction);
60 static int32_t find_action (std::string, KeyAction&);
61 static int32_t remove_action (std::string);
62 static void show_all_actions();
64 Gtk::Window& window() const { return _window; }
67 typedef std::map<Keyboard::State,KeyAction> KeyMap;
68 typedef std::map<std::string,std::string> BindingMap;
74 typedef map<std::string,KeyAction> ActionMap;
75 static ActionMap actions;
79 int load_bindings (const XMLNode&);
82 #endif /* __ardour_keyboard_target_h__ */