From: jpbruyere Date: Sat, 13 Feb 2016 01:26:03 +0000 (+0100) Subject: MouseCursor property in GOLIBHost; IsActive Prop in GraphicObject X-Git-Tag: v0.4~130 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=2a44a31d02f13312ee081b7730485518ed5b0b74;p=jp%2Fcrow.git MouseCursor property in GOLIBHost; IsActive Prop in GraphicObject --- 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 /// /// Parent in the graphic tree, used for rendering and layouting /// - [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 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; } }