aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-10-18 11:38:37 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-10-18 11:41:06 +0200
commit43a1802b884782921ad3b61fc63bcfefadb627bb (patch)
treeebdc55762a3baf8b416abdf39244309ff99ac503 /src
parent10554f8a78a6981f5e49e46a32b3eee5911b872e (diff)
parent7c00385bda3a9a913050480fada2efab8d6d3090 (diff)
Merge branch 'master' into CrowIDE
Diffstat (limited to 'src')
-rw-r--r--src/Colors.cs3
-rw-r--r--src/CompilerServices/CompilerServices.cs11
-rw-r--r--src/GraphicObjects/GraphicObject.cs16
-rw-r--r--src/GraphicObjects/Popper.cs2
-rw-r--r--src/ItemTemplate.cs1
-rw-r--r--src/Measure.cs13
6 files changed, 30 insertions, 16 deletions
diff --git a/src/Colors.cs b/src/Colors.cs
index e928f377..6787c382 100644
--- a/src/Colors.cs
+++ b/src/Colors.cs
@@ -10,6 +10,9 @@ using System.Diagnostics;
namespace Crow
{
+ /// <summary>
+ /// Universal Color structure
+ /// </summary>
public struct Color
{
#region CTOR
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs
index 26a185ed..96f12963 100644
--- a/src/CompilerServices/CompilerServices.cs
+++ b/src/CompilerServices/CompilerServices.cs
@@ -15,6 +15,8 @@ namespace Crow
static MethodInfo miAddBinding = typeof(GraphicObject).GetMethod ("BindMember");
static FieldInfo miSetCurIface = typeof(GraphicObject).GetField ("currentInterface",
BindingFlags.NonPublic | BindingFlags.Instance);
+ static MethodInfo miFindByName = typeof (GraphicObject).GetMethod ("FindByName");
+
#region ValueChange Reflexion member info
static MethodInfo stringEquals = typeof (string).GetMethod
@@ -177,7 +179,7 @@ namespace Crow
continue;
//register handler for event
if (b.Target.Method == null) {
- Debug.WriteLine ("\tError: Handler Method not found: " + b.ToString ());
+ //Debug.WriteLine ("\tError: Handler Method not found: " + b.ToString ());
continue;
}
try {
@@ -190,7 +192,7 @@ namespace Crow
#endif
b.Resolved = true;
} catch (Exception ex) {
- Debug.WriteLine ("\tERROR: " + ex.ToString ());
+ //Debug.WriteLine ("\tERROR: " + ex.ToString ());
}
continue;
}
@@ -438,11 +440,10 @@ namespace Crow
il.Emit (OpCodes.Ldarg_0); //load sender ref onto the stack
string [] lopParts = lop.Split (new char [] { '.' });
- if (lopParts.Length > 1) {//should search also for member of es.Source
- MethodInfo FindByNameMi = typeof (GraphicObject).GetMethod ("FindByName");
+ if (lopParts.Length > 1) {//should search also for member of es.Source
for (int j = 0; j < lopParts.Length - 1; j++) {
il.Emit (OpCodes.Ldstr, lopParts [j]);
- il.Emit (OpCodes.Callvirt, FindByNameMi);
+ il.Emit (OpCodes.Callvirt, miFindByName);
}
}
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 093664d1..e69aaaca 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -276,9 +276,13 @@ namespace Crow
Width = Height = Measure.Fit;
}
}
- [XmlAttributeAttribute()][DefaultValue("Stretched")]
+ [XmlAttributeAttribute()][DefaultValue("Inherit")]
public virtual Measure Width {
- get { return width; }
+ get {
+ return width.Units == Unit.Inherit ?
+ Parent is GraphicObject ? (Parent as GraphicObject).WidthPolicy :
+ Measure.Stretched : width;
+ }
set {
if (width == value)
return;
@@ -308,9 +312,13 @@ namespace Crow
this.RegisterForLayouting (LayoutingType.Width);
}
}
- [XmlAttributeAttribute()][DefaultValue("Stretched")]
+ [XmlAttributeAttribute()][DefaultValue("Inherit")]
public virtual Measure Height {
- get { return height; }
+ get {
+ return height.Units == Unit.Inherit ?
+ Parent is GraphicObject ? (Parent as GraphicObject).HeightPolicy :
+ Measure.Stretched : height;
+ }
set {
if (height == value)
return;
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index 1bfdf19c..669b8d7f 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -119,7 +119,7 @@ namespace Crow
protected void _content_LayoutChanged (object sender, LayoutingEventArgs e)
{
- ILayoutable tc = Content.Parent as ILayoutable;
+ ILayoutable tc = Content.Parent;
if (tc == null)
return;
Rectangle r = this.ScreenCoordinates (this.Slot);
diff --git a/src/ItemTemplate.cs b/src/ItemTemplate.cs
index a1f67786..fe26f7a7 100644
--- a/src/ItemTemplate.cs
+++ b/src/ItemTemplate.cs
@@ -56,7 +56,6 @@ namespace Crow
Type hostType = tmpGrpType;//not sure is the best place to put the dyn method
Type evtType = typeof(EventHandler);
-
PropertyInfo piData = tmpGrpType.GetProperty ("Data");
MethodInfo evtInvoke = evtType.GetMethod ("Invoke");
diff --git a/src/Measure.cs b/src/Measure.cs
index c9b08f22..26c3bfde 100644
--- a/src/Measure.cs
+++ b/src/Measure.cs
@@ -25,7 +25,7 @@ namespace Crow
/// <summary>
/// Measurement unit
/// </summary>
- public enum Unit { Pixel, Percent }
+ public enum Unit { Pixel, Percent, Inherit }
/// <summary>
/// Measure class allow proportional sizes as well as stretched and fit on content.
/// </summary>
@@ -49,7 +49,7 @@ namespace Crow
/// set to 100 Percents
/// </summary>
public static Measure Stretched = new Measure(100, Unit.Percent);
-
+ public static Measure Inherit = new Measure (0, Unit.Inherit);
#region CTOR
public Measure (int _value, Unit _units = Unit.Pixel)
{
@@ -98,7 +98,8 @@ namespace Crow
}
public override string ToString ()
{
- return Value == -1 ? "Fit" :
+ return Units == Unit.Inherit ? "Inherit" :
+ Value == -1 ? "Fit" :
Units == Unit.Percent ? Value == 100 ? "Stretched" :
Value.ToString () + "%" : Value.ToString ();
}
@@ -111,10 +112,12 @@ namespace Crow
string st = s.Trim ();
int tmp = 0;
- if (string.Equals ("Fit", st, StringComparison.Ordinal))
+ if (string.Equals ("Inherit", st, StringComparison.Ordinal))
+ return Measure.Inherit;
+ else if (string.Equals ("Fit", st, StringComparison.Ordinal))
return Measure.Fit;
else if (string.Equals ("Stretched", s, StringComparison.Ordinal))
- return Measure.Stretched;
+ return Measure.Stretched;
else {
if (st.EndsWith ("%", StringComparison.Ordinal)) {
if (int.TryParse (s.Substring(0, st.Length - 1), out tmp))