| 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_MAIN_HPP |
| 20 |
#define HEADER_JSTEST_GTK_MAIN_HPP |
| 21 |
|
| 22 |
#include <vector> |
| 23 |
#include <gtkmm.h> |
| 24 |
#include <map> |
| 25 |
|
| 26 |
class Joystick; |
| 27 |
class JoystickListWidget; |
| 28 |
class JoystickTestWidget; |
| 29 |
class JoystickMapWidget; |
| 30 |
class JoystickCalibrationWidget; |
| 31 |
|
| 32 |
class JoystickGui |
| 33 |
{ |
| 34 |
private: |
| 35 |
std::unique_ptr<Joystick> m_joystick; |
| 36 |
std::unique_ptr<JoystickTestWidget> m_test_widget; |
| 37 |
std::unique_ptr<JoystickMapWidget> m_mapping_widget; |
| 38 |
std::unique_ptr<JoystickCalibrationWidget> m_calibration_widget; |
| 39 |
|
| 40 |
public: |
| 41 |
JoystickGui(std::unique_ptr<Joystick> joystick, |
| 42 |
bool simple_ui, |
| 43 |
Gtk::Window* parent = nullptr); |
| 44 |
|
| 45 |
JoystickTestWidget* get_test_widget() const { return m_test_widget.get(); } |
| 46 |
|
| 47 |
void show_calibration_dialog(); |
| 48 |
void show_mapping_dialog(); |
| 49 |
}; |
| 50 |
|
| 51 |
|
| 52 |
class Main : public Gtk::Application |
| 53 |
{ |
| 54 |
private: |
| 55 |
static Main* current_; |
| 56 |
public: |
| 57 |
static Main* current() { return current_; } |
| 58 |
|
| 59 |
private: |
| 60 |
std::string datadir; |
| 61 |
bool m_simple_ui; |
| 62 |
|
| 63 |
std::map<std::string, std::unique_ptr<JoystickGui> > m_joystick_guis; |
| 64 |
|
| 65 |
public: |
| 66 |
Main(); |
| 67 |
~Main(); |
| 68 |
|
| 69 |
JoystickTestWidget* show_device_property_dialog(const std::string& filename, Gtk::Window* parent = nullptr); |
| 70 |
|
| 71 |
static Glib::RefPtr<Main> create(); |
| 72 |
|
| 73 |
int run(int argc, char** argv) /* override only since gtkmm 3.4 ! */; |
| 74 |
|
| 75 |
std::string get_data_directory() const { return datadir; } |
| 76 |
}; |
| 77 |
|
| 78 |
#endif |
| 79 |
|
| 80 |
/* EOF */ |