aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/MenuItem.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2017-01-04 20:18:18 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2017-01-04 20:18:18 +0100
commit193e21872b5bfe25224405753ca78e4e880f4ef8 (patch)
tree5974361ce776cc78da3a28e09bd1e6164bdee034 /src/GraphicObjects/MenuItem.cs
parent0a309c9271d09893e682bd2568151f81036eae13 (diff)
menuItem derived from Menu + automatic opening when sibling opens
Diffstat (limited to 'src/GraphicObjects/MenuItem.cs')
-rw-r--r--src/GraphicObjects/MenuItem.cs29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/GraphicObjects/MenuItem.cs b/src/GraphicObjects/MenuItem.cs
index 87744ef9..80b5759d 100644
--- a/src/GraphicObjects/MenuItem.cs
+++ b/src/GraphicObjects/MenuItem.cs
@@ -24,7 +24,7 @@ using System.ComponentModel;
namespace Crow
{
- public class MenuItem : TemplatedGroup
+ public class MenuItem : Menu
{
#region CTOR
public MenuItem () : base() {}
@@ -47,9 +47,10 @@ namespace Crow
isOpened = value;
NotifyValueChanged ("IsOpened", isOpened);
- if (isOpened)
+ if (isOpened) {
onOpen (this, null);
- else
+ (LogicalParent as Menu).AutomaticOpenning = true;
+ }else
onClose (this, null);
}
}
@@ -75,19 +76,7 @@ namespace Crow
NotifyValueChanged ("Caption", caption);
}
}
-
- [XmlIgnore]Menu MenuRoot {
- get {
- ILayoutable tmp = LogicalParent;
- while (tmp != null) {
- if (tmp is Menu)
- return tmp as Menu;
- tmp = tmp.LogicalParent;
- }
- return null;
- }
- }
-
+
public override void AddItem (GraphicObject g)
{
base.AddItem (g);
@@ -97,6 +86,8 @@ namespace Crow
void onMI_Click (object sender, MouseButtonEventArgs e)
{
Execute.Raise (this, null);
+ if(!IsOpened)
+ (LogicalParent as Menu).AutomaticOpenning = false;
}
protected virtual void onOpen (object sender, EventArgs e){
Open.Raise (this, null);
@@ -108,6 +99,12 @@ namespace Crow
{
return base.MouseIsIn (m) || child.MouseIsIn (m);
}
+ public override void onMouseEnter (object sender, MouseMoveEventArgs e)
+ {
+ base.onMouseEnter (sender, e);
+ if ((LogicalParent as Menu).AutomaticOpenning && items.Children.Count>0)
+ IsOpened = true;
+ }
public override void onMouseLeave (object sender, MouseMoveEventArgs e)
{
if (IsOpened)