00001
00021
00022
00023
00024
00025 #ifndef __SYNFIG_INPUTDEVICE_H
00026 #define __SYNFIG_INPUTDEVICE_H
00027
00028
00029
00030 #include <vector>
00031 #include <synfig/color.h>
00032 #include <synfig/vector.h>
00033 #include <synfig/distance.h>
00034 #include <synfig/string.h>
00035 #include <ETL/handle>
00036
00037
00038
00039
00040
00041
00042
00043 class DeviceSettings;
00044
00045 namespace synfigapp {
00046 class Settings;
00047
00048
00059 class InputDevice : public etl::shared_object
00060 {
00061 public:
00062 enum Type
00063 {
00064 TYPE_MOUSE,
00065 TYPE_PEN,
00066 TYPE_ERASER,
00067 TYPE_CURSOR
00068 };
00069
00070 enum Mode
00071 {
00072 MODE_DISABLED,
00073 MODE_SCREEN,
00074 MODE_WINDOW
00075 };
00076
00077 enum AxisUse
00078 {
00079 AXIS_IGNORE,
00080 AXIS_X,
00081 AXIS_Y,
00082 AXIS_PRESSURE,
00083 AXIS_XTILT,
00084 AXIS_YTILT,
00085 AXIS_WHEEL,
00086 AXIS_LAST
00087 };
00088
00089 struct DeviceKey
00090 {
00091 unsigned int keyval;
00092 unsigned int modifiers;
00093 };
00094
00095 typedef etl::handle<InputDevice> Handle;
00096
00097 private:
00098 synfig::String id_;
00099 Type type_;
00100 synfig::String state_;
00101 synfig::Color outline_color_;
00102 synfig::Color fill_color_;
00103 synfig::Distance bline_width_;
00104 synfig::Real opacity_;
00105 synfig::Color::BlendMethod blend_method_;
00106 Mode mode_;
00107 std::vector<AxisUse> axes_;
00108 std::vector<DeviceKey> keys_;
00109
00110 DeviceSettings* device_settings;
00111
00112 public:
00113 InputDevice(const synfig::String id_, Type type_=TYPE_MOUSE);
00114 ~InputDevice();
00115
00116 const synfig::String& get_id()const { return id_; }
00117 const synfig::String& get_state()const { return state_; }
00118 const synfig::Color& get_outline_color()const { return outline_color_; }
00119 const synfig::Color& get_fill_color()const { return fill_color_; }
00120 const synfig::Distance& get_bline_width()const { return bline_width_; }
00121 const synfig::Real& get_opacity()const { return opacity_; }
00122 const synfig::Color::BlendMethod& get_blend_method()const { return blend_method_; }
00123 Type get_type()const { return type_; }
00124 Mode get_mode()const { return mode_; }
00125 const std::vector<AxisUse> & get_axes()const { return axes_; }
00126 const std::vector<DeviceKey> & get_keys()const { return keys_; }
00127
00128 void set_state(const synfig::String& x) { state_=x; }
00129 void set_outline_color(const synfig::Color& x) { outline_color_=x; }
00130 void set_fill_color(const synfig::Color& x) { fill_color_=x; }
00131 void set_bline_width(const synfig::Distance& x) { bline_width_=x; }
00132 void set_blend_method(const synfig::Color::BlendMethod& x) { blend_method_=x; }
00133 void set_opacity(const synfig::Real& x) { opacity_=x; }
00134 void set_type(Type x) { type_=x; }
00135 void set_mode(Mode x) { mode_=x; }
00136 void set_axes(const std::vector<AxisUse>& x) { axes_=x; }
00137 void set_keys(const std::vector<DeviceKey>& x) { keys_=x; }
00138
00139 Settings& settings();
00140 const Settings& settings()const;
00141 };
00142
00143 };
00144
00145
00146
00147 #endif