Debian Codegraph @

src/joystick_test_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_JOYSTICK_TEST_WIDGET_HPP
20 #define HEADER_JSTEST_GTK_JOYSTICK_TEST_WIDGET_HPP
21
22 #include <gtkmm/box.h>
23 #include <gtkmm/label.h>
24 #include <gtkmm/frame.h>
25 #include <gtkmm/progressbar.h>
26 #include <gtkmm/table.h>
27 #include <gtkmm/buttonbox.h>
28 #include <gtkmm/button.h>
29 #include <gtkmm/dialog.h>
30 #include <gtkmm/alignment.h>
31 #include <gtkmm/comboboxtext.h>
32 #include <gtkmm/toolbutton.h>
33 #include <gtkmm/liststore.h>
34
35 #include "throttle_widget.hpp"
36 #include "rudder_widget.hpp"
37 #include "axis_widget.hpp"
38
39 class Joystick;
40 class JoystickGui;
41 class ButtonWidget;
42
43 class JoystickTestWidget : public Gtk::Window
44 {
45 private:
46 JoystickGui& m_gui;
47 Joystick& joystick;
48 bool m_simple_ui;
49
50 Gtk::VBox m_vbox;
51 Gtk::Alignment alignment;
52 Gtk::Label label;
53
54 Gtk::Frame axis_frame;
55 Gtk::VBox axis_vbox;
56 Gtk::Frame button_frame;
57 Gtk::Table axis_table;
58 Gtk::Table button_table;
59 Gtk::HBox test_hbox;
60 Gtk::HBox stick_hbox;
61
62 Gtk::Button mapping_button;
63 Gtk::Button calibration_button;
64 Gtk::Button close_button;
65 Gtk::HButtonBox buttonbox;
66
67 AxisWidget stick1_widget;
68 AxisWidget stick2_widget;
69 AxisWidget stick3_widget;
70
71 RudderWidget rudder_widget;
72 ThrottleWidget throttle_widget;
73
74 ThrottleWidget left_trigger_widget;
75 ThrottleWidget right_trigger_widget;
76
77 std::vector<Gtk::ProgressBar*> axes;
78 std::vector<ButtonWidget*> buttons;
79
80 Glib::RefPtr<Gdk::Pixbuf> button_on;
81 Glib::RefPtr<Gdk::Pixbuf> button_off;
82
83 std::vector<sigc::signal<void, double> > axis_callbacks;
84
85 public:
86 JoystickTestWidget(JoystickGui& gui, Joystick& joystick, bool simple_ui);
87
88 void axis_move(int number, int value);
89 void button_move(int number, bool value);
90
91 void on_calibrate();
92 void on_mapping();
93
94 private:
95 JoystickTestWidget(const JoystickTestWidget&);
96 JoystickTestWidget& operator=(const JoystickTestWidget&);
97 };
98
99 #endif
100
101 /* EOF */