diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-12-21 05:24:46 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-12-21 05:24:46 +0100 |
| commit | 478959aad0df1b870304e1d64f6b284994c2feeb (patch) | |
| tree | 321a293e5c4531fcf1c170e2cc2ff5fe902bd233 /CrowIDE/src/DesignInterface.cs | |
| parent | 76981dce006e02bda96668f2559c9047afe23f8a (diff) | |
rename GraphicObject to Widget
Diffstat (limited to 'CrowIDE/src/DesignInterface.cs')
| -rw-r--r-- | CrowIDE/src/DesignInterface.cs | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/CrowIDE/src/DesignInterface.cs b/CrowIDE/src/DesignInterface.cs index 4d65e8d2..ae9af80c 100644 --- a/CrowIDE/src/DesignInterface.cs +++ b/CrowIDE/src/DesignInterface.cs @@ -61,9 +61,28 @@ namespace Crow.Coding public ProjectFile ProjFile; + + public override Widget CreateInstance (string path) + { + ProjectFile pi; + + if (ProjFile.Project.solution.GetProjectFileFromPath (path, out pi)) + return CreateITorFromIMLFragment (pi.Source).CreateInstance(); + + return null; + } + public override Stream GetStreamFromPath (string path) + { + ProjectFile pi; + if (ProjFile.Project.solution.GetProjectFileFromPath (path, out pi)) { + return new FileStream (pi.AbsolutePath, FileMode.Open); + } + throw new Exception ($"In Design File not found: {path}"); + } + protected override void InitBackend () { - surf = new ImageSurface(Format.Argb32, 100, 100); + surf = new ImageSurface (Format.Argb32, 100, 100); } public override void ProcessResize (Rectangle bounds) { @@ -72,32 +91,15 @@ namespace Crow.Coding lock (UpdateMutex) { clientRectangle = bounds; surf.Dispose (); - surf = new ImageSurface(Format.Argb32, clientRectangle.Width, clientRectangle.Height); + surf = new ImageSurface (Format.Argb32, clientRectangle.Width, clientRectangle.Height); - foreach (GraphicObject g in GraphicTree) + foreach (Widget g in GraphicTree) g.RegisterForLayouting (LayoutingType.All); RegisterClip (clientRectangle); } } - public override GraphicObject CreateInstance (string path) - { - ProjectFile pi; - - if (ProjFile.Project.solution.GetProjectFileFromPath (path, out pi)) - return CreateITorFromIMLFragment (pi.Source).CreateInstance(); - - return null; - } - public override System.IO.Stream GetStreamFromPath (string path) - { - ProjectFile pi; - if (ProjFile.Project.solution.GetProjectFileFromPath (path, out pi)) { - return new FileStream (pi.AbsolutePath, FileMode.Open); - } - throw new Exception ($"In Design File not found: {path}"); - } public override bool ProcessMouseMove (int x, int y) { int deltaX = x - Mouse.X; @@ -118,11 +120,11 @@ namespace Crow.Coding if (HoverWidget != null) { //check topmost graphicobject first - GraphicObject tmp = HoverWidget; - GraphicObject topc = null; - while (tmp is GraphicObject) { + Widget tmp = HoverWidget; + Widget topc = null; + while (tmp is Widget) { topc = tmp; - tmp = tmp.LogicalParent as GraphicObject; + tmp = tmp.LogicalParent as Widget; } int idxhw = GraphicTree.IndexOf (topc); if (idxhw != 0) { @@ -132,7 +134,7 @@ namespace Crow.Coding if (GraphicTree [i].MouseIsIn (e.Position)) { while (HoverWidget != null) { HoverWidget.onMouseLeave (HoverWidget, e); - HoverWidget = HoverWidget.LogicalParent as GraphicObject; + HoverWidget = HoverWidget.LogicalParent as Widget; } GraphicTree [i].checkHoverWidget (e); @@ -150,8 +152,8 @@ namespace Crow.Coding } else { HoverWidget.onMouseLeave (HoverWidget, e); //seek upward from last focused graph obj's - while (HoverWidget.LogicalParent as GraphicObject != null) { - HoverWidget = HoverWidget.LogicalParent as GraphicObject; + while (HoverWidget.LogicalParent as Widget != null) { + HoverWidget = HoverWidget.LogicalParent as Widget; if (HoverWidget.MouseIsIn (e.Position)) { HoverWidget.checkHoverWidget (e); return true; @@ -164,7 +166,7 @@ namespace Crow.Coding //top level graphic obj's parsing lock (GraphicTree) { for (int i = 0; i < GraphicTree.Count; i++) { - GraphicObject g = GraphicTree [i]; + Widget g = GraphicTree [i]; if (g.MouseIsIn (e.Position)) { if (!(HoverWidget is TemplatedControl)) g.checkHoverWidget (e); |