]> O.S.I.I.S - jp/crow.git/commitdiff
MenuItem execute
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 20 Aug 2016 18:02:22 +0000 (20:02 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 1 Sep 2016 10:44:39 +0000 (12:44 +0200)
Templates/MenuItem.template
Tests/BasicTests.cs
Tests/Interfaces/TemplatedGroup/0.crow
src/GraphicObjects/MenuItem.cs

index 3d7d9211fad6d7fc7d827ea853363c10ec65b9a3..81b95eeeb9be94e6e3e743d4d42ba99568fa3093 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <Popper Caption="{./Caption}"  Background="{./Background}" PopDirection="{./Orientation}"
-       Foreground = "{./Foreground}" CanPop="{./HasChildren}"
+       Foreground = "{./Foreground}" CanPop="{./HasChildren}" MouseClick="./onMI_Click"
        Unpop = "{Foreground=LightGray;Background=Transparent}">
        <Template>
                <Label Text="{./Caption}"
index b2299f42445577c877aa3719078e30521903a6ed..e8bec2d612361be0d5f90997244573a30f38d7c4 100644 (file)
@@ -199,5 +199,8 @@ namespace Tests
                        string test = e.Time.ToString ();
                        NotifyValueChanged ("PropertyLessBinding", test);
                }
+               void onNew(object sender, EventArgs e){
+                       Debug.WriteLine ("menu new clicked");
+               }
        }
 }
index 09b4bd49decbf5bfecf77d979c9f8999e06c5c9e..1ab5f9add288b2ba57de1851ba8a786f746ecd34 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <Menu>
        <MenuItem Caption="File">
-               <MenuItem Caption="New"/>
+               <MenuItem Caption="New" Execute="onNew"/>
                <MenuItem Caption="Open"/>
                <MenuItem Caption="Save"/>
                <MenuItem Caption="Quit"/>
index 2734377e995149b5cf69e779a067edb9fbc9845e..dd39524cc844f377078ef11bedba29670c8427aa 100644 (file)
@@ -30,11 +30,10 @@ namespace Crow
                public MenuItem () : base() {}
                #endregion
 
-//             public event EventHandler Pop;
-//             public event EventHandler Unpop;
+               public event EventHandler Execute;
 
                string caption;
-               Command command;
+               Command command;//TODO
 
                [XmlAttributeAttribute()][DefaultValue(null)]
                public virtual Command Command {
@@ -75,5 +74,11 @@ namespace Crow
                        base.AddItem (g);
                        g.NotifyValueChanged ("Orientation", Alignment.Right);
                }
+
+               void onMI_Click (object sender, MouseButtonEventArgs e)
+               {
+                       Execute.Raise (this, null);
+               }
        }
 }
+