Only use ArdourDialog (and thus Gtk::Dialog) for actual dialogs.
[ardour.git] / gtk2_ardour / keyeditor.h
1 #ifndef __ardour_gtk_key_editor_h__
2 #define __ardour_gtk_key_editor_h__
3
4 #include <string>
5
6 #include <gtkmm/buttonbox.h>
7 #include <gtkmm/treeview.h>
8 #include <gtkmm/treestore.h>
9 #include <gtkmm/scrolledwindow.h>
10
11 #include "ardour_window.h"
12
13 class KeyEditor : public ArdourWindow
14 {
15   public:
16         KeyEditor ();
17
18   protected:
19         void on_show ();
20         void on_unmap ();
21         bool on_key_press_event (GdkEventKey*);
22         bool on_key_release_event (GdkEventKey*);
23
24   private:
25         struct KeyEditorColumns : public Gtk::TreeModel::ColumnRecord {
26             KeyEditorColumns () {
27                     add (action);
28                     add (binding);
29                     add (path);
30                     add (bindable);
31             }
32             Gtk::TreeModelColumn<std::string> action;
33             Gtk::TreeModelColumn<std::string> binding;
34             Gtk::TreeModelColumn<std::string> path;
35             Gtk::TreeModelColumn<bool> bindable;
36         };
37
38         Gtk::ScrolledWindow scroller;
39         Gtk::TreeView view;
40         Glib::RefPtr<Gtk::TreeStore> model;
41         KeyEditorColumns columns;
42         Gtk::Button unbind_button;
43         Gtk::HButtonBox unbind_box;
44
45         void unbind ();
46
47         bool can_bind;
48         guint last_state;
49
50         void action_selected ();
51         void populate ();
52 };
53
54 #endif /* __ardour_gtk_key_editor_h__ */