aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-30 13:18:21 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-09-01 12:44:39 +0200
commite68f66a334bd37c60416615d8314a62dd9d05740 (patch)
treee5470014265563fd480427fe841013834668e405 /src
parent8e0a800f3fdec3ce0815ac797f365837eec67d30 (diff)
debug mouse focus
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/GraphicObject.cs22
-rw-r--r--src/GraphicObjects/TemplatedGroup.cs1
-rw-r--r--src/Interface.cs30
3 files changed, 29 insertions, 24 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 28e45d30..f5b19bb0 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -116,7 +116,7 @@ namespace Crow
/// This size is computed on each child' layout changes.
/// In stacking widget, it is used to compute the remaining space for the stretched
/// widget inside the stack, which is never added to the contentSize, instead, its size
- /// is deducted from (parent.ClientRectangle - contentSize)
+ /// is deducted from (parent.ClientRectangle - contentSize)
/// </summary>
internal Size contentSize;
#endregion
@@ -600,7 +600,7 @@ namespace Crow
if (string.IsNullOrEmpty (styleKey))
styleKey = thisType.FullName;
-
+
//Reflexion being very slow compared to dyn method or delegates,
//I compile the initial values coded in the CustomAttribs of the class,
//all other instance of this type would not longer use reflexion to init properly
@@ -1140,12 +1140,11 @@ namespace Crow
if (Interface.clickTimer.ElapsedMilliseconds > 0 &&
Interface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick) {
Interface.clickTimer.Reset ();
- Debug.WriteLine ("double click");
onMouseDoubleClick (this, e);
return;
} else
Interface.clickTimer.Restart ();
-
+
GraphicObject p = Parent as GraphicObject;
if (p != null)
p.onMouseClick(sender,e);
@@ -1160,7 +1159,7 @@ namespace Crow
public virtual void onMouseWheel(object sender, MouseWheelEventArgs e){
GraphicObject p = Parent as GraphicObject;
if (p != null)
- p.onMouseWheel(this,e);
+ p.onMouseWheel(sender,e);
MouseWheelChanged.Raise (this, e);
}
@@ -1177,6 +1176,17 @@ namespace Crow
Debug.WriteLine("MouseLeave => " + this.ToString());
#endif
MouseLeave.Raise (this, e);
+
+ GraphicObject p = Parent as GraphicObject;
+ CurrentInterface.HoverWidget = p;
+
+ if (p == null)
+ return;
+
+ if (p.MouseIsIn (e.Position)&&e!=null)
+ p.checkHoverWidget (e);
+ else
+ p.onMouseLeave (sender, e);
}
#endregion
@@ -1356,7 +1366,7 @@ namespace Crow
}
public virtual void ReadXml (System.Xml.XmlReader reader)
{
- if (reader.HasAttributes) {
+ if (reader.HasAttributes) {
style = reader.GetAttribute ("Style");
diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs
index 704b59af..f7f849c0 100644
--- a/src/GraphicObjects/TemplatedGroup.cs
+++ b/src/GraphicObjects/TemplatedGroup.cs
@@ -39,7 +39,6 @@ namespace Crow
public virtual void AddItem(GraphicObject g){
items.AddChild (g);
NotifyValueChanged ("HasChildren", true);
- //g.LogicalParent = this;
}
public virtual void RemoveItem(GraphicObject g)
{
diff --git a/src/Interface.cs b/src/Interface.cs
index 5ad638b4..73f44a6a 100644
--- a/src/Interface.cs
+++ b/src/Interface.cs
@@ -572,7 +572,8 @@ namespace Crow
int i = 0;
while (i < idxhw) {
if (GraphicTree [i].MouseIsIn (e.Position)) {
- HoverWidget.onMouseLeave (HoverWidget, e);
+ //set evtarg to null to force mouseLeave without checking mouse pos
+ HoverWidget.onMouseLeave (HoverWidget, null);
GraphicTree [i].checkHoverWidget (e);
return true;
}
@@ -586,26 +587,21 @@ namespace Crow
return true;
} else {
HoverWidget.onMouseLeave (HoverWidget, e);
- //seek upward from last focused graph obj's
- while (HoverWidget.Parent as GraphicObject != null) {
- HoverWidget = HoverWidget.Parent as GraphicObject;
- if (HoverWidget.MouseIsIn (e.Position)) {
- HoverWidget.checkHoverWidget (e);
- return true;
- } else
- HoverWidget.onMouseLeave (HoverWidget, e);
- }
+ if (HoverWidget != null)
+ return true;
}
}
//top level graphic obj's parsing
- for (int i = 0; i < GraphicTree.Count; i++) {
- GraphicObject g = GraphicTree[i];
- if (g.MouseIsIn (e.Position)) {
- g.checkHoverWidget (e);
- if (g is Window)
- PutOnTop (g);
- return true;
+ lock (GraphicTree) {
+ for (int i = 0; i < GraphicTree.Count; i++) {
+ GraphicObject g = GraphicTree [i];
+ if (g.MouseIsIn (e.Position)) {
+ g.checkHoverWidget (e);
+ if (g is Window)
+ PutOnTop (g);
+ return true;
+ }
}
}
HoverWidget = null;