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>
28 #include <gtkmm/window.h>
29 #include <pbd/xml++.h>
39 KeyboardTarget(Gtk::Window& w, string name);
40 virtual ~KeyboardTarget();
42 sigc::signal<void> Hiding;
43 sigc::signal<void> GoingAway;
45 typedef sigc::slot<void> KeyAction;
47 string name() const { return _name; }
49 void key_press_event (GdkEventKey *, Keyboard::State&, bool& handled);
50 void key_release_event (GdkEventKey *, Keyboard::State&);
52 int add_binding (string keys, string name);
53 string get_binding (string name); /* returns keys bound to name */
55 XMLNode& get_binding_state () const;
56 int set_binding_state (const XMLNode&);
58 static int32_t add_action (string, KeyAction);
59 static int32_t find_action (string, KeyAction&);
60 static int32_t remove_action (string);
61 static void show_all_actions();
63 Gtk::Window& window() const { return _window; }
66 typedef map<Keyboard::State,KeyAction> KeyMap;
67 typedef map<string,string> BindingMap;
73 typedef map<string,KeyAction> ActionMap;
74 static ActionMap actions;
78 int load_bindings (const XMLNode&);
81 #endif /* __ardour_keyboard_target_h__ */