]> O.S.I.I.S - jp/crow.git/commitdiff
debug menus
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 4 Jan 2017 18:28:43 +0000 (19:28 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 4 Jan 2017 18:28:43 +0000 (19:28 +0100)
src/GraphicObjects/MenuItem.cs
src/GraphicObjects/Popper.cs
src/Interface.cs

index 9fc0b226ad1729f61ea2d5148d0add215d564b3a..87744ef9b911a701254a0e52552a0e340a02ec91 100644 (file)
@@ -40,7 +40,6 @@ namespace Crow
 
                [XmlAttributeAttribute][DefaultValue(false)]
                public bool IsOpened {
-                       //get { return MenuRoot == null ? false : MenuRoot.IsOpened; }
                        get { return isOpened; }
                        set {
                                if (isOpened == value)
@@ -48,11 +47,9 @@ namespace Crow
                                isOpened = value;
                                NotifyValueChanged ("IsOpened", isOpened);
 
-                               if (isOpened) {
+                               if (isOpened)
                                        onOpen (this, null);
-//                                     if (MenuRoot != null)
-//                                             MenuRoot.IsOpened = true;
-                               }else
+                               else
                                        onClose (this, null);
                        }
                }
@@ -102,19 +99,20 @@ namespace Crow
                        Execute.Raise (this, null);
                }
                protected virtual void onOpen (object sender, EventArgs e){
-                       //MenuRoot.IsOpened = true;
                        Open.Raise (this, null);
                }
                protected virtual void onClose (object sender, EventArgs e){
-                       //MenuRoot.IsOpened = true;
                        Close.Raise (this, null);
                }
-               public override void onMouseEnter (object sender, MouseMoveEventArgs e)
+               public override bool MouseIsIn (Point m)
                {
-                       base.onMouseEnter (sender, e);
-                       if (MenuRoot == null || Items.Count == 0)
-                               return;
-                       IsOpened = MenuRoot.IsOpened;
+                       return base.MouseIsIn (m) || child.MouseIsIn (m);
+               }
+               public override void onMouseLeave (object sender, MouseMoveEventArgs e)
+               {
+                       if (IsOpened)
+                               IsOpened = false;
+                       base.onMouseLeave (this, e);
                }
        }
 }
index 1b8c0d95c713556129ab9163e4c28f250239d725..3862133710b95208d0994a21ab1eb050ee1b7b42 100644 (file)
@@ -180,20 +180,37 @@ namespace Crow
                {
                        if (_canPop)
                                IsPopped = !IsPopped;
-                       base.onMouseClick (sender, e);
+                       base.onMouseClick (this, e);
                }
                public override void onMouseLeave (object sender, MouseMoveEventArgs e)
                {
-                       if (!_isPopped || _content == null) {
-                               base.onMouseLeave (sender, e);
-                               return;
+                       base.onMouseLeave (this, e);
+                       IsPopped = false;
+               }
+               public override bool MouseIsIn (Point m)
+               {
+                       bool isInContent = false;
+                       if (Content != null) {
+                               if (Content.Parent != null)
+                                       isInContent = Content.MouseIsIn (m);
                        }
-
-                       if (!_content.MouseIsIn (e.Position)) {
-                               base.onMouseLeave (sender, e);
-                               IsPopped = false;
-                               return;
+                       return base.MouseIsIn (m) || isInContent;
+               }
+               public override void checkHoverWidget (MouseMoveEventArgs e)
+               {
+                       if (CurrentInterface.HoverWidget != this) {
+                               CurrentInterface.HoverWidget = this;
+                               onMouseEnter (this, e);
+                       }
+                       if (Content != null){
+                               if (Content.Parent != null) {
+                                       if (Content.MouseIsIn (e.Position)) {
+                                               Content.checkHoverWidget (e);
+                                               return;
+                                       }
+                               }
                        }
+                       base.checkHoverWidget (e);
                }
                #endregion
 
index cb541fb05bf13cf9b9c219e91df37c9e00b75d4e..542cf2dd7af090acdc113ac5a6c7aa49f2fd6508 100644 (file)
@@ -582,24 +582,22 @@ namespace Crow
                                GraphicObject topc = null;
                                while (tmp is GraphicObject) {
                                        topc = tmp;
-                                       tmp = tmp.Parent as GraphicObject;
+                                       tmp = tmp.LogicalParent as GraphicObject;
                                }
                                int idxhw = GraphicTree.IndexOf (topc);
                                if (idxhw != 0) {
                                        int i = 0;
                                        while (i < idxhw) {
-                                               if (GraphicTree [i].MouseIsIn (e.Position)) {
-                                                       while (HoverWidget != null) {
-                                                               if (HoverWidget is Popper) {
-                                                                       if ((HoverWidget as Popper).Content == GraphicTree[i])
-                                                                               break;
+                                               if (GraphicTree [i].localLogicalParentIsNull) {
+                                                       if (GraphicTree [i].MouseIsIn (e.Position)) {
+                                                               while (HoverWidget != null) {
+                                                                       HoverWidget.onMouseLeave (HoverWidget, e);
+                                                                       HoverWidget = HoverWidget.LogicalParent as GraphicObject;
                                                                }
-                                                               HoverWidget.onMouseLeave (HoverWidget, e);
-                                                               HoverWidget = HoverWidget.LogicalParent as GraphicObject;
-                                                       }
 
-                                                       GraphicTree [i].checkHoverWidget (e);
-                                                       return true;
+                                                               GraphicTree [i].checkHoverWidget (e);
+                                                               return true;
+                                                       }
                                                }
                                                i++;
                                        }