Avoiding warnings by creating structs without new operator.

This commit is contained in:
Kolan Sh 2017-08-19 00:07:04 +03:00
parent f2e220b92e
commit 8832d6e6c8
3 changed files with 16 additions and 16 deletions

View File

@ -61,8 +61,8 @@ namespace Gtk.CairoChart {
[Compact] [Compact]
public class Text { public class Text {
public string text = ""; public string text = "";
public FontStyle style = new FontStyle (); public FontStyle style = FontStyle ();
public Color color = new Color(); public Color color = Color();
TextExtents get_extents (Cairo.Context context) { TextExtents get_extents (Cairo.Context context) {
context.select_font_face (style.family, context.select_font_face (style.family,
@ -99,8 +99,8 @@ namespace Gtk.CairoChart {
} }
public Text (string text = "", public Text (string text = "",
FontStyle style = new FontStyle(), FontStyle style = FontStyle(),
Color color = new Color()) { Color color = Color()) {
this.text = text; this.text = text;
this.style = style; this.style = style;
this.color = color; this.color = color;

View File

@ -13,7 +13,7 @@ namespace Gtk.CairoChart {
public Color bg_color; public Color bg_color;
public bool show_legend = true; public bool show_legend = true;
public Text title = new Text ("Cairo Chart"); public Text title = new Text ("Cairo Chart");
public Color border_color = new Color(0, 0, 0, 0.3); public Color border_color = Color(0, 0, 0, 0.3);
public class Legend { public class Legend {
public enum Position { public enum Position {
@ -23,13 +23,13 @@ namespace Gtk.CairoChart {
BOTTOM BOTTOM
} }
public Position position = Position.TOP; public Position position = Position.TOP;
public FontStyle font_style = new FontStyle(); public FontStyle font_style = FontStyle();
public Color bg_color = new Color(1, 1, 1); public Color bg_color = Color(1, 1, 1);
public LineStyle border_style = new LineStyle (); public LineStyle border_style = new LineStyle ();
public double indent = 5; public double indent = 5;
public Legend () { public Legend () {
border_style.color = new Color (0, 0, 0, 0.3); border_style.color = Color (0, 0, 0, 0.3);
} }
} }
@ -40,7 +40,7 @@ namespace Gtk.CairoChart {
protected LineStyle selection_style = new LineStyle (); protected LineStyle selection_style = new LineStyle ();
public Chart () { public Chart () {
bg_color = new Color (1, 1, 1); bg_color = Color (1, 1, 1);
} }
protected Double128 cur_x_min = 0.0; protected Double128 cur_x_min = 0.0;
@ -108,7 +108,7 @@ namespace Gtk.CairoChart {
if (context != null) { if (context != null) {
set_source_rgba (bg_color); set_source_rgba (bg_color);
context.paint(); context.paint();
set_source_rgba (new Color (0, 0, 0, 1)); set_source_rgba (Color (0, 0, 0, 1));
} }
} }

View File

@ -82,8 +82,8 @@ namespace Gtk.CairoChart {
} }
default = 2; default = 2;
} }
public FontStyle font_style = new FontStyle (); public FontStyle font_style = FontStyle ();
public Color color = new Color (); public Color color = Color ();
public LineStyle line_style = new LineStyle (); public LineStyle line_style = new LineStyle ();
public double font_indent = 5; public double font_indent = 5;
@ -153,17 +153,17 @@ namespace Gtk.CairoChart {
grid.line_style.color = _color; grid.line_style.color = _color;
grid.line_style.color.alpha = 0.5; grid.line_style.color.alpha = 0.5;
} }
default = new Color (0.0, 0.0, 0.0, 1.0); default = Color (0.0, 0.0, 0.0, 1.0);
} }
public Series () { public Series () {
} }
public class LabelStyle { public class LabelStyle {
FontStyle font_style = new FontStyle(); FontStyle font_style = FontStyle();
LineStyle frame_line_style = new LineStyle(); LineStyle frame_line_style = new LineStyle();
Color bg_color = new Color(); Color bg_color = Color();
Color frame_color = new Color(); Color frame_color = Color();
} }
} }
} }