aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2017-01-04 19:28:43 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2017-01-04 19:28:43 +0100
commit0a309c9271d09893e682bd2568151f81036eae13 (patch)
tree6bfd10e5624d9e0dbb26dc282f8ac1822b226b51
parent88e6f84a15a0bdbdd29f39014afff19f4362b3e9 (diff)
debug menus
-rw-r--r--src/GraphicObjects/MenuItem.cs22
-rw-r--r--src/GraphicObjects/Popper.cs35
-rw-r--r--src/Interface.cs20
3 files changed, 45 insertions, 32 deletions
diff --git a/src/GraphicObjects/MenuItem.cs b/src/GraphicObjects/MenuItem.cs
index 9fc0b226..87744ef9 100644
--- a/src/GraphicObjects/MenuItem.cs
+++ b/src/GraphicObjects/MenuItem.cs
@@ -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);
}
}
}
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index 1b8c0d95..38621337 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -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
diff --git a/src/Interface.cs b/src/Interface.cs
index cb541fb0..542cf2dd 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -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++;
}