aboutsummaryrefslogtreecommitdiffstatsci
path: root/MonoDevelop.GOLib
diff options
context:
space:
mode:
Diffstat (limited to 'MonoDevelop.GOLib')
-rw-r--r--MonoDevelop.GOLib/MonoDevelop.Crow.addin.xml (renamed from MonoDevelop.GOLib/MonoDevelop.GOLib.addin.xml)9
-rw-r--r--MonoDevelop.GOLib/MonoDevelop.Crow.csproj (renamed from MonoDevelop.GOLib/MonoDevelop.GOLib.csproj)83
-rw-r--r--MonoDevelop.GOLib/Properties/AddinInfo.cs4
-rw-r--r--MonoDevelop.GOLib/Properties/AssemblyInfo.cs4
-rw-r--r--MonoDevelop.GOLib/src/CrowDisplayBinding.cs (renamed from MonoDevelop.GOLib/src/DisplayBinding.cs)11
-rw-r--r--MonoDevelop.GOLib/src/CrowNodeExtension.cs (renamed from MonoDevelop.GOLib/src/GOLibNodeExtension.cs)10
-rw-r--r--MonoDevelop.GOLib/src/CrowView.cs (renamed from MonoDevelop.GOLib/src/GOLibView.cs)44
-rw-r--r--MonoDevelop.GOLib/src/GOLibGtkHost.cs12
-rw-r--r--MonoDevelop.GOLib/src/XwtContainer.cs209
9 files changed, 307 insertions, 79 deletions
diff --git a/MonoDevelop.GOLib/MonoDevelop.GOLib.addin.xml b/MonoDevelop.GOLib/MonoDevelop.Crow.addin.xml
index fe15b3e9..6155263e 100644
--- a/MonoDevelop.GOLib/MonoDevelop.GOLib.addin.xml
+++ b/MonoDevelop.GOLib/MonoDevelop.Crow.addin.xml
@@ -1,17 +1,20 @@
<ExtensionModel>
<Extension path = "/MonoDevelop/Ide/DisplayBindings">
<DisplayBinding
- id = "GOLib designer"
+ id = "Crow designer"
insertafter ="AssemblyBrowser"
- class = "MonoDevelop.GOLib.GOLibDisplayBinding" />
+ class = "MonoDevelop.Crow.CrowDisplayBinding" />
</Extension>
<Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
- <NodeBuilder id = "GOLibNodeExtension" class = "MonoDevelop.GOLib.GOLibNodeExtension"/>
+ <NodeBuilder id = "CrowNodeExtension" class = "MonoDevelop.Crow.CrowNodeExtension"/>
</Extension>
<Extension path = "/MonoDevelop/Core/MimeTypes">
<MimeType id="text/x-goml" _description="GOlib interface definition" icon="md-csharp-file" isText="false">
<File pattern="*.goml" />
</MimeType>
+ <MimeType id="text/x-crow" _description="Crow interface definition" icon="md-csharp-file" isText="false">
+ <File pattern="*.crow" />
+ </MimeType>
</Extension>
<!-- <Extension path = "/MonoDevelop/DesignerSupport/PropertyProviders" extension-nodes="Class">
<Class class = "MonoDevelop.GOLib.GOLibItemPropertyProvider"/>
diff --git a/MonoDevelop.GOLib/MonoDevelop.GOLib.csproj b/MonoDevelop.GOLib/MonoDevelop.Crow.csproj
index b09de992..31683755 100644
--- a/MonoDevelop.GOLib/MonoDevelop.GOLib.csproj
+++ b/MonoDevelop.GOLib/MonoDevelop.Crow.csproj
@@ -7,13 +7,13 @@
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E9E14DB5-3C67-4E01-B5C3-4D90D7E31A2E}</ProjectGuid>
<OutputType>Library</OutputType>
- <RootNamespace>MonoDevelop.GOLib</RootNamespace>
- <AssemblyName>MonoDevelop.GOLib</AssemblyName>
+ <RootNamespace>MonoDevelop.Crow</RootNamespace>
+ <AssemblyName>MonoDevelop.Crow</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<OutputPath>build</OutputPath>
<CustomCommands>
<CustomCommands>
- <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/usr/local/lib/monodevelop/bin">
+ <Command type="Execute" command="/opt/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/opt/lib/monodevelop/bin">
<EnvironmentVariables>
<Variable name="MONODEVELOP_DEV_ADDINS" value="${TargetDir}" />
<Variable name="MONODEVELOP_CONSOLE_LOG_LEVEL" value="UpToDebug" />
@@ -35,9 +35,16 @@
<ConsolePause>false</ConsolePause>
<CustomCommands>
<CustomCommands>
- <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/usr/local/lib/monodevelop/bin" />
+ <Command type="Execute" command="/opt/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/opt/lib/monodevelop/bin">
+ <EnvironmentVariables>
+ <Variable name="MONODEVELOP_DEV_ADDINS" value="${TargetDir}" />
+ <Variable name="MONODEVELOP_CONSOLE_LOG_LEVEL" value="UpToDebug" />
+ <Variable name="MONODEVELOP_LOGGING_PAD_LEVEL" value="UpToDebug" />
+ <Variable name="MONODEVELOP_CONSOLE_LOG_USE_COLOUR" value="True" />
+ </EnvironmentVariables>
+ </Command>
</CustomCommands>
- </CustomCommands>
+ </CustomCommands> <OutputPath>..\MonoDevelop.Crow\build</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
@@ -47,67 +54,78 @@
<ConsolePause>false</ConsolePause>
<CustomCommands>
<CustomCommands>
- <Command type="Execute" command="/usr/local/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/usr/local/lib/monodevelop/bin" />
+ <Command type="Execute" command="/opt/lib/monodevelop/bin/MonoDevelop.exe --no-redirect" workingdir="/opt/lib/monodevelop/bin">
+ <EnvironmentVariables>
+ <Variable name="MONODEVELOP_DEV_ADDINS" value="${TargetDir}" />
+ <Variable name="MONODEVELOP_CONSOLE_LOG_LEVEL" value="UpToDebug" />
+ <Variable name="MONODEVELOP_LOGGING_PAD_LEVEL" value="UpToDebug" />
+ <Variable name="MONODEVELOP_CONSOLE_LOG_USE_COLOUR" value="True" />
+ </EnvironmentVariables>
+ </Command>
</CustomCommands>
</CustomCommands>
+ <OutputPath>..\MonoDevelop.Crow\build</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="ICSharpCode.NRefactory">
- <HintPath>\usr\local\lib\monodevelop\bin\ICSharpCode.NRefactory.dll</HintPath>
- </Reference>
- <Reference Include="Mono.Addins">
- <Package>mono-addins</Package>
+ <HintPath>\opt\lib\monodevelop\bin\ICSharpCode.NRefactory.dll</HintPath>
</Reference>
<Reference Include="MonoDevelop.Ide">
- <HintPath>\usr\local\lib\monodevelop\bin\MonoDevelop.Ide.dll</HintPath>
+ <HintPath>\opt\lib\monodevelop\bin\MonoDevelop.Ide.dll</HintPath>
</Reference>
<Reference Include="MonoDevelop.Core">
- <HintPath>\usr\local\lib\monodevelop\bin\MonoDevelop.Core.dll</HintPath>
+ <HintPath>\opt\lib\monodevelop\bin\MonoDevelop.Core.dll</HintPath>
</Reference>
<Reference Include="MonoDevelop.DesignerSupport">
- <HintPath>\usr\local\lib\monodevelop\AddIns\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.dll</HintPath>
+ <HintPath>\opt\lib\monodevelop\AddIns\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.dll</HintPath>
</Reference>
- <Reference Include="Mono.Cairo" />
- <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="MonoDevelop.SourceEditor2">
+ <HintPath>\opt\lib\monodevelop\AddIns\DisplayBindings\SourceEditor\MonoDevelop.SourceEditor2.dll</HintPath>
+ </Reference>
+ <Reference Include="Mono.TextEditor">
+ <HintPath>\opt\lib\monodevelop\bin\Mono.TextEditor.dll</HintPath>
+ </Reference>
+ <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Package>gtk-sharp-2.0</Package>
</Reference>
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Package>gtk-sharp-2.0</Package>
</Reference>
- <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
- <Package>gtk-sharp-2.0</Package>
+ <Reference Include="gio-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Package>gio-sharp-2.0</Package>
</Reference>
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<Package>glib-sharp-2.0</Package>
</Reference>
- <Reference Include="System.Xml" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Drawing" />
- <Reference Include="OpenTK">
- <HintPath>..\..\opentk\Binaries\OpenTK\Release\OpenTK.dll</HintPath>
+ <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Package>gtk-sharp-2.0</Package>
</Reference>
- <Reference Include="MonoDevelop.SourceEditor2">
- <HintPath>..\..\..\..\..\usr\local\lib\monodevelop\AddIns\DisplayBindings\SourceEditor\MonoDevelop.SourceEditor2.dll</HintPath>
+ <Reference Include="Mono.Cairo" />
+ <Reference Include="Mono.Addins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+ <Package>mono-addins</Package>
</Reference>
- <Reference Include="Mono.TextEditor">
- <HintPath>..\..\..\..\..\usr\local\lib\monodevelop\bin\Mono.TextEditor.dll</HintPath>
+ <Reference Include="Xwt">
+ <HintPath>..\..\..\..\..\opt\lib\monodevelop\bin\Xwt.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AddinInfo.cs" />
- <Compile Include="src\DisplayBinding.cs" />
- <Compile Include="src\GOLibView.cs" />
- <Compile Include="src\GOLibNodeExtension.cs" />
- <Compile Include="src\GOLibGtkHost.cs" />
+ <Compile Include="src\CrowDisplayBinding.cs" />
+ <Compile Include="src\CrowView.cs" />
+ <Compile Include="src\CrowNodeExtension.cs" />
+ <Compile Include="src\XwtContainer.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="src\" />
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="MonoDevelop.GOLib.addin.xml" />
+ <EmbeddedResource Include="MonoDevelop.Crow.addin.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Crow.csproj">
@@ -115,4 +133,7 @@
<Name>Crow</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="src\GOLibGtkHost.cs" />
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/MonoDevelop.GOLib/Properties/AddinInfo.cs b/MonoDevelop.GOLib/Properties/AddinInfo.cs
index f5af5b8d..551c66db 100644
--- a/MonoDevelop.GOLib/Properties/AddinInfo.cs
+++ b/MonoDevelop.GOLib/Properties/AddinInfo.cs
@@ -3,12 +3,12 @@ using System;
using Mono.Addins;
using Mono.Addins.Description;
-[assembly:Addin ("GOLib",
+[assembly:Addin ("Crow",
Namespace = "MonoDevelop",
Version = MonoDevelop.BuildInfo.Version,
Category = "IDE extensions")]
-[assembly:AddinName ("MonoDevelop GOLib interface designer")]
+[assembly:AddinName ("MonoDevelop Crow interface designer")]
[assembly:AddinDescription ("")]
[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
diff --git a/MonoDevelop.GOLib/Properties/AssemblyInfo.cs b/MonoDevelop.GOLib/Properties/AssemblyInfo.cs
index 117b1534..a5fb350d 100644
--- a/MonoDevelop.GOLib/Properties/AssemblyInfo.cs
+++ b/MonoDevelop.GOLib/Properties/AssemblyInfo.cs
@@ -4,8 +4,8 @@ using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
-[assembly: AssemblyTitle ("MonoDevelop.GOLib")]
-[assembly: AssemblyDescription ("GOLib interface designer for MonoDevelop")]
+[assembly: AssemblyTitle ("MonoDevelop.Crow")]
+[assembly: AssemblyDescription ("Crow interface designer for MonoDevelop")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
diff --git a/MonoDevelop.GOLib/src/DisplayBinding.cs b/MonoDevelop.GOLib/src/CrowDisplayBinding.cs
index 1898f16b..0776de73 100644
--- a/MonoDevelop.GOLib/src/DisplayBinding.cs
+++ b/MonoDevelop.GOLib/src/CrowDisplayBinding.cs
@@ -52,15 +52,15 @@ using MonoDevelop.Projects;
using System.Globalization;
using System.Diagnostics;
-namespace MonoDevelop.GOLib
+namespace MonoDevelop.Crow
{
- class GOLibDisplayBinding : IViewDisplayBinding
+ class CrowDisplayBinding : IViewDisplayBinding
{
bool canHandle = false;
public string Name {
get {
- return GettextCatalog.GetString ("GOLib designer");
+ return GettextCatalog.GetString ("Crow designer");
}
}
public bool CanUseAsDefault
@@ -68,13 +68,14 @@ namespace MonoDevelop.GOLib
public IViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
{
- return new GOLibView ();
+ return new CrowView ();
}
public bool CanHandle (FilePath fileName, string mimeType, Project ownerProject)
{
- canHandle = mimeType.StartsWith("text/x-goml");
+ canHandle = mimeType.StartsWith("text/x-goml", System.StringComparison.OrdinalIgnoreCase) |
+ mimeType.StartsWith ("text/x-crow", System.StringComparison.OrdinalIgnoreCase);
return canHandle;
}
}
diff --git a/MonoDevelop.GOLib/src/GOLibNodeExtension.cs b/MonoDevelop.GOLib/src/CrowNodeExtension.cs
index 8c68d4cf..035f2353 100644
--- a/MonoDevelop.GOLib/src/GOLibNodeExtension.cs
+++ b/MonoDevelop.GOLib/src/CrowNodeExtension.cs
@@ -33,16 +33,16 @@ using MonoDevelop.Ide;
using System.Linq;
using MonoDevelop.DesignerSupport;
-namespace MonoDevelop.GOLib
+namespace MonoDevelop.Crow
{
enum Commands {
ShowGOLibViewer
}
- class GOLibNodeExtension : NodeBuilderExtension
+ class CrowNodeExtension : NodeBuilderExtension
{
public override Type CommandHandlerType {
- get { return typeof(GOLibCommandHandler); }
+ get { return typeof(CrowCommandHandler); }
}
public override bool CanBuildNode (Type dataType)
{
@@ -65,13 +65,13 @@ namespace MonoDevelop.GOLib
}
}
- class GOLibCommandHandler: NodeCommandHandler //, IPropertyPadProvider
+ class CrowCommandHandler: NodeCommandHandler //, IPropertyPadProvider
{
[CommandHandler (Commands.ShowGOLibViewer)]
protected void OnShowGOLibViewer ()
{
- GOLibView view = new GOLibView ();
+ CrowView view = new CrowView ();
ProjectFile file = CurrentNode.DataItem as ProjectFile;
diff --git a/MonoDevelop.GOLib/src/GOLibView.cs b/MonoDevelop.GOLib/src/CrowView.cs
index 52dbf2cb..abdac98a 100644
--- a/MonoDevelop.GOLib/src/GOLibView.cs
+++ b/MonoDevelop.GOLib/src/CrowView.cs
@@ -47,24 +47,18 @@
using System;
using System.IO;
-using MonoDevelop.Ide.Gui;
-using MonoDevelop.Ide.Gui.Content;
-using MonoDevelop.Ide.Fonts;
-using Mono.Addins;
-using MonoDevelop.Core;
-using MonoDevelop.Ide;
using Crow;
using MonoDevelop.DesignerSupport;
using MonoDevelop.SourceEditor;
-namespace MonoDevelop.GOLib
+namespace MonoDevelop.Crow
{
class CustomVPaned : Gtk.VPaned, IPropertyPadProvider
{
#region IPropertyPadProvider implementation
public object GetActiveComponent ()
{
- return this.Child1 == null ? this as object: (this.Child1 as GOLibGtkHost).activeWidget as object;
+ return this.Child1 == null ? this as object: (this.Child1 as XwtContainer).CrowInterface.activeWidget as object;
}
public object GetProvider ()
{
@@ -82,29 +76,29 @@ namespace MonoDevelop.GOLib
#endregion
}
- class GOLibView : SourceEditorView
+ class CrowView : SourceEditorView
{
- GOLibGtkHost gtkGoWidgetHost;
- CustomVPaned gtkGOMLWidget;
+ XwtContainer gtkCrowHost;
+ CustomVPaned gtkCrowWidget;
double zoom = 1.0;
public override Gtk.Widget Control {
get {
- return gtkGOMLWidget;
+ return gtkCrowWidget;
}
}
- public GOLibView () : base()
+ public CrowView () : base()
{
- gtkGoWidgetHost = new GOLibGtkHost ();
- gtkGOMLWidget = new CustomVPaned ();
- gtkGOMLWidget.CanFocus = true;
- gtkGOMLWidget.Name = "vpaned1";
- gtkGOMLWidget.Add (gtkGoWidgetHost);
- gtkGOMLWidget.Add (base.Control);
- gtkGOMLWidget.SizeAllocated += GtkGOMLWidget_SizeAllocated;
+ gtkCrowHost = new XwtContainer ();
+ gtkCrowWidget = new CustomVPaned ();
+ gtkCrowWidget.CanFocus = true;
+ gtkCrowWidget.Name = "vpaned1";
+ gtkCrowWidget.Add (gtkCrowHost);
+ gtkCrowWidget.Add (base.Control);
+ gtkCrowWidget.SizeAllocated += GtkGOMLWidget_SizeAllocated;
this.Document.DocumentUpdated += Document_DocumentUpdated;
//this.DirtyChanged += GOLibView_DirtyChanged;
@@ -128,23 +122,23 @@ namespace MonoDevelop.GOLib
writer.Flush ();
stream.Position = 0;
- gtkGoWidgetHost.Load (stream);
+ gtkCrowHost.CrowInterface.LoadInterface (stream);
}
}
}
void GtkGOMLWidget_SizeAllocated (object o, Gtk.SizeAllocatedArgs args)
{
- gtkGoWidgetHost.SetSizeRequest (-1, args.Allocation.Height / 2);
+ gtkCrowHost.SetSizeRequest (-1, args.Allocation.Height / 2);
}
public override void Load (string fileName)
{
- gtkGoWidgetHost.Load (fileName);
+ gtkCrowHost.CrowInterface.LoadInterface (fileName);
//ContentName = fileName;
//this.IsDirty = false;
- gtkGOMLWidget.ShowAll ();
- gtkGOMLWidget.Show ();
+ gtkCrowWidget.ShowAll ();
+ gtkCrowWidget.Show ();
base.Load (fileName);
}
diff --git a/MonoDevelop.GOLib/src/GOLibGtkHost.cs b/MonoDevelop.GOLib/src/GOLibGtkHost.cs
index 0069e3e7..1a86d457 100644
--- a/MonoDevelop.GOLib/src/GOLibGtkHost.cs
+++ b/MonoDevelop.GOLib/src/GOLibGtkHost.cs
@@ -1,20 +1,20 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.IO;
using System.Linq;
using Crow;
+using MonoDevelop.Components.Commands;
using MonoDevelop.Core;
+using MonoDevelop.DesignerSupport;
using MonoDevelop.Ide;
using MonoDevelop.Projects;
-using System.Diagnostics;
using OpenTK.Input;
-using MonoDevelop.DesignerSupport;
-using System.IO;
-using MonoDevelop.Components.Commands;
-namespace MonoDevelop.GOLib
+namespace MonoDevelop.Crow
{
- public class GOLibGtkHost : Gtk.DrawingArea, ILayoutable, IGOLibHost, IPropertyPadProvider,ICommandDelegator
+ public class GOLibGtkHost : Gtk.DrawingArea, IPropertyPadProvider,ICommandDelegator
{
#region ICommandDelegator implementation
diff --git a/MonoDevelop.GOLib/src/XwtContainer.cs b/MonoDevelop.GOLib/src/XwtContainer.cs
new file mode 100644
index 00000000..6a648f5c
--- /dev/null
+++ b/MonoDevelop.GOLib/src/XwtContainer.cs
@@ -0,0 +1,209 @@
+//
+// OpenTKGameWindow.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Xml;
+using Cairo;
+using Crow;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Core;
+using MonoDevelop.DesignerSupport;
+using MonoDevelop.Ide;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Crow
+{
+ public class XwtContainer : Xwt.Canvas, IPropertyPadProvider,ICommandDelegator
+ {
+ public Interface CrowInterface;
+
+ #region ICommandDelegator implementation
+
+ public object GetDelegatedCommandTarget ()
+ {
+ return CrowInterface.hoverWidget;
+ }
+
+ #endregion
+
+ #region IPropertyPadProvider implementation
+
+ public object GetActiveComponent ()
+ {
+ return CrowInterface.activeWidget;
+ }
+ public object GetProvider ()
+ {
+ return CrowInterface.activeWidget;
+ }
+ public void OnEndEditing (object obj)
+ {
+
+ }
+ public void OnChanged (object obj)
+ {
+ (obj as GraphicObject).RegisterForGraphicUpdate ();
+ QueueDraw ();
+ }
+ #endregion
+
+ #region ctor
+ public XwtContainer() : this(0,0,"test"){}
+ public XwtContainer(int _width, int _height, string _title="Crow")
+ : base()
+ {
+ CrowInterface = new Interface ();
+ CrowInterface.Quit += Quit;
+
+
+ //this.OverrideBackgroundColor (Gtk.StateFlags.Normal, Gdk.RGBA.Zero);
+ //this.Visual = Gdk.Global.DefaultRootWindow.Screen.RgbaVisual;
+
+ this.ButtonPressEvent += OpenTKGameWindow_ButtonPressEvent;
+ this.ButtonReleaseEvent += OpenTKGameWindow_ButtonReleaseEvent;
+ this.MotionNotifyEvent += OpenTKGameWindow_MotionNotifyEvent;
+ this.KeyPressEvent += OpenTKGameWindow_KeyPressEvent;
+ this.SizeAllocated += OpenTKGameWindow_SizeAllocated;
+
+ this.Show ();
+
+ //GLib.Idle.Add (new GLib.IdleHandler (idleHandler));
+ GLib.Timeout.Add (10, new GLib.TimeoutHandler (updateHandler));
+ }
+ #endregion
+
+
+
+ #region Timers
+ bool updateHandler(){
+ CrowInterface.Update();
+ return true;
+ }
+ bool idleHandler(){
+ if (CrowInterface.IsDirty) {
+ QueueDrawArea (CrowInterface.DirtyRect.X, CrowInterface.DirtyRect.Y, CrowInterface.DirtyRect.Width, CrowInterface.DirtyRect.Height);
+ return false;
+ }
+ return true;
+ }
+ #endregion
+
+ protected void Quit (object sender, EventArgs e)
+ {
+ Gtk.Application.Quit ();
+ }
+
+ static double[] dashed = {2.0};
+ protected override void OnDraw (Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
+ {
+ base.OnDraw (ctx, dirtyRect);
+ if (CrowInterface.IsDirty) {
+ using (MemoryStream ms = new MemoryStream (CrowInterface.dirtyBmp)) {
+ //Xwt.Drawing.ImageBuilder im = new Xwt.Drawing.ImageBuilder(CrowInterface.DirtyRect.Width, CrowInterface.DirtyRect.Height);
+ //bmp.
+ using (Xwt.Drawing.Image img = Xwt.Drawing.BitmapImage.FromStream (ms)) {
+ img.WithSize (CrowInterface.DirtyRect.Width, CrowInterface.DirtyRect.Height);
+ ctx.DrawImage (img, CrowInterface.DirtyRect.X, CrowInterface.DirtyRect.Y);
+ ctx.Fill ();
+ }
+ }
+ CrowInterface.IsDirty = false;
+ GLib.Idle.Add (new GLib.IdleHandler (idleHandler));
+ return;
+ }
+ if (CrowInterface.bmp != null) {
+ using (ImageSurface img = new ImageSurface (CrowInterface.bmp, Format.Argb32, CrowInterface.ClientRectangle.Width, CrowInterface.ClientRectangle.Height, 4 * CrowInterface.ClientRectangle.Width)) {
+ cr.SetSourceSurface (img, CrowInterface.ClientRectangle.X, CrowInterface.ClientRectangle.Y);
+ cr.Paint ();
+ }
+ }
+ if (CrowInterface.hoverWidget != null) {
+ cr.Rectangle (CrowInterface.hoverWidget.ScreenCoordinates (
+ CrowInterface.hoverWidget.getSlot ()));
+ cr.LineWidth = 1;
+ cr.SetDash (dashed, 0);
+ //cr.Color = Crow.Color.Yellow;
+ cr.Stroke ();
+ }
+
+ }
+ void Win_DeleteEvent (object o, Gtk.DeleteEventArgs args)
+ {
+ Gtk.Application.Quit ();
+ }
+ void OpenTKGameWindow_SizeAllocated (object o, Gtk.SizeAllocatedArgs args)
+ {
+ CrowInterface.ProcessResize (new Rectangle (args.Allocation.X, args.Allocation.Y, args.Allocation.Width, args.Allocation.Height));
+ }
+ void OpenTKGameWindow_MotionNotifyEvent (object o, Gtk.MotionNotifyEventArgs args)
+ {
+ CrowInterface.ProcessMouseMove ((int)args.Event.X, (int)args.Event.Y);
+ }
+
+ void OpenTKGameWindow_ButtonReleaseEvent (object o, Gtk.ButtonReleaseEventArgs args)
+ {
+ CrowInterface.ProcessMouseButtonUp ((int)args.Event.Button - 1);
+ }
+ void OpenTKGameWindow_ButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
+ {
+ CrowInterface.ProcessMouseButtonDown ((int)args.Event.Button - 1);
+ }
+
+// void Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs otk_e)
+// {
+// MouseWheelEventArgs e = new MouseWheelEventArgs (otk_e.X, otk_e.Y, otk_e.Value, otk_e.Delta);
+// MouseState ms = e.Mouse;
+// update_mouseButtonStates (ref ms, otk_e.Mouse);
+// e.Mouse = ms;
+//
+// if (hoverWidget == null) {
+// MouseWheelChanged.Raise (this, otk_e);
+// return;
+// }
+// hoverWidget.onMouseWheel (this, e);
+// }
+
+
+
+ #region keyboard Handling
+// KeyboardState Keyboad = new KeyboardState ();
+// void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs otk_e)
+// {
+//// if (_focusedWidget == null) {
+// KeyboardKeyDown.Raise (this, otk_e);
+//// return;
+//// }
+// Keyboad.SetKeyState ((Crow.Key)otk_e.Key, true);
+// KeyboardKeyEventArgs e = new KeyboardKeyEventArgs((Crow.Key)otk_e.Key, otk_e.IsRepeat,Keyboad);
+// _focusedWidget.onKeyDown (sender, e);
+// }
+ void OpenTKGameWindow_KeyPressEvent (object o, Gtk.KeyPressEventArgs args)
+ {
+
+ }
+
+ #endregion
+ }
+}