32 changed files with 140 additions and 119 deletions
@ -1,55 +1,56 @@ |
|||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||
// <copyright file="IDescription.cs" company="Steven Kirk">
|
// <copyright file="GtkPlatform.cs" company="Steven Kirk">
|
||||
// Copyright 2014 MIT Licence. See licence.md for more information.
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
||||
// </copyright>
|
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||
|
|
||||
namespace Perspex.Gtk |
namespace Perspex.Gtk |
||||
{ |
{ |
||||
using System; |
using System; |
||||
using System.Reactive.Disposables; |
using System.Reactive.Disposables; |
||||
using Perspex.Input; |
using Perspex.Input; |
||||
using Perspex.Platform; |
using Perspex.Platform; |
||||
using Splat; |
using Splat; |
||||
using Gtk = global::Gtk; |
using Gtk = global::Gtk; |
||||
|
|
||||
public class GtkPlatform : IPlatformThreadingInterface |
public class GtkPlatform : IPlatformThreadingInterface |
||||
{ |
{ |
||||
private static GtkPlatform instance = new GtkPlatform (); |
private static GtkPlatform instance = new GtkPlatform(); |
||||
|
|
||||
public GtkPlatform () |
public GtkPlatform() |
||||
{ |
{ |
||||
Gtk.Application.Init(); |
Gtk.Application.Init(); |
||||
} |
} |
||||
|
|
||||
public static void Initialize() |
public static void Initialize() |
||||
{ |
{ |
||||
var locator = Locator.CurrentMutable; |
var locator = Locator.CurrentMutable; |
||||
locator.Register(() => new WindowImpl(), typeof(IWindowImpl)); |
locator.Register(() => new WindowImpl(), typeof(IWindowImpl)); |
||||
locator.Register(() => GtkKeyboardDevice.Instance, typeof(IKeyboardDevice)); |
locator.Register(() => GtkKeyboardDevice.Instance, typeof(IKeyboardDevice)); |
||||
locator.Register(() => instance, typeof(IPlatformThreadingInterface)); |
locator.Register(() => instance, typeof(IPlatformThreadingInterface)); |
||||
} |
} |
||||
|
|
||||
public void ProcessMessage () |
public void ProcessMessage() |
||||
{ |
{ |
||||
Gtk.Application.RunIteration(); |
Gtk.Application.RunIteration(); |
||||
} |
} |
||||
|
|
||||
public IDisposable StartTimer (TimeSpan interval, Action tick) |
public IDisposable StartTimer(TimeSpan interval, Action tick) |
||||
{ |
{ |
||||
var result = true; |
var result = true; |
||||
var handle = GLib.Timeout.Add((uint)interval.TotalMilliseconds, () => |
var handle = GLib.Timeout.Add( |
||||
{ |
(uint)interval.TotalMilliseconds, |
||||
tick(); |
() => |
||||
return result; |
{ |
||||
}); |
tick(); |
||||
|
return result; |
||||
|
}); |
||||
|
|
||||
return Disposable.Create(() => result = false); |
return Disposable.Create(() => result = false); |
||||
} |
} |
||||
|
|
||||
public void Wake () |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
public void Wake() |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,27 +1,24 @@ |
|||||
using System.Reflection; |
// -----------------------------------------------------------------------
|
||||
|
// <copyright file="AssemblyInfo.cs" company="Steven Kirk">
|
||||
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
||||
|
// </copyright>
|
||||
|
// -----------------------------------------------------------------------
|
||||
|
|
||||
|
using System.Reflection; |
||||
using System.Runtime.CompilerServices; |
using System.Runtime.CompilerServices; |
||||
|
|
||||
// Information about this assembly is defined by the following attributes.
|
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
// Change them to the values specific to your project.
|
||||
|
[assembly: AssemblyTitle("Perspex.Gtk")] |
||||
[assembly: AssemblyTitle ("Perspex.Gtk")] |
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyDescription ("")] |
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyConfiguration ("")] |
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyCompany ("")] |
[assembly: AssemblyProduct("")] |
||||
[assembly: AssemblyProduct ("")] |
[assembly: AssemblyCopyright("steven")] |
||||
[assembly: AssemblyCopyright ("steven")] |
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyTrademark ("")] |
[assembly: AssemblyCulture("")] |
||||
[assembly: AssemblyCulture ("")] |
|
||||
|
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
[assembly: AssemblyVersion("1.0.*")] |
||||
[assembly: AssemblyVersion ("1.0.*")] |
|
||||
|
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
|
||||
// if desired. See the Mono documentation for more information about signing.
|
|
||||
|
|
||||
//[assembly: AssemblyDelaySign(false)]
|
|
||||
//[assembly: AssemblyKeyFile("")]
|
|
||||
|
|
||||
|
|||||
Loading…
Reference in new issue