| 1 | // SPDX-FileCopyrightText: 2009 Ingo Ruhnke <[email protected]> |
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | |
| 4 | #ifndef HEADER_JSTEST_GTK_REMAP_WIDGET_HPP |
| 5 | #define HEADER_JSTEST_GTK_REMAP_WIDGET_HPP |
| 6 | |
| 7 | #include <gtkmm/box.h> |
| 8 | #include <gtkmm/liststore.h> |
| 9 | #include <gtkmm/treeview.h> |
| 10 | #include <gtkmm/treemodel.h> |
| 11 | #include <gtkmm/scrolledwindow.h> |
| 12 | |
| 13 | class Joystick; |
| 14 | |
| 15 | class RemapWidget : public Gtk::VBox |
| 16 | { |
| 17 | public: |
| 18 | enum Mode { REMAP_AXIS, REMAP_BUTTON }; |
| 19 | |
| 20 | private: |
| 21 | Joystick& joystick; |
| 22 | Mode mode; |
| 23 | |
| 24 | Gtk::TreeView treeview; |
| 25 | Glib::RefPtr<Gtk::ListStore> map_list; |
| 26 | Gtk::ScrolledWindow scroll; |
| 27 | |
| 28 | public: |
| 29 | RemapWidget(Joystick& joystick_, Mode mode); |
| 30 | |
| 31 | void add_entry(int id, const std::string& str); |
| 32 | void on_clear(); |
| 33 | void on_apply(); |
| 34 | void on_my_row_inserted(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter); |
| 35 | void on_my_row_deleted(const Gtk::TreeModel::Path& path); |
| 36 | void on_my_rows_reordered(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order); |
| 37 | |
| 38 | private: |
| 39 | RemapWidget(const RemapWidget&); |
| 40 | RemapWidget& operator=(const RemapWidget&); |
| 41 | }; |
| 42 | |
| 43 | #endif |
| 44 | |
| 45 | /* EOF */ |