diff options
author | Michael Hutchinson <mhutch@xamarin.com> | 2011-09-19 22:39:09 +0400 |
---|---|---|
committer | Michael Hutchinson <mhutch@xamarin.com> | 2011-09-20 13:55:26 +0400 |
commit | 3a46c551cf9aedcd1b49e69d28cc864cd865a343 (patch) | |
tree | c2fa190729af4e543da34735bdc7fda8cc4bffc8 /main/src/addins/WindowsPlatform | |
parent | 19105138c3d46ef9584ea6779d43f9b4e2d8689b (diff) |
[WindowsPlatform] Added some utility code
Diffstat (limited to 'main/src/addins/WindowsPlatform')
-rw-r--r-- | main/src/addins/WindowsPlatform/WindowsPlatform.cs | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform.cs b/main/src/addins/WindowsPlatform/WindowsPlatform.cs index 07d56f3b75..c1f8802301 100644 --- a/main/src/addins/WindowsPlatform/WindowsPlatform.cs +++ b/main/src/addins/WindowsPlatform/WindowsPlatform.cs @@ -133,4 +133,41 @@ namespace MonoDevelop.Platform return new MonoDevelop.Platform.WindowsRecentFiles (); } } -} + + static class GdkWin32 + { + [System.Runtime.InteropServices.DllImport ("libgdk-win32-2.0-0.dll")] + static extern IntPtr gdk_win32_drawable_get_handle (IntPtr drawable); + + [System.Runtime.InteropServices.DllImport ("libgdk-win32-2.0-0.dll")] + static extern IntPtr gdk_win32_hdc_get (IntPtr drawable, IntPtr gc, int usage); + + [System.Runtime.InteropServices.DllImport ("libgdk-win32-2.0-0.dll")] + static extern void gdk_win32_hdc_release (IntPtr drawable, IntPtr gc, int usage); + + public static IntPtr HgdiobjGet (Gdk.Drawable drawable) + { + return gdk_win32_drawable_get_handle (drawable.Handle); + } + + public static IntPtr HdcGet (Gdk.Drawable drawable, Gdk.GC gc, Gdk.GCValuesMask usage) + { + return gdk_win32_hdc_get (drawable.Handle, gc.Handle, (int) usage); + } + + public static void HdcRelease (Gdk.Drawable drawable, Gdk.GC gc, Gdk.GCValuesMask usage) + { + gdk_win32_hdc_release (drawable.Handle, gc.Handle, (int) usage); + } + } + + class GtkWin32Proxy : IWin32Window + { + public GtkWin32Proxy (Gtk.Window gtkWindow) + { + Handle = GdkWin32.HgdiobjGet (gtkWindow.RootWindow); + } + + public IntPtr Handle { get; private set; } + } +}
\ No newline at end of file |