aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/MenuItem.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-15 14:58:36 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-15 14:58:36 +0100
commitc1b29a565bdbf37fd88d268588710ce8f4f84d5b (patch)
tree37ec254f01bb8d2bad971c137fa787ca76a194d1 /src/GraphicObjects/MenuItem.cs
parent0efa7446134489edd303b349ae1220f1c4228e9a (diff)
CrowIDE WIP, context commands, tooltips, PointIsIn(ref point), configuration no longer static.
also: - remove default null value for datasource - dschange sender changed in group and privateContainer - try closing menuItem, should debug - Contains search also template in TemplatedContainer - change in nodeAddress: expresion starting with '/' means current node - MouseEventArgs CTOR with one source button - RemoveWidget trigger check HoverWidget - Orientation binding in Menu template
Diffstat (limited to 'src/GraphicObjects/MenuItem.cs')
-rw-r--r--src/GraphicObjects/MenuItem.cs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/GraphicObjects/MenuItem.cs b/src/GraphicObjects/MenuItem.cs
index ae27b013..5c9665fb 100644
--- a/src/GraphicObjects/MenuItem.cs
+++ b/src/GraphicObjects/MenuItem.cs
@@ -40,7 +40,6 @@ namespace Crow
public event EventHandler Open;
public event EventHandler Close;
- string caption;
Command command;
Picture icon;
bool isOpened;
@@ -58,7 +57,8 @@ namespace Crow
if (isOpened) {
onOpen (this, null);
- (LogicalParent as Menu).AutomaticOpenning = true;
+ if (LogicalParent is Menu)
+ (LogicalParent as Menu).AutomaticOpenning = true;
}else
onClose (this, null);
}
@@ -143,8 +143,10 @@ namespace Crow
}
void onMI_Click (object sender, MouseButtonEventArgs e)
{
- if (command != null)
+ if (command != null) {
command.Execute ();
+ closeMenu ();
+ }
if(!IsOpened)
(LogicalParent as Menu).AutomaticOpenning = false;
}
@@ -152,6 +154,7 @@ namespace Crow
Open.Raise (this, null);
}
protected virtual void onClose (object sender, EventArgs e){
+ System.Diagnostics.Debug.WriteLine ("close: " + this.ToString());
Close.Raise (this, null);
}
public override bool MouseIsIn (Point m)
@@ -170,6 +173,14 @@ namespace Crow
IsOpened = false;
base.onMouseLeave (this, e);
}
+
+ void closeMenu () {
+ MenuItem tmp = LogicalParent as MenuItem;
+ while (tmp != null) {
+ tmp.IsOpened = false;
+ tmp = tmp.LogicalParent as MenuItem;
+ }
+ }
}
}