Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / stable / src / synfigapp / inputdevice.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file inputdevice.h
3 **      \brief Template Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
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.
14 **
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.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_INPUTDEVICE_H
26 #define __SYNFIG_INPUTDEVICE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <synfig/color.h>
31 #include <synfig/vector.h>
32 #include <synfig/distance.h>
33 #include <synfig/string.h>
34 #include <ETL/handle>
35
36 /* === M A C R O S ========================================================= */
37
38 /* === T Y P E D E F S ===================================================== */
39
40 /* === C L A S S E S & S T R U C T S ======================================= */
41
42 class DeviceSettings;
43
44 namespace synfigapp {
45 class Settings;
46
47
48 class InputDevice : public etl::shared_object
49 {
50 public:
51         enum Type
52         {
53                 TYPE_MOUSE,
54                 TYPE_PEN,
55                 TYPE_ERASER,
56                 TYPE_CURSOR
57         };
58
59         typedef etl::handle<InputDevice> Handle;
60
61 private:
62         synfig::String id_;
63         Type type_;
64         synfig::String state_;
65         synfig::Color foreground_color_;
66         synfig::Color background_color_;
67         synfig::Distance        bline_width_;
68         synfig::Real opacity_;
69         synfig::Color::BlendMethod blend_method_;
70
71         DeviceSettings* device_settings;
72
73 public:
74         InputDevice(const synfig::String id_, Type type_=TYPE_MOUSE);
75         ~InputDevice();
76
77         const synfig::String& get_id()const { return id_; }
78         const synfig::String& get_state()const { return state_; }
79         const synfig::Color& get_foreground_color()const { return foreground_color_; }
80         const synfig::Color& get_background_color()const { return background_color_; }
81         const synfig::Distance& get_bline_width()const { return bline_width_; }
82         const synfig::Real& get_opacity()const { return opacity_; }
83         const synfig::Color::BlendMethod& get_blend_method()const { return blend_method_; }
84         Type get_type()const { return type_; }
85
86         void set_state(const synfig::String& x) { state_=x; }
87         void set_foreground_color(const synfig::Color& x) { foreground_color_=x; }
88         void set_background_color(const synfig::Color& x) { background_color_=x; }
89         void set_bline_width(const synfig::Distance& x) { bline_width_=x; }
90         void set_blend_method(const synfig::Color::BlendMethod& x) { blend_method_=x; }
91         void set_opacity(const synfig::Real& x) { opacity_=x; }
92         void set_type(Type x) { type_=x; }
93
94         Settings& settings();
95         const Settings& settings()const;
96 }; // END of class InputDevice
97
98 }; // END of namespace synfigapp
99
100 /* === E N D =============================================================== */
101
102 #endif