aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GraphicObject.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-06-02 10:44:23 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-06-02 10:44:23 +0200
commitb56c22ad826a49b7ea0013c1ca78cf64169fc326 (patch)
tree588a3bc9ae0ed826012096a072b138a94ded4e61 /src/GraphicObjects/GraphicObject.cs
parent999f18b6daf7db54879a85f0f8b5c7b22f740ce7 (diff)
TemplatedControls, Picture objects for pixmap and svg raw data sharing
among controls
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
-rw-r--r--src/GraphicObjects/GraphicObject.cs28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 094bc453..72fccfba 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -48,10 +48,8 @@ namespace go
VerticalAlignment _verticalAlignment;
HorizontalAlignment _horizontalAlignment;
- bool hIsValid = false;
- bool wIsValid = false;
- bool xIsValid = false;
- bool yIsValid = false;
+ Picture _backgroundImage;
+ string _template;
#endregion
#region public fields
@@ -258,12 +256,21 @@ namespace go
{ get { return bmp == null ?
false :
true; } }
+ [XmlAttributeAttribute()][DefaultValue(null)]
+ public virtual Picture BackgroundImage {
+ get { return _backgroundImage; }
+ set {
+ _backgroundImage = value;
+ registerForGraphicUpdate ();
+ }
+ }
#endregion
+ public string BackImgSub = null;
/// <summary>
/// Loads the default values from XML attributes default
/// </summary>
- void loadDefaultValues()
+ protected virtual void loadDefaultValues()
{
foreach (PropertyInfo pi in this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
if (pi.GetSetMethod () == null)
@@ -298,6 +305,8 @@ namespace go
pi.SetValue (this, Color.Parse ((string)dv.Value), null);
else if (pi.PropertyType == typeof(Font))
pi.SetValue (this, Font.Parse ((string)dv.Value), null);
+ else if (pi.PropertyType == typeof(Picture))
+ pi.SetValue (this, Picture.Parse ((string)dv.Value), null);
else
pi.SetValue (this, dv.Value, null);
continue;
@@ -520,7 +529,13 @@ namespace go
gr.Color = Background;
CairoHelpers.CairoRectangle(gr,rBack,_cornerRadius);
gr.Fill ();
+
+ if (BackgroundImage == null)
+ return;
+
+ BackgroundImage.Paint (gr, rBack, BackImgSub);
}
+
protected virtual void UpdateGraphic ()
{
int stride = 4 * Slot.Width;
@@ -711,6 +726,8 @@ namespace go
pi.SetValue (this, Color.Parse ((string)defaultValue), null);
else if (pi.PropertyType == typeof(Font))
pi.SetValue (this, Font.Parse ((string)defaultValue), null);
+ else if (pi.PropertyType == typeof(Picture))
+ pi.SetValue (this, Picture.Parse ((string)defaultValue), null);
else
pi.SetValue (this, defaultValue, null);
} else {
@@ -725,6 +742,7 @@ namespace go
MemberName = name,
Value = strBinding
});
+ continue;
}
if (pi.PropertyType == typeof(string)) {