| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /*
- * Copyright (c) 2012-2017 Daniele Bartolini and individual contributors.
- * License: https://github.com/dbartolini/crown/blob/master/LICENSE
- */
- using Gtk;
- namespace Crown
- {
- /// <summary>
- /// Vector3 spin button.
- /// </summary>
- public class SpinButtonVector3 : Gtk.Box
- {
- // Data
- private bool _stop_emit;
- // Widgets
- private SpinButtonDouble _x;
- private SpinButtonDouble _y;
- private SpinButtonDouble _z;
- public Vector3 value
- {
- get
- {
- return Vector3(_x.value, _y.value, _z.value);
- }
- set
- {
- _stop_emit = true;
- Vector3 val = (Vector3)value;
- _x.value = val.x;
- _y.value = val.y;
- _z.value = val.z;
- _stop_emit = false;
- }
- }
- // Signals
- public signal void value_changed();
- public SpinButtonVector3(Vector3 xyz, Vector3 min, Vector3 max)
- {
- Object(orientation: Gtk.Orientation.HORIZONTAL, spacing: 0);
- // Data
- _stop_emit = false;
- // Widgets
- _x = new SpinButtonDouble(xyz.x, min.x, max.x);
- _y = new SpinButtonDouble(xyz.y, min.y, max.y);
- _z = new SpinButtonDouble(xyz.z, min.z, max.z);
- _x.value_changed.connect(on_value_changed);
- _y.value_changed.connect(on_value_changed);
- _z.value_changed.connect(on_value_changed);
- add(_x);
- add(_y);
- add(_z);
- }
- private void on_value_changed()
- {
- if (!_stop_emit)
- value_changed();
- }
- }
- }
|