Daniele Bartolini 5 лет назад
Родитель
Сommit
e600bb7181

+ 4 - 15
tools/widgets/check_box.vala

@@ -4,28 +4,24 @@
  */
 
 using Gtk;
-using Gdk;
 
 namespace Crown
 {
-	public class CheckBox : Gtk.Bin
+	public class CheckBox : Gtk.CheckButton
 	{
 		// Data
 		public bool _stop_emit;
 
-		// Widgets
-		public Gtk.CheckButton _check_button;
-
 		public bool value
 		{
 			get
 			{
-				return _check_button.active;
+				return this.active;
 			}
 			set
 			{
 				_stop_emit = true;
-				_check_button.active = value;
+				this.active = value;
 				_stop_emit = false;
 			}
 		}
@@ -35,17 +31,10 @@ namespace Crown
 
 		public CheckBox()
 		{
-			this.hexpand = true;
-
 			// Data
 			_stop_emit = false;
 
-			// Widgets
-			_check_button = new CheckButton();
-
-			_check_button.toggled.connect(on_value_changed);
-
-			add(_check_button);
+			this.toggled.connect(on_value_changed);
 		}
 
 		private void on_value_changed()

+ 4 - 10
tools/widgets/color_button_vector3.vala

@@ -7,14 +7,11 @@ using Gtk;
 
 namespace Crown
 {
-	public class ColorButtonVector3 : Gtk.Bin
+	public class ColorButtonVector3 : Gtk.ColorButton
 	{
 		// Data
 		public bool _stop_emit;
 
-		// Widgets
-		public Gtk.ColorButton _color_button;
-
 		// Signals
 		public signal void value_changed();
 
@@ -22,7 +19,7 @@ namespace Crown
 		{
 			get
 			{
-				Gdk.RGBA rgba = _color_button.get_rgba();
+				Gdk.RGBA rgba = this.get_rgba();
 				double r = rgba.red;
 				double g = rgba.green;
 				double b = rgba.blue;
@@ -36,7 +33,7 @@ namespace Crown
 				double g = val.y;
 				double b = val.z;
 				double a = 1.0;
-				_color_button.set_rgba({ r, g, b, a });
+				this.set_rgba({ r, g, b, a });
 				_stop_emit = false;
 			}
 		}
@@ -45,10 +42,7 @@ namespace Crown
 		{
 			_stop_emit = false;
 
-			_color_button = new Gtk.ColorButton();
-			_color_button.color_set.connect(on_color_set);
-
-			add(_color_button);
+			this.color_set.connect(on_color_set);
 		}
 
 		private void on_color_set()

+ 6 - 17
tools/widgets/combo_box_map.vala

@@ -7,14 +7,11 @@ using Gtk;
 
 namespace Crown
 {
-	public class ComboBoxMap : Gtk.Bin
+	public class ComboBoxMap : Gtk.ComboBoxText
 	{
 		// Data
 		public bool _stop_emit;
 
-		// Widgets
-		public Gtk.ComboBoxText _combo_box;
-
 		// Signals
 		public signal void value_changed();
 
@@ -22,12 +19,12 @@ namespace Crown
 		{
 			get
 			{
-				return _combo_box.get_active_id();
+				return this.get_active_id();
 			}
 			set
 			{
 				_stop_emit = true;
-				_combo_box.set_active_id((string)value);
+				this.set_active_id((string)value);
 				_stop_emit = false;
 			}
 		}
@@ -38,16 +35,8 @@ namespace Crown
 			_stop_emit = true;
 
 			// Widgets
-			_combo_box = new Gtk.ComboBoxText();
-			_combo_box.changed.connect(on_changed);
-			_combo_box.scroll_event.connect(on_scroll);
-
-			add(_combo_box);
-		}
-
-		public void append(string? id, string text)
-		{
-			_combo_box.append(id, text);
+			this.changed.connect(on_changed);
+			this.scroll_event.connect(on_scroll);
 		}
 
 		private void on_changed()
@@ -58,7 +47,7 @@ namespace Crown
 
 		private bool on_scroll(Gdk.EventScroll ev)
 		{
-			GLib.Signal.stop_emission_by_name(_combo_box, "scroll-event");
+			GLib.Signal.stop_emission_by_name(this, "scroll-event");
 			return false;
 		}
 	}

+ 0 - 1
tools/widgets/entry_double.vala

@@ -35,7 +35,6 @@ namespace Crown
 
 		public EntryDouble(double val, double min, double max, string fmt = "%.6g")
 		{
-			this.hexpand = true;
 			this.input_purpose = Gtk.InputPurpose.DIGITS;
 			this.set_width_chars(1);
 

+ 2 - 2
tools/widgets/entry_vector2.vala

@@ -49,8 +49,8 @@ namespace Crown
 			_x.value_changed.connect(on_value_changed);
 			_y.value_changed.connect(on_value_changed);
 
-			add(_x);
-			add(_y);
+			this.pack_start(_x, true, true);
+			this.pack_start(_y, true, true);
 		}
 
 		private void on_value_changed()

+ 3 - 3
tools/widgets/entry_vector3.vala

@@ -53,9 +53,9 @@ namespace Crown
 			_y.value_changed.connect(on_value_changed);
 			_z.value_changed.connect(on_value_changed);
 
-			add(_x);
-			add(_y);
-			add(_z);
+			this.pack_start(_x, true, true);
+			this.pack_start(_y, true, true);
+			this.pack_start(_z, true, true);
 		}
 
 		private void on_value_changed()

+ 4 - 4
tools/widgets/entry_vector4.vala

@@ -57,10 +57,10 @@ namespace Crown
 			_z.value_changed.connect(on_value_changed);
 			_w.value_changed.connect(on_value_changed);
 
-			add(_x);
-			add(_y);
-			add(_z);
-			add(_w);
+			this.pack_start(_x, true, true);
+			this.pack_start(_y, true, true);
+			this.pack_start(_z, true, true);
+			this.pack_start(_w, true, true);
 		}
 
 		private void on_value_changed()

+ 2 - 2
tools/widgets/resource_chooser_button.vala

@@ -52,8 +52,8 @@ namespace Crown
 			_selector.clicked.connect(on_selector_clicked);
 			_project_store = store;
 
-			add(_name);
-			add(_selector);
+			this.pack_start(_name, true, true);
+			this.pack_end(_selector, false);
 		}
 
 		private void on_value_changed()