aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GraphicObject.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-12 03:37:29 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-08-12 03:37:29 +0200
commit80ceca9f199f37928f8c3068d07732b77d45156f (patch)
tree23cc31124f141dfc7919581d8cfab381a4ebc977 /src/GraphicObjects/GraphicObject.cs
parent2b62c4b6eefdeaf3ddb4247b6241e87ee2345a6a (diff)
* Crow.csproj, Default.style, button.svg, buttest.svg, buttest2.svg, buttest4.svg, 0.crow:
test and divers * DirectoryView.cs: SelectedItem property * GraphicObject.cs: Style class, EventInfo in styles * Group.cs: lock children * Popper.cs: alignment = top left, simple unpop on mouse leave, no additional tests * Spinner.cs: ctor order * TabView.cs: code clean * Window.cs: movable * Style.cs, Interface.cs: Style class * StyleReader.cs: parser exception, debug expression parsing * Button.crow, Popper.goml, TabItem.crow, CheckBox.goml, Expandable.goml, MessageBox.goml, RadioButton.goml, ScrollingListBox.goml: templating * TreeView.crow: scrollbar * 1.crow: showcase * test.style, Tests.csproj, CheckBox2.imlt: tests
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
-rw-r--r--src/GraphicObjects/GraphicObject.cs26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 88166fe6..925f69df 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -538,7 +538,7 @@ namespace Crow
}
}
- List<Dictionary<string, object>> styling = new List<Dictionary<string, object>>();
+ List<Style> styling = new List<Style>();
//Search for a style mathing :
//1: Full class name, with full namespace
@@ -587,7 +587,14 @@ namespace Crow
il.Emit (OpCodes.Ldarg_0);
il.Emit (OpCodes.Stloc_0);
- foreach (PropertyInfo pi in thisType.GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
+ foreach (EventInfo ei in thisType.GetEvents(BindingFlags.Public | BindingFlags.Instance)) {
+ string expression;
+ if (!getDefaultEvent(ei, styling, out expression))
+ continue;
+ CompilerServices.emitBindingCreation (il, ei.Name, expression);
+ }
+
+ foreach (PropertyInfo pi in thisType.GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
if (pi.GetSetMethod () == null)
continue;
object defaultValue;
@@ -606,7 +613,20 @@ namespace Crow
throw new Exception ("Error applying style <" + styleKey + ">:", ex);
}
}
- bool getDefaultValue(PropertyInfo pi, List<Dictionary<string, object>> styling,
+ bool getDefaultEvent(EventInfo ei, List<Style> styling,
+ out string expression){
+ expression = "";
+ if (styling.Count > 0){
+ for (int i = 0; i < styling.Count; i++) {
+ if (styling[i].ContainsKey (ei.Name)){
+ expression = (string)styling[i] [ei.Name];
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ bool getDefaultValue(PropertyInfo pi, List<Style> styling,
out object defaultValue){
defaultValue = null;
string name = "";