aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-13 02:26:03 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-13 02:26:03 +0100
commit2a44a31d02f13312ee081b7730485518ed5b0b74 (patch)
treea9b0992f0a14e93d0d79d0b2a57aa400850880b3 /src
parent103791b80ca11386a5f6d0b7dd5240c266c9d192 (diff)
MouseCursor property in GOLIBHost; IsActive Prop in GraphicObject
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/GraphicObject.cs17
-rw-r--r--src/GraphicObjects/IGOLibHost.cs1
-rw-r--r--src/OpenTKGameWindow.cs16
3 files changed, 27 insertions, 7 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 85166d4f..1f07e922 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -79,6 +79,7 @@ namespace Crow
int _margin = 0;
bool _focusable = false;
bool _hasFocus = false;
+ bool _isActive = false;
bool _mouseRepeat;
protected bool _isVisible = true;
VerticalAlignment _verticalAlignment = VerticalAlignment.Center;
@@ -121,11 +122,9 @@ namespace Crow
/// <summary>
/// Parent in the graphic tree, used for rendering and layouting
/// </summary>
- [XmlIgnore]public ILayoutable Parent {
+ [XmlIgnore]public virtual ILayoutable Parent {
get { return _parent; }
- set {
- _parent = value;
- }
+ set { _parent = value; }
}
public ILayoutable LogicalParent {
@@ -295,6 +294,16 @@ namespace Crow
NotifyValueChanged ("HasFocus", _hasFocus);
}
}
+ [XmlIgnore]public virtual bool IsActive {
+ get { return _isActive; }
+ set {
+ if (value == _isActive)
+ return;
+
+ _isActive = value;
+ NotifyValueChanged ("IsActive", _isActive);
+ }
+ }
[XmlAttributeAttribute()][DefaultValue(false)]
public virtual bool MouseRepeat {
get { return _mouseRepeat; }
diff --git a/src/GraphicObjects/IGOLibHost.cs b/src/GraphicObjects/IGOLibHost.cs
index 1cf6978c..5c842e32 100644
--- a/src/GraphicObjects/IGOLibHost.cs
+++ b/src/GraphicObjects/IGOLibHost.cs
@@ -9,6 +9,7 @@ namespace Crow
GraphicObject activeWidget { get; set; }
GraphicObject hoverWidget { get; set; }
GraphicObject FocusedWidget { get; set; }
+ XCursor MouseCursor { set; }
void AddWidget (GraphicObject g);
void DeleteWidget(GraphicObject g);
void PutOnTop (GraphicObject g);
diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs
index 00035390..a9d04714 100644
--- a/src/OpenTKGameWindow.cs
+++ b/src/OpenTKGameWindow.cs
@@ -63,6 +63,9 @@ namespace Crow
}
}
+ public XCursor MouseCursor {
+ set { Cursor = value; }
+ }
public List<GraphicObject> gobjsToRedraw {
get {
return _gobjsToRedraw;
@@ -107,10 +110,17 @@ namespace Crow
{
get { return _activeWidget; }
set
- {
+ {
if (_activeWidget == value)
- return;
+ return;
+
+ if (_activeWidget != null)
+ _activeWidget.IsActive = false;
+
_activeWidget = value;
+
+ if (_activeWidget != null)
+ _activeWidget.IsActive = true;
}
}
public GraphicObject hoverWidget
@@ -418,7 +428,7 @@ namespace Crow
} else {
//send move evt even if mouse move outside bounds
- _activeWidget.onMouseMove (_activeWidget, e);
+ _activeWidget.onMouseMove (this, e);
return;
}
}