aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/MenuItem.cs16
-rw-r--r--src/GraphicObjects/Popper.cs18
-rw-r--r--src/GraphicObjects/TemplatedGroup.cs8
3 files changed, 36 insertions, 6 deletions
diff --git a/src/GraphicObjects/MenuItem.cs b/src/GraphicObjects/MenuItem.cs
index 591be2b0..2734377e 100644
--- a/src/GraphicObjects/MenuItem.cs
+++ b/src/GraphicObjects/MenuItem.cs
@@ -34,6 +34,18 @@ namespace Crow
// public event EventHandler Unpop;
string caption;
+ Command command;
+
+ [XmlAttributeAttribute()][DefaultValue(null)]
+ public virtual Command Command {
+ get { return command; }
+ set {
+ if (command == value)
+ return;
+ command = value;
+ NotifyValueChanged ("Command", command);
+ }
+ }
[XmlAttributeAttribute][DefaultValue("MenuItem")]
public string Caption {
@@ -45,10 +57,6 @@ namespace Crow
NotifyValueChanged ("Caption", caption);
}
}
-// [XmlIgnore]
-// public virtual Alignment Orientation {
-// get { return Parent is Menu ? (Parent as Menu).Orientation : (Parent as MenuItem); }
-// }
Menu MenuRoot {
get {
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index 8d62f002..e0da0096 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -34,7 +34,7 @@ namespace Crow
}
#endregion
- bool _isPopped;
+ bool _isPopped, _canPop;
string caption;
Alignment popDirection;
GraphicObject _content;
@@ -72,6 +72,19 @@ namespace Crow
}
}
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public bool CanPop
+ {
+ get { return _canPop; }
+ set
+ {
+ if (value == _canPop)
+ return;
+
+ _canPop = value;
+ NotifyValueChanged ("CanPop", _canPop);
+ }
+ }
[XmlAttributeAttribute()][DefaultValue(Alignment.Bottom)]
public virtual Alignment PopDirection {
get { return popDirection; }
@@ -182,7 +195,8 @@ namespace Crow
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
- IsPopped = !IsPopped;
+ if (_canPop)
+ IsPopped = !IsPopped;
base.onMouseClick (sender, e);
}
public override void onMouseLeave (object sender, MouseMoveEventArgs e)
diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs
index cee4adea..704b59af 100644
--- a/src/GraphicObjects/TemplatedGroup.cs
+++ b/src/GraphicObjects/TemplatedGroup.cs
@@ -38,16 +38,20 @@ namespace Crow
public virtual void AddItem(GraphicObject g){
items.AddChild (g);
+ NotifyValueChanged ("HasChildren", true);
//g.LogicalParent = this;
}
public virtual void RemoveItem(GraphicObject g)
{
items.RemoveChild (g);
+ if (items.Children.Count == 0)
+ NotifyValueChanged ("HasChildren", false);
}
public virtual void ClearItems()
{
items.ClearChildren ();
+ NotifyValueChanged ("HasChildren", false);
}
protected override void loadTemplate(GraphicObject template = null)
@@ -57,6 +61,10 @@ namespace Crow
items = this.child.FindByName ("ItemsContainer") as Group;
if (items == null)
throw new Exception ("TemplatedGroup template Must contain a Group named 'ItemsContainer'");
+ if (items.Children.Count == 0)
+ NotifyValueChanged ("HasChildren", false);
+ else
+ NotifyValueChanged ("HasChildren", true);
}
#region GraphicObject overrides