| 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_JOYSTICK_CALIBRATION_WIDGET_HPP |
| 20 |
#define HEADER_JOYSTICK_CALIBRATION_WIDGET_HPP |
| 21 |
|
| 22 |
#include <gtkmm/box.h> |
| 23 |
#include <gtkmm/checkbutton.h> |
| 24 |
#include <gtkmm/frame.h> |
| 25 |
#include <gtkmm/label.h> |
| 26 |
#include <gtkmm/table.h> |
| 27 |
#include <gtkmm/dialog.h> |
| 28 |
#include <gtkmm/scrolledwindow.h> |
| 29 |
|
| 30 |
#include "joystick.hpp" |
| 31 |
|
| 32 |
class JoystickCalibrationWidget : public Gtk::Dialog |
| 33 |
{ |
| 34 |
private: |
| 35 |
Joystick& joystick; |
| 36 |
|
| 37 |
Gtk::Label label; |
| 38 |
Gtk::Frame axis_frame; |
| 39 |
Gtk::Table axis_table; |
| 40 |
Gtk::HButtonBox buttonbox; |
| 41 |
Gtk::Button calibration_button; |
| 42 |
Gtk::ScrolledWindow scroll; |
| 43 |
|
| 44 |
struct CalibrationData { |
| 45 |
Gtk::CheckButton* invert; |
| 46 |
Glib::RefPtr<Gtk::Adjustment> center_min; |
| 47 |
Glib::RefPtr<Gtk::Adjustment> center_max; |
| 48 |
Glib::RefPtr<Gtk::Adjustment> range_min; |
| 49 |
Glib::RefPtr<Gtk::Adjustment> range_max; |
| 50 |
}; |
| 51 |
|
| 52 |
std::vector<CalibrationData> calibration_data; |
| 53 |
|
| 54 |
public: |
| 55 |
JoystickCalibrationWidget(Joystick& joystick); |
| 56 |
|
| 57 |
void update_with(const std::vector<Joystick::CalibrationData>& data); |
| 58 |
|
| 59 |
void on_clear(); |
| 60 |
void on_apply(); |
| 61 |
void on_response(int i) override; |
| 62 |
void on_calibrate(); |
| 63 |
|
| 64 |
private: |
| 65 |
JoystickCalibrationWidget(const JoystickCalibrationWidget&); |
| 66 |
JoystickCalibrationWidget& operator=(const JoystickCalibrationWidget&); |
| 67 |
}; |
| 68 |
|
| 69 |
#endif |
| 70 |
|
| 71 |
/* EOF */ |