Enable tooltips and allow use the 'hint' descriptor for some types for the linkable...
[synfig.git] / synfig-studio / src / gui / widgets / widget_value.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file widgets/widget_value.h
3 **      \brief Template File
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_GTKMM_VALUE_H
26 #define __SYNFIG_GTKMM_VALUE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 //#include <gtk/gtk.h>
31 //#include <gtkmm/ruler.h>
32 //#include <gtkmm/arrow.h>
33 //#include <gtkmm/image.h>
34 //#include <gdkmm/pixbufloader.h>
35 //#include <gtkmm/viewport.h>
36 #include <gtkmm/adjustment.h>
37 //#include <gtkmm/scrolledwindow.h>
38 #include <gtkmm/table.h>
39 //#include <gtkmm/statusbar.h>
40 #include <gtkmm/button.h>
41 #include <gtkmm/label.h>
42 //#include <gtkmm/paned.h>
43 //#include <gtkmm/treeview.h>
44 //#include <gtkmm/treestore.h>
45 #include <gtkmm/box.h>
46 #include <gtkmm/spinbutton.h>
47 //#include <gtkmm/cellrenderer/cellrenderer.h>
48 #include <gtkmm/checkbutton.h>
49
50 //#include <gtkmm/colorselection.h>
51 #include <gtkmm/optionmenu.h>
52
53 //#include <synfig/synfig.h>
54 #include <synfig/paramdesc.h>
55 #include <synfig/value.h>
56 #include <synfig/canvas.h>
57
58
59 /* === M A C R O S ========================================================= */
60
61 /* === T Y P E D E F S ===================================================== */
62
63 /* === C L A S S E S & S T R U C T S ======================================= */
64
65 namespace studio {
66
67 class Widget_Color;
68 class Widget_ColorEdit;
69 class Widget_CanvasChooser;
70 class Widget_Enum;
71 class Widget_Filename;
72 class Widget_Vector;
73 class Widget_Time;
74 class Widget_Distance;
75
76 class Widget_ValueBase : public Gtk::HBox
77 {
78         Gtk::Label *label;
79         synfig::ValueBase value;
80
81         Widget_Vector *vector_widget;
82         Gtk::SpinButton *real_widget;
83         Gtk::Adjustment real_adjustment;
84         Gtk::SpinButton *integer_widget;
85         Gtk::Adjustment integer_adjustment;
86         Gtk::SpinButton *angle_widget;
87         Gtk::Adjustment angle_adjustment;
88
89         Gtk::CheckButton *bool_widget;
90         //Gtk::ColorSelection *color_widget;
91         Widget_ColorEdit *color_widget;
92         Widget_CanvasChooser *canvas_widget;
93         Widget_Enum *enum_widget;
94         Widget_Filename *filename_widget;
95         Widget_Time *time_widget;
96         Gtk::Entry *string_widget;
97         Widget_Distance *distance_widget;
98
99 //      std::string hint;
100
101         synfig::ParamDesc param_desc;
102         synfig::ParamDesc child_param_desc;
103         etl::handle<synfig::Canvas> canvas;
104         sigc::signal<void> signal_value_changed_;
105         sigc::signal<void> signal_activate_;
106
107 public:
108         sigc::signal<void> &signal_value_changed() { return signal_value_changed_; }
109
110         void activate();
111
112         sigc::signal<void>& signal_activate() { return signal_activate_; }
113
114         void set_value(const synfig::ValueBase &data);
115         const synfig::ValueBase &get_value();
116
117         void on_grab_focus();
118
119         void set_param_desc(const synfig::ParamDesc &x) { param_desc=x; }
120         const synfig::ParamDesc &get_param_desc() { return param_desc; }
121
122         void set_child_param_desc(const synfig::ParamDesc &x) { child_param_desc=x; }
123         const synfig::ParamDesc &get_child_param_desc() { return child_param_desc; }
124
125         void set_sensitive(bool x);
126
127         //void set_hint(std::string x) { hint=x; }
128 //      std::string get_hint() { return hint; }
129
130         void set_canvas(etl::handle<synfig::Canvas> x) { canvas=x; assert(canvas); }
131         void inside_cellrenderer();
132         Widget_ValueBase();
133         ~Widget_ValueBase();
134 };
135
136 }; // END of namespace studio
137
138 /* === E N D =============================================================== */
139
140 #endif