1 /* === S Y N F I G ========================================================= */
2 /*! \file inputdevice.h
3 ** \brief Template Header
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_INPUTDEVICE_H
26 #define __SYNFIG_INPUTDEVICE_H
28 /* === H E A D E R S ======================================================= */
31 #include <synfig/color.h>
32 #include <synfig/vector.h>
33 #include <synfig/distance.h>
34 #include <synfig/string.h>
37 /* === M A C R O S ========================================================= */
39 /* === T Y P E D E F S ===================================================== */
41 /* === C L A S S E S & S T R U C T S ======================================= */
49 /*! \class InputDevice inputdevice.h "synfigapp/inputdevice.h"
50 ** \brief This class provides a device independent representation the state
51 ** of an input device.
52 ** \see studio::DeviceTracker
53 ** \see synfigapp::Settings
55 ** The represenation includes both the GDK state (e.g., mode) and synfigstudio
56 ** state (e.g., outline color). An object of this class can be saved and
57 ** restored using its Settings object, provided by the settings method.
59 class InputDevice : public etl::shared_object
92 unsigned int modifiers;
95 typedef etl::handle<InputDevice> Handle;
100 synfig::String state_;
101 synfig::Color outline_color_;
102 synfig::Color fill_color_;
103 synfig::Distance bline_width_;
104 synfig::Real opacity_;
105 synfig::Color::BlendMethod blend_method_;
107 std::vector<AxisUse> axes_;
108 std::vector<DeviceKey> keys_;
110 DeviceSettings* device_settings;
113 InputDevice(const synfig::String id_, Type type_=TYPE_MOUSE);
116 const synfig::String& get_id()const { return id_; }
117 const synfig::String& get_state()const { return state_; }
118 const synfig::Color& get_outline_color()const { return outline_color_; }
119 const synfig::Color& get_fill_color()const { return fill_color_; }
120 const synfig::Distance& get_bline_width()const { return bline_width_; }
121 const synfig::Real& get_opacity()const { return opacity_; }
122 const synfig::Color::BlendMethod& get_blend_method()const { return blend_method_; }
123 Type get_type()const { return type_; }
124 Mode get_mode()const { return mode_; }
125 const std::vector<AxisUse> & get_axes()const { return axes_; }
126 const std::vector<DeviceKey> & get_keys()const { return keys_; }
128 void set_state(const synfig::String& x) { state_=x; }
129 void set_outline_color(const synfig::Color& x) { outline_color_=x; }
130 void set_fill_color(const synfig::Color& x) { fill_color_=x; }
131 void set_bline_width(const synfig::Distance& x) { bline_width_=x; }
132 void set_blend_method(const synfig::Color::BlendMethod& x) { blend_method_=x; }
133 void set_opacity(const synfig::Real& x) { opacity_=x; }
134 void set_type(Type x) { type_=x; }
135 void set_mode(Mode x) { mode_=x; }
136 void set_axes(const std::vector<AxisUse>& x) { axes_=x; }
137 void set_keys(const std::vector<DeviceKey>& x) { keys_=x; }
139 Settings& settings();
140 const Settings& settings()const;
141 }; // END of class InputDevice
143 }; // END of namespace synfigapp
145 /* === E N D =============================================================== */