From: jpbruyere Date: Sun, 7 Aug 2016 11:36:50 +0000 (+0200) Subject: divers X-Git-Tag: v0.4~12 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=4d4a9116ea5c68b27f0b7c43db9682ab57738ae7;p=jp%2Fcrow.git divers --- diff --git a/Templates/Popper.goml b/Templates/Popper.goml index 731646f1..c4093b19 100755 --- a/Templates/Popper.goml +++ b/Templates/Popper.goml @@ -1,7 +1,8 @@  - + \ No newline at end of file diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 36be650d..8966acf6 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -1304,7 +1304,7 @@ namespace Crow PropertyInfo pi = mi as PropertyInfo; if (pi.GetSetMethod () == null) { - Debug.WriteLine ("GOML: Read only property in " + thisType.ToString() + " : " + name); + Debug.WriteLine ("XML: Read only property in " + thisType.ToString() + " : " + name); return; } diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 4d851b1a..a6ca5758 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -337,7 +337,7 @@ namespace Crow } } if (t == null) - throw new Exception ("Crow." + subTree.Name + " type not found"); + throw new Exception (subTree.Name + " type not found"); GraphicObject go = (GraphicObject)Activator.CreateInstance(t); (go as IXmlSerializable).ReadXml(subTree); AddChild(go); diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs index b92fe39f..58d41e0b 100644 --- a/src/GraphicObjects/ListBox.cs +++ b/src/GraphicObjects/ListBox.cs @@ -104,7 +104,7 @@ namespace Crow SelectedItemChanged.Raise (this, new SelectionChangeEventArgs (SelectedItem)); } - #region implemented abstract members of TemplatedControl + #region TemplatedControl override protected override void loadTemplate (GraphicObject template = null) { base.loadTemplate (template); @@ -114,6 +114,7 @@ namespace Crow _gsList = _list as GenericStack; } #endregion + void loading(){ if (ItemTemplates == null) ItemTemplates = new Dictionary (); diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index 14e7ec7a..0a013ae1 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -37,12 +37,54 @@ namespace Crow bool _isPopped; string caption; - string image; + Alignment popDirection; GraphicObject _content; public event EventHandler Pop; public event EventHandler Unpop; + #region Public Properties + [XmlAttributeAttribute()][DefaultValue("Popper")] + public string Caption { + get { return caption; } + set { + if (caption == value) + return; + caption = value; + NotifyValueChanged ("Caption", caption); + } + } + [XmlAttributeAttribute()][DefaultValue(false)] + public bool IsPopped + { + get { return _isPopped; } + set + { + if (value == _isPopped) + return; + + _isPopped = value; + NotifyValueChanged ("IsPopped", _isPopped); + + if (_isPopped) + onPop (this, null); + else + onUnpop (this, null); + + } + } + [XmlAttributeAttribute()][DefaultValue(Alignment.Bottom)] + public virtual Alignment PopDirection { + get { return popDirection; } + set { + if (popDirection == value) + return; + popDirection = value; + NotifyValueChanged ("PopDirection", popDirection); + } + } + #endregion + public override GraphicObject Content { get { return _content; } set { @@ -109,6 +151,7 @@ namespace Crow } } + #region GraphicObject overrides public override void OnLayoutChanges (LayoutingType layoutType) { base.OnLayoutChanges (layoutType); @@ -120,7 +163,6 @@ namespace Crow _content.MinimumSize = new Size (this.Slot.Width, _content.MinimumSize.Height); } - #region GraphicObject overrides public override void ClearBinding () { //ensure popped window is cleared @@ -156,59 +198,6 @@ namespace Crow IsPopped = false; } #endregion - - #region Public Properties - [XmlAttributeAttribute()][DefaultValue("Popper")] - public string Caption { - get { return caption; } - set { - if (caption == value) - return; - caption = value; - NotifyValueChanged ("Caption", caption); - } - } - [XmlAttributeAttribute()][DefaultValue("#Crow.Images.Icons.expandable.svg")] - public string Image { - get { return image; } - set { - if (image == value) - return; - image = value; - NotifyValueChanged ("Image", image); - } - } - [XmlAttributeAttribute()][DefaultValue(false)] - public bool IsPopped - { - get { return _isPopped; } - set - { - if (value == _isPopped) - return; - - _isPopped = value; - NotifyValueChanged ("IsPopped", _isPopped); - - if (_isPopped) - onPop (this, null); - else - onUnpop (this, null); - - } - } - Alignment popDirection; - [XmlAttributeAttribute()][DefaultValue(Alignment.Bottom)] - public virtual Alignment PopDirection { - get { return popDirection; } - set { - if (popDirection == value) - return; - popDirection = value; - NotifyValueChanged ("PopDirection", popDirection); - } - } - #endregion public virtual void onPop(object sender, EventArgs e) { diff --git a/src/GraphicObjects/TemplatedContainer.cs b/src/GraphicObjects/TemplatedContainer.cs index a845722a..18977cf9 100644 --- a/src/GraphicObjects/TemplatedContainer.cs +++ b/src/GraphicObjects/TemplatedContainer.cs @@ -92,6 +92,9 @@ namespace Crow t = expT; } } + if (t == null) + throw new Exception (xr.Name + " type not found"); + GraphicObject go = (GraphicObject)Activator.CreateInstance (t); (go as IXmlSerializable).ReadXml (xr); diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index 9040ddeb..b325a0d2 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -27,6 +27,7 @@ using System.Diagnostics; using System.Linq; using System.Collections.Generic; using System.Text; +using System.Reflection; namespace Crow { @@ -174,6 +175,13 @@ namespace Crow xr.Read (); Type t = Type.GetType ("Crow." + xr.Name); + if (t == null) { + Assembly a = Assembly.GetEntryAssembly (); + foreach (Type expT in a.GetExportedTypes ()) { + if (expT.Name == xr.Name) + t = expT; + } + } GraphicObject go = (GraphicObject)Activator.CreateInstance (t); (go as IXmlSerializable).ReadXml (xr); diff --git a/src/Interface.cs b/src/Interface.cs index df595275..7b324de7 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -108,7 +108,7 @@ namespace Crow } } - #region default values and style loading + #region Default values and Style loading /// Default values of properties from GraphicObjects are retrieve from XML Attributes. /// The reflexion process used to retrieve those values being very slow, it is compiled in MSIL /// and injected as a dynamic method referenced in the DefaultValuesLoader Dictionnary.