3 #include "core/core.hpp"
4 #include "common/object_descr.hpp"
5 #include "core/core_properties.hpp"
6 #include "widgets/generic_combo_box.hpp"
9 class PropertyEditor :
public Gtk::Box {
11 PropertyEditor(ObjectType t, ObjectProperty::ID prop,
class PropertyPanel *p);
12 virtual void construct();
13 void set_can_apply_all(
bool v);
15 virtual void reload(){};
16 virtual PropertyValue &get_value()
20 virtual PropertyMeta &get_meta()
25 typedef sigc::signal<void> type_signal_changed;
26 type_signal_changed signal_changed()
28 return s_signal_changed;
31 type_signal_changed signal_apply_all()
33 return s_signal_apply_all;
36 type_signal_changed signal_activate()
38 return s_signal_activate;
43 virtual ~PropertyEditor()
47 class PropertyPanel *parent;
48 const ObjectProperty::ID property_id;
51 const ObjectType type;
53 const ObjectProperty &property;
54 Gtk::ToggleButton *apply_all_button =
nullptr;
56 virtual Gtk::Widget *create_editor();
58 type_signal_changed s_signal_changed;
59 type_signal_changed s_signal_apply_all;
60 type_signal_changed s_signal_activate;
64 bool readonly =
false;
66 std::deque<sigc::connection> connections;
71 class PropertyEditorBool :
public PropertyEditor {
72 using PropertyEditor::PropertyEditor;
75 void reload()
override;
76 PropertyValue &get_value()
override;
79 Gtk::Widget *create_editor()
override;
82 Gtk::Switch *sw =
nullptr;
83 PropertyValueBool value;
86 class PropertyEditorString :
public PropertyEditor {
87 using PropertyEditor::PropertyEditor;
90 void reload()
override;
91 PropertyValue &get_value()
override;
94 Gtk::Widget *create_editor()
override;
97 Gtk::Entry *en =
nullptr;
100 bool focus_out_event(GdkEventFocus *e);
101 bool modified =
false;
103 PropertyValueString value;
106 class PropertyEditorDim :
public PropertyEditor {
107 using PropertyEditor::PropertyEditor;
110 void reload()
override;
111 PropertyValue &get_value()
override;
115 Gtk::Widget *create_editor()
override;
118 class SpinButtonDim *sp =
nullptr;
119 PropertyValueInt value;
120 std::pair<int64_t, int64_t> range = {-1e9, 1e9};
123 class PropertyEditorEnum :
public PropertyEditor {
124 using PropertyEditor::PropertyEditor;
127 void reload()
override;
128 PropertyValue &get_value()
override;
131 Gtk::Widget *create_editor()
override;
134 GenericComboBox<int> *combo =
nullptr;
136 PropertyValueInt value;
139 class PropertyEditorStringRO :
public PropertyEditor {
140 using PropertyEditor::PropertyEditor;
143 void reload()
override;
144 PropertyValue &get_value()
override;
147 Gtk::Widget *create_editor()
override;
150 Gtk::Label *la =
nullptr;
151 PropertyValueString value;
154 class PropertyEditorNetClass :
public PropertyEditor {
155 using PropertyEditor::PropertyEditor;
158 void reload()
override;
159 PropertyValue &get_value()
override;
160 PropertyMeta &get_meta()
override
166 Gtk::Widget *create_editor()
override;
169 GenericComboBox<UUID> *combo =
nullptr;
171 PropertyValueUUID value;
172 PropertyMetaNetClasses my_meta;
175 class PropertyEditorLayer :
public PropertyEditor {
176 using PropertyEditor::PropertyEditor;
179 void reload()
override;
180 PropertyValue &get_value()
override;
181 PropertyMeta &get_meta()
override
185 bool copper_only =
false;
188 Gtk::Widget *create_editor()
override;
191 Gtk::ComboBoxText *combo =
nullptr;
193 PropertyValueInt value;
194 PropertyMetaLayers my_meta;
197 class PropertyEditorAngle :
public PropertyEditor {
198 using PropertyEditor::PropertyEditor;
201 void reload()
override;
202 PropertyValue &get_value()
override;
205 Gtk::Widget *create_editor()
override;
208 Gtk::SpinButton *sp =
nullptr;
209 PropertyValueInt value;
212 class PropertyEditorStringMultiline :
public PropertyEditor {
213 using PropertyEditor::PropertyEditor;
216 void reload()
override;
217 PropertyValue &get_value()
override;
218 void construct()
override;
221 Gtk::Widget *create_editor()
override;
224 Gtk::TextView *en =
nullptr;
227 bool focus_out_event(GdkEventFocus *e);
228 bool modified =
false;
230 PropertyValueString value;
233 class PropertyEditorInt :
public PropertyEditor {
234 using PropertyEditor::PropertyEditor;
237 void reload()
override;
238 PropertyValue &get_value()
override;
241 Gtk::Widget *create_editor()
override;
243 Gtk::SpinButton *sp =
nullptr;
244 PropertyValueInt value;
248 class PropertyEditorExpand :
public PropertyEditorInt {
249 using PropertyEditorInt::PropertyEditorInt;
252 Gtk::Widget *create_editor()
override;
255 class PropertyEditorPriority :
public PropertyEditorInt {
256 using PropertyEditorInt::PropertyEditorInt;
259 Gtk::Widget *create_editor()
override;
262 class PropertyEditorDouble :
public PropertyEditor {
263 using PropertyEditor::PropertyEditor;
266 void reload()
override;
267 PropertyValue &get_value()
override;
270 Gtk::Widget *create_editor()
override;
272 Gtk::SpinButton *sp =
nullptr;
273 PropertyValueDouble value;
277 class PropertyEditorOpacity :
public PropertyEditorDouble {
278 using PropertyEditorDouble::PropertyEditorDouble;
281 Gtk::Widget *create_editor()
override;
284 class PropertyEditorScale :
public PropertyEditorDouble {
285 using PropertyEditorDouble::PropertyEditorDouble;
288 Gtk::Widget *create_editor()
override;