aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GraphicObject.cs
diff options
context:
space:
mode:
authorj-p <jp.bruyere@live.be>2018-01-30 01:28:26 +0100
committerGitHub <noreply@github.com>2018-01-30 01:28:26 +0100
commitd51e2cb08b0d2b113297e0201b88ac0b2657ac95 (patch)
treef2fb49513036527178b5ad33109622cfce3dfbff /src/GraphicObjects/GraphicObject.cs
parent9015042f06059cef3f8880bf1dea19be310ec286 (diff)
iface param ctor #38
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
-rw-r--r--src/GraphicObjects/GraphicObject.cs52
1 files changed, 23 insertions, 29 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 1ba524d7..954c08e7 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -64,17 +64,17 @@ namespace Crow
if (IsQueueForRedraw)
throw new Exception("Trying to dispose an object queued for Redraw: " + this.ToString());
#endif
- if (currentInterface.HoverWidget != null) {
- if (currentInterface.HoverWidget.IsOrIsInside(this))
- currentInterface.HoverWidget = null;
+ if (CurrentInterface.HoverWidget != null) {
+ if (CurrentInterface.HoverWidget.IsOrIsInside(this))
+ CurrentInterface.HoverWidget = null;
}
- if (currentInterface.ActiveWidget != null) {
- if (currentInterface.ActiveWidget.IsOrIsInside (this))
- currentInterface.ActiveWidget = null;
+ if (CurrentInterface.ActiveWidget != null) {
+ if (CurrentInterface.ActiveWidget.IsOrIsInside (this))
+ CurrentInterface.ActiveWidget = null;
}
- if (currentInterface.FocusedWidget != null) {
- if (currentInterface.FocusedWidget.IsOrIsInside (this))
- currentInterface.FocusedWidget = null;
+ if (CurrentInterface.FocusedWidget != null) {
+ if (CurrentInterface.FocusedWidget.IsOrIsInside (this))
+ CurrentInterface.FocusedWidget = null;
}
if (!localDataSourceIsNull)
DataSource = null;
@@ -91,20 +91,7 @@ namespace Crow
internal static ulong currentUid = 0;
internal ulong uid = 0;
- Interface currentInterface = null;
-
- [XmlIgnore]public Interface CurrentInterface {
- get {
- if (currentInterface == null) {
- currentInterface = Interface.CurrentInterface;
- Initialize ();
- }
- return currentInterface;
- }
- set {
- currentInterface = value;
- }
- }
+ public Interface CurrentInterface = null;
public Region Clipping;
@@ -118,13 +105,20 @@ namespace Crow
#endregion
#region CTOR
- public GraphicObject ()
- {
+ /// <summary>
+ /// default private parameter less constructor use in instantiators
+ /// </summary>
+ protected GraphicObject () {
Clipping = new Region ();
#if DEBUG
uid = currentUid;
currentUid++;
- #endif
+ #endif
+ }
+ public GraphicObject (Interface iface) : this()
+ {
+ CurrentInterface = iface;
+ Initialize ();
}
#endregion
internal bool initialized = false;
@@ -132,8 +126,8 @@ namespace Crow
/// Initialize this Graphic object instance by setting style and default values and loading template if required
/// </summary>
public virtual void Initialize(){
- if (currentInterface == null)
- currentInterface = Interface.CurrentInterface;
+// if (CurrentInterface == null)
+// CurrentInterface = Interface.CurrentInterface;
loadDefaultValues ();
initialized = true;
}
@@ -1336,7 +1330,7 @@ namespace Crow
if (CurrentInterface.eligibleForDoubleClick == this && CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
onMouseDoubleClick (this, e);
else
- currentInterface.clickTimer.Restart();
+ CurrentInterface.clickTimer.Restart();
CurrentInterface.eligibleForDoubleClick = null;
if (CurrentInterface.ActiveWidget == null)