diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
commit | 98f3ef2689de06e8ab8b46a91acfa7dd2056a3a6 (patch) | |
tree | b98e438ac1082925e12af6dfec6d9ebeb4e3035e /src/themes/sliceLayer.vala | |
parent | a824c3e5bdab686901b02667609282e7d596a6af (diff) |
Imported Upstream version 0.5.1
Diffstat (limited to 'src/themes/sliceLayer.vala')
-rw-r--r-- | src/themes/sliceLayer.vala | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/src/themes/sliceLayer.vala b/src/themes/sliceLayer.vala index 2620912..3c650c0 100644 --- a/src/themes/sliceLayer.vala +++ b/src/themes/sliceLayer.vala @@ -23,31 +23,63 @@ namespace GnomePie { ///////////////////////////////////////////////////////////////////////// public class SliceLayer : GLib.Object { + + public enum Type { FILE, ICON, CAPTION } + public enum Visibility { ANY, WITH_CAPTION, WITHOUT_CAPTION } + + public Type layer_type { get; private set; } + public Visibility visibility { get; private set; } ///////////////////////////////////////////////////////////////////// /// Information on the contained image. ///////////////////////////////////////////////////////////////////// public Image image {get; set;} - public string icon_file {get; private set;} + ///////////////////////////////////////////////////////////////////// /// Properties of this layer. ///////////////////////////////////////////////////////////////////// - public bool colorize {get; private set; } - public bool is_icon {get; private set;} - public int icon_size {get; private set;} + public string icon_file {get; private set; default="";} + public bool colorize {get; private set; default=false;} + public int icon_size {get; private set; default=1;} + + public string font {get; private set; default="";} + public int width {get; private set; default=0;} + public int height {get; private set; default=0;} + public int position {get; private set; default=0;} + public Color color {get; private set; default=new Color();} ///////////////////////////////////////////////////////////////////// /// C'tor, initializes all members of the layer. ///////////////////////////////////////////////////////////////////// - public SliceLayer(string icon_file, int icon_size, bool colorize, bool is_icon) { + public SliceLayer.file(string icon_file, int icon_size, bool colorize, Visibility visibility) { + this.layer_type = Type.FILE; this.icon_file = icon_file; this.colorize = colorize; - this.is_icon = is_icon; this.icon_size = icon_size; + this.visibility = visibility; + } + + public SliceLayer.icon(string icon_file, int icon_size, bool colorize, Visibility visibility) { + this.layer_type = Type.ICON; + this.icon_file = icon_file; + this.colorize = colorize; + this.icon_size = icon_size; + this.visibility = visibility; + } + + public SliceLayer.caption(string font, int width, int height, int position, Color color, bool colorize, Visibility visibility) { + this.layer_type = Type.CAPTION; + this.font = font; + this.width = width; + this.height = height; + this.position = position; + this.color = color; + this.visibility = visibility; + this.colorize = colorize; } ///////////////////////////////////////////////////////////////////// @@ -55,9 +87,11 @@ public class SliceLayer : GLib.Object { ///////////////////////////////////////////////////////////////////// public void load_image() { - if (this.icon_file == "" && this.is_icon == true) + this.image = null; + + if (this.icon_file == "" && this.layer_type == Type.ICON) this.image = new Image.empty(this.icon_size, this.icon_size, new Color.from_rgb(1, 1, 1)); - else + else if (this.icon_file != "") this.image = new Image.from_file_at_size(this.icon_file, this.icon_size, this.icon_size); } } |