Debian Codegraph @

src/remap_widget.hpp

raw
1 /*
2 ** jstest-gtk - A graphical joystick tester
3 ** Copyright (C) 2009 Ingo Ruhnke <[email protected]>
4 **
5 ** This program is free software: you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation, either version 3 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef HEADER_JSTEST_GTK_REMAP_WIDGET_HPP
20 #define HEADER_JSTEST_GTK_REMAP_WIDGET_HPP
21
22 #include <gtkmm/box.h>
23 #include <gtkmm/liststore.h>
24 #include <gtkmm/treeview.h>
25 #include <gtkmm/treemodel.h>
26 #include <gtkmm/scrolledwindow.h>
27
28 class Joystick;
29
30 class RemapWidget : public Gtk::VBox
31 {
32 public:
33 enum Mode { REMAP_AXIS, REMAP_BUTTON };
34
35 private:
36 Joystick& joystick;
37 Mode mode;
38
39 Gtk::TreeView treeview;
40 Glib::RefPtr<Gtk::ListStore> map_list;
41 Gtk::ScrolledWindow scroll;
42
43 public:
44 RemapWidget(Joystick& joystick_, Mode mode);
45
46 void add_entry(int id, const std::string& str);
47 void on_clear();
48 void on_apply();
49 void on_my_row_inserted(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter);
50 void on_my_row_deleted(const Gtk::TreeModel::Path& path);
51 void on_my_rows_reordered(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
52
53 private:
54 RemapWidget(const RemapWidget&);
55 RemapWidget& operator=(const RemapWidget&);
56 };
57
58 #endif
59
60 /* EOF */