aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-22 07:10:38 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-09-01 13:24:16 +0200
commit8b3cd65ebab46402ebc0662de3c9ead220f6322c (patch)
tree1e64d7e40460ac2053eb947710961c0fa9565efe /src/GraphicObjects
parent4a844578835eaf50652a839a5b9e2288f840ec08 (diff)
adapt child layout register on group size change depending on units of child measure, change visible state change logic in go
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/GraphicObject.cs58
-rw-r--r--src/GraphicObjects/Group.cs16
2 files changed, 47 insertions, 27 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 6572ba52..026c06bd 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -54,8 +54,10 @@ namespace Crow
#region CTOR
public GraphicObject ()
{
+ #if DEBUG
uid = currentUid;
currentUid++;
+ #endif
}
#endregion
internal protected virtual void initialize(){
@@ -65,7 +67,7 @@ namespace Crow
LayoutingType registeredLayoutings = LayoutingType.All;
ILayoutable logicalParent;
ILayoutable parent;
- string name = "unamed";
+ string name;
Fill background = Color.Transparent;
Fill foreground = Color.White;
Font font = "droid, 10";
@@ -199,14 +201,20 @@ namespace Crow
this.RegisterForRedraw ();
}
}
- [XmlAttributeAttribute()][DefaultValue("unamed")]
+ [XmlAttributeAttribute()][DefaultValue(null)]
public virtual string Name {
- get { return name; }
+ get {
+ #if DEBUG
+ return string.IsNullOrEmpty(name) ? this.GetType().Name + uid.ToString () : name;
+ #else
+ return name;
+ #endif
+ }
set {
if (name == value)
return;
name = value;
- NotifyValueChanged("Name", verticalAlignment);
+ NotifyValueChanged("Name", name);
}
}
[XmlAttributeAttribute ()][DefaultValue(VerticalAlignment.Center)]
@@ -450,14 +458,17 @@ namespace Crow
if (!isVisible && this.Contains (CurrentInterface.HoverWidget))
CurrentInterface.HoverWidget = null;
- if (Parent is GraphicObject)
- (Parent as GraphicObject).RegisterForLayouting (LayoutingType.Sizing);
- if (Parent is GenericStack)
- (Parent as GraphicObject).RegisterForLayouting (LayoutingType.ArrangeChildren);
-
if (isVisible)
RegisterForLayouting (LayoutingType.Sizing);
- CurrentInterface.EnqueueForRepaint (this);
+ else {
+ Slot.Width = 0;
+ LayoutChanged.Raise (this, new LayoutingEventArgs (LayoutingType.Width));
+ Slot.Height = 0;
+ LayoutChanged.Raise (this, new LayoutingEventArgs (LayoutingType.Height));
+ CurrentInterface.EnqueueForRepaint (this);
+ LastSlots.Width = LastSlots.Height = 0;
+ }
+
NotifyValueChanged ("Visible", isVisible);
}
@@ -792,7 +803,7 @@ namespace Crow
{
#if DEBUG_LAYOUTING
LayoutingQueueItem.currentLQI.Slot = LastSlots;
- LayoutingQueueItem.currentLQI.Slot = Slot;
+ LayoutingQueueItem.currentLQI.NewSlot = Slot;
#endif
switch (layoutType) {
@@ -1200,18 +1211,6 @@ namespace Crow
public virtual void onDisable(object sender, EventArgs e){
Disabled.Raise (this, e);
}
- public override string ToString ()
- {
- string tmp ="";
-
- if (Parent != null)
- tmp = Parent.ToString () + tmp;
- #if DEBUG_LAYOUTING
- return Name == "unamed" ? tmp + "." + this.GetType ().Name + uid.ToString(): tmp + "." + Name;
- #else
- return Name == "unamed" ? tmp + "." + this.GetType ().Name : tmp + "." + Name;
- #endif
- }
#region Binding
public void BindMember(string _member, string _expression){
@@ -1489,5 +1488,18 @@ namespace Crow
tmp.Bindings.Add (new Binding (new MemberReference (tmp, b.Source.Member), b.Expression));
return tmp;
}
+
+ public override string ToString ()
+ {
+ string tmp ="";
+
+ if (Parent != null)
+ tmp = Parent.ToString () + tmp;
+ #if DEBUG_LAYOUTING
+ return Name == "unamed" ? tmp + "." + this.GetType ().Name + uid.ToString(): tmp + "." + Name;
+ #else
+ return Name == "unamed" ? tmp + "." + this.GetType ().Name : tmp + "." + Name;
+ #endif
+ }
}
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 402128b0..efe02d95 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -153,12 +153,20 @@ namespace Crow
//position smaller objects in group when group size is fit
switch (layoutType) {
case LayoutingType.Width:
- foreach (GraphicObject c in Children)
- c.RegisterForLayouting (LayoutingType.X | LayoutingType.Width);
+ foreach (GraphicObject c in Children){
+ if (c.Width.Units == Unit.Percent)
+ c.RegisterForLayouting (LayoutingType.Width);
+ else
+ c.RegisterForLayouting (LayoutingType.X);
+ }
break;
case LayoutingType.Height:
- foreach (GraphicObject c in Children)
- c.RegisterForLayouting (LayoutingType.Y | LayoutingType.Height);
+ foreach (GraphicObject c in Children) {
+ if (c.Height.Units == Unit.Percent)
+ c.RegisterForLayouting (LayoutingType.Height);
+ else
+ c.RegisterForLayouting (LayoutingType.Y);
+ }
break;
}
}