aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-17 03:18:23 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-17 03:18:23 +0100
commitda3cb49100440029d1694e50800260d6286ccf8b (patch)
tree9bd243735b0f272ebce143619630e8e11a040ccf /src/GraphicObjects
parent81355c4df1b311dca6150c48a477ee367c78e0bf (diff)
focusParent
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/GraphicObject.cs17
-rw-r--r--src/GraphicObjects/Popper.cs12
2 files changed, 17 insertions, 12 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index dd7efbe2..15730905 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -93,6 +93,11 @@ namespace Crow
internal static ulong currentUid = 0;
internal ulong uid = 0;
+ internal bool isPopup = false;
+ internal GraphicObject focusParent {
+ get { return (isPopup ? LogicalParent : parent) as GraphicObject; }
+ }
+
/// <summary>
/// interface this widget is bound to, this should not be changed once the instance is created
/// </summary>
@@ -1541,7 +1546,7 @@ namespace Crow
IsDragged = true;
//bubble event to the top
- GraphicObject p = Parent as GraphicObject;
+ GraphicObject p = focusParent;
if (p != null)
p.onMouseMove(sender,e);
@@ -1566,7 +1571,7 @@ namespace Crow
}
}
//bubble event to the top
- GraphicObject p = Parent as GraphicObject;
+ GraphicObject p = focusParent;
if (p != null)
p.onMouseDown(sender,e);
@@ -1586,7 +1591,7 @@ namespace Crow
}
//bubble event to the top
- GraphicObject p = Parent as GraphicObject;
+ GraphicObject p = focusParent;
if (p != null)
p.onMouseUp(sender,e);
@@ -1599,19 +1604,19 @@ namespace Crow
}
}
public virtual void onMouseClick(object sender, MouseButtonEventArgs e){
- GraphicObject p = Parent as GraphicObject;
+ GraphicObject p = focusParent;
if (p != null)
p.onMouseClick(sender,e);
MouseClick.Raise (this, e);
}
public virtual void onMouseDoubleClick(object sender, MouseButtonEventArgs e){
- GraphicObject p = Parent as GraphicObject;
+ GraphicObject p = focusParent;
if (p != null)
p.onMouseDoubleClick(sender,e);
MouseDoubleClick.Raise (this, e);
}
public virtual void onMouseWheel(object sender, MouseWheelEventArgs e){
- GraphicObject p = Parent as GraphicObject;
+ GraphicObject p = focusParent;
if (p != null)
p.onMouseWheel(sender,e);
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index ea7b635a..70804bda 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -72,10 +72,14 @@ namespace Crow
get { return _isPopped; }
set
{
+ if (!_canPop & value)
+ return;
+
if (value == _isPopped)
return;
_isPopped = value;
+
NotifyValueChanged ("IsPopped", _isPopped);
if (_isPopped)
@@ -115,6 +119,7 @@ namespace Crow
set {
if (_content != null) {
_content.LogicalParent = null;
+ _content.isPopup = false;
_content.LayoutChanged -= _content_LayoutChanged;
}
@@ -124,6 +129,7 @@ namespace Crow
return;
_content.LogicalParent = this;
+ _content.isPopup = true;
_content.HorizontalAlignment = HorizontalAlignment.Left;
_content.VerticalAlignment = VerticalAlignment.Top;
_content.LayoutChanged += _content_LayoutChanged;
@@ -181,12 +187,6 @@ namespace Crow
}
#region GraphicObject overrides
- public override void onMouseClick (object sender, MouseButtonEventArgs e)
- {
- if (_canPop)
- IsPopped = !IsPopped;
- base.onMouseClick (this, e);
- }
public override void onMouseLeave (object sender, MouseMoveEventArgs e)
{
base.onMouseLeave (this, e);