diff --git a/gdk/Atom.custom b/gdk/Atom.cs similarity index 82% rename from gdk/Atom.custom rename to gdk/Atom.cs index ec291eb49..d0960fd77 100644 --- a/gdk/Atom.custom +++ b/gdk/Atom.cs @@ -1,4 +1,4 @@ -// Atom.custom +// Atom.cs // // This program is free software; you can redistribute it and/or // modify it under the terms of version 2 of the Lesser GNU General @@ -14,8 +14,14 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -public static implicit operator string (Gdk.Atom atom) -{ - return atom.Name; +namespace Gdk { + + public partial class Atom { + + public static implicit operator string (Gdk.Atom atom) + { + return atom.Name; + } + } } diff --git a/gdk/Color.custom b/gdk/Color.cs similarity index 63% rename from gdk/Color.custom rename to gdk/Color.cs index e5cb581b8..f4f7d166e 100644 --- a/gdk/Color.custom +++ b/gdk/Color.cs @@ -1,4 +1,4 @@ -// Gdk.Color.custom - Gdk Color class customizations +// Gdk.Color.cs - Gdk Color class customizations // // Author: Jasper van Putten , Miguel de Icaza. // @@ -21,19 +21,26 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { -public Color (byte r, byte g, byte b) -{ - Red = (ushort) (r << 8 | r); - Green = (ushort) (g << 8 | g); - Blue = (ushort) (b << 8 | b); - Pixel = 0; -} - -[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] -static extern uint gdk_color_hash(ref Gdk.Color raw); - -public override int GetHashCode() { - return (int) gdk_color_hash(ref this); + using System.Runtime.InteropServices; + + public partial struct Color { + + public Color (byte r, byte g, byte b) + { + Red = (ushort) (r << 8 | r); + Green = (ushort) (g << 8 | g); + Blue = (ushort) (b << 8 | b); + Pixel = 0; + } + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern uint gdk_color_hash(ref Gdk.Color raw); + + public override int GetHashCode() { + return (int) gdk_color_hash(ref this); + } + } } diff --git a/gdk/Device.custom b/gdk/Device.cs similarity index 91% rename from gdk/Device.custom rename to gdk/Device.cs index 14de14cb3..c46e9eaa9 100644 --- a/gdk/Device.custom +++ b/gdk/Device.cs @@ -1,4 +1,4 @@ -// Device.custom - customizations to Gdk.Device +// Device.cs - customizations to Gdk.Device // // Authors: Manuel V. Santos // @@ -18,6 +18,12 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class Device { [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gdk_device_free_history(IntPtr events, int n_events); @@ -41,4 +47,6 @@ } else return new TimeCoord [0]; } + } +} diff --git a/gdk/Display.custom b/gdk/Display.cs similarity index 95% rename from gdk/Display.custom rename to gdk/Display.cs index a0cb09190..afd5303f7 100644 --- a/gdk/Display.custom +++ b/gdk/Display.cs @@ -1,4 +1,4 @@ -// Display.custom - customizations to Gdk.Display +// Display.cs - customizations to Gdk.Display // // Authors: Mike Kestner // @@ -18,6 +18,14 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Collections; + using System.Runtime.InteropServices; + + public partial class Display { + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gdk_display_get_pointer(IntPtr raw, IntPtr screen, out int x, out int y, out int mask); @@ -85,4 +93,6 @@ func_list.Add (func_wrapper); gdk_display_add_client_message_filter (Handle, message_type == null ? IntPtr.Zero : message_type.Handle, func_wrapper.NativeDelegate, IntPtr.Zero); } + } +} diff --git a/gdk/DisplayManager.custom b/gdk/DisplayManager.cs similarity index 87% rename from gdk/DisplayManager.custom rename to gdk/DisplayManager.cs index b9c35d72e..3af24f519 100644 --- a/gdk/DisplayManager.custom +++ b/gdk/DisplayManager.cs @@ -1,4 +1,4 @@ -// DisplayManager.custom - customizations to Gdk.DisplayManager +// DisplayManager.cs - customizations to Gdk.DisplayManager // // Authors: Mike Kestner // @@ -18,6 +18,13 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class DisplayManager { + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gdk_display_manager_list_displays (IntPtr raw); @@ -32,4 +39,6 @@ result [i] = list [i] as Display; return result; } + } +} diff --git a/gdk/Global.custom b/gdk/Global.cs similarity index 97% rename from gdk/Global.custom rename to gdk/Global.cs index 2ab746684..ce67b86f7 100644 --- a/gdk/Global.custom +++ b/gdk/Global.cs @@ -1,4 +1,4 @@ -// Global.custom - customizations to Gdk.Global +// Global.cs - customizations to Gdk.Global // // Authors: Mike Kestner // Boyd Timothy @@ -19,6 +19,13 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class Global { + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gdk_devices_list (); @@ -172,4 +179,6 @@ { Gdk.Display.Default.AddClientMessageFilter (message_type, func); } + } +} diff --git a/gdk/Keymap.custom b/gdk/Keymap.cs similarity index 94% rename from gdk/Keymap.custom rename to gdk/Keymap.cs index 31070aa79..75e5daec4 100644 --- a/gdk/Keymap.custom +++ b/gdk/Keymap.cs @@ -1,4 +1,4 @@ -// Keymap.custom - customizations to Gdk.Keymap +// Keymap.cs - customizations to Gdk.Keymap // // Authors: Mike Kestner // @@ -19,6 +19,13 @@ // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class Keymap { + [DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void g_free(IntPtr ptr); @@ -65,4 +72,6 @@ } else return new KeymapKey [0]; } + } +} diff --git a/gdk/Makefile.am b/gdk/Makefile.am index c26ed2d82..61739ba4b 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -6,6 +6,11 @@ references = $(top_builddir)/glib/glib-sharp.dll $(top_builddir)/gio/gio-sharp.d glue_includes = gdk/gdk.h sources = \ + Atom.cs \ + Color.cs \ + Device.cs \ + Display.cs \ + DisplayManager.cs \ EventButton.cs \ EventConfigure.cs \ EventCrossing.cs \ @@ -24,30 +29,23 @@ sources = \ EventSetting.cs \ EventVisibility.cs \ EventWindowState.cs \ + Global.cs \ Key.cs \ + Keymap.cs \ + Pixbuf.cs \ + PixbufAnimation.cs \ + PixbufFrame.cs \ + PixbufLoader.cs \ + Pixdata.cs \ + Point.cs \ + Property.cs \ Rectangle.cs \ + Screen.cs \ + Selection.cs \ Size.cs \ - TextProperty.cs - -customs = \ - Atom.custom \ - Color.custom \ - Device.custom \ - Display.custom \ - DisplayManager.custom \ - Global.custom \ - Keymap.custom \ - Pixbuf.custom \ - PixbufAnimation.custom \ - PixbufFrame.custom \ - PixbufLoader.custom \ - Pixdata.custom \ - Point.custom \ - Property.custom \ - Screen.custom \ - Selection.custom \ - WindowAttr.custom \ - Window.custom + TextProperty.cs \ + WindowAttr.cs \ + Window.cs add_dist = diff --git a/gdk/Pixbuf.custom b/gdk/Pixbuf.cs similarity index 98% rename from gdk/Pixbuf.custom rename to gdk/Pixbuf.cs index ebaf9105c..7f5ed32d5 100644 --- a/gdk/Pixbuf.custom +++ b/gdk/Pixbuf.cs @@ -1,4 +1,4 @@ -// Pixbuf.custom - Gdk Pixbuf class customizations +// Pixbuf.cs - Gdk Pixbuf class customizations // // Authors: // Vladimir Vukicevic @@ -32,6 +32,13 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class Pixbuf { + public Pixbuf (System.IO.Stream stream) : base (IntPtr.Zero) { using (PixbufLoader pl = new PixbufLoader (stream)) { @@ -322,4 +329,6 @@ throw new GLib.GException (error); return saved; } + } +} diff --git a/gdk/PixbufAnimation.custom b/gdk/PixbufAnimation.cs similarity index 90% rename from gdk/PixbufAnimation.custom rename to gdk/PixbufAnimation.cs index c7a9774ad..0a950e2cb 100644 --- a/gdk/PixbufAnimation.custom +++ b/gdk/PixbufAnimation.cs @@ -1,4 +1,4 @@ -// PixbufAnimation.custom - GdkPixbufAnimation class customizations +// PixbufAnimation.cs - GdkPixbufAnimation class customizations // // Copyright (c) 2005 Novell, Inc. // @@ -18,6 +18,12 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + + public partial class PixbufAnimation { + public PixbufAnimation (System.IO.Stream stream) : base (new PixbufLoader (stream).AnimationHandle) {} public PixbufAnimation (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero) @@ -31,3 +37,6 @@ { return new PixbufAnimation (System.Reflection.Assembly.GetCallingAssembly (), resource); } + } +} + diff --git a/gdk/PixbufFrame.custom b/gdk/PixbufFrame.cs similarity index 91% rename from gdk/PixbufFrame.custom rename to gdk/PixbufFrame.cs index 6c6a99b73..3974d84cf 100644 --- a/gdk/PixbufFrame.custom +++ b/gdk/PixbufFrame.cs @@ -1,4 +1,4 @@ -// Gdk.PixbufFrame.custom - Gdk PixbufFrame class customizations +// Gdk.PixbufFrame.cs - Gdk PixbufFrame class customizations // // Author: Mike Kestner // @@ -20,6 +20,12 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + + public partial struct PixbufFrame { + [Obsolete ("Replaced by Pixbuf property.")] public Gdk.Pixbuf pixbuf { get { @@ -46,4 +52,6 @@ } set { _revert = value.Handle; } } + } +} diff --git a/gdk/PixbufLoader.custom b/gdk/PixbufLoader.cs similarity index 95% rename from gdk/PixbufLoader.custom rename to gdk/PixbufLoader.cs index 5e9e04ff0..8ac99fdee 100644 --- a/gdk/PixbufLoader.custom +++ b/gdk/PixbufLoader.cs @@ -1,4 +1,4 @@ -// PixbufLoader.custom - Gdk PixbufLoader class customizations +// PixbufLoader.cs - Gdk PixbufLoader class customizations // // Authors: // Mike Kestner @@ -21,6 +21,13 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class PixbufLoader { + [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr g_object_ref (IntPtr handle); @@ -141,3 +148,6 @@ { return new PixbufLoader (System.Reflection.Assembly.GetCallingAssembly (), resource); } + } +} + diff --git a/gdk/Pixdata.custom b/gdk/Pixdata.cs similarity index 57% rename from gdk/Pixdata.custom rename to gdk/Pixdata.cs index 7aa0d1c70..266d93651 100644 --- a/gdk/Pixdata.custom +++ b/gdk/Pixdata.cs @@ -1,4 +1,4 @@ -// Pixdata.Custom +// Pixdata.cs // // Copyright (c) 2004 Novell, Inc. // @@ -16,15 +16,25 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. - [DllImport ("libgdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr gdk_pixdata_serialize (ref Gdk.Pixdata raw, out uint len); - - public byte [] Serialize () { - uint len; - IntPtr raw_ret = gdk_pixdata_serialize (ref this, out len); +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial struct Pixdata { + + [DllImport ("libgdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gdk_pixdata_serialize (ref Gdk.Pixdata raw, out uint len); + + public byte [] Serialize () { + uint len; + IntPtr raw_ret = gdk_pixdata_serialize (ref this, out len); + + byte [] data = new byte [len]; + Marshal.Copy (raw_ret, data, 0, (int)len); + GLib.Marshaller.Free (raw_ret); + return data; + } + } +} - byte [] data = new byte [len]; - Marshal.Copy (raw_ret, data, 0, (int)len); - GLib.Marshaller.Free (raw_ret); - return data; - } diff --git a/gdk/Point.cs b/gdk/Point.cs new file mode 100644 index 000000000..c52df7b36 --- /dev/null +++ b/gdk/Point.cs @@ -0,0 +1,90 @@ +// Gdk.Point.cs - Gdk Point class customizations +// +// Authors: +// Jasper van Putten +// Martin Willemoes Hansen +// Ben Maurer +// Contains lots of c&p from System.Drawing +// +// Copyright (c) 2002 Jasper van Putten +// Copyright (c) 2003 Martin Willemoes Hansen +// Copyright (c) 2005 Novell, Inc +// +// This code is inserted after the automatically generated code. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +namespace Gdk { + + using System; + + public partial struct Point { + + public override string ToString () + { + return String.Format ("({0},{1})", X, Y); + } + + public Point (int x, int y) + { + this.X = x; + this.Y = y; + } + + public Point (Size sz) + { + this.X = sz.Width; + this.Y = sz.Height; + } + + public void Offset (int dx, int dy) + { + X += dx; + Y += dy; + } + + public bool IsEmpty { + get { + return ((X == 0) && (Y == 0)); + } + } + + public static explicit operator Size (Point pt) + { + return new Size (pt.X, pt.Y); + } + + public static Point operator + (Point pt, Size sz) + { + return new Point (pt.X + sz.Width, pt.Y + sz.Height); + } + + public static Point operator - (Point pt, Size sz) + { + return new Point (pt.X - sz.Width, pt.Y - sz.Height); + } + + public static bool operator == (Point pt_a, Point pt_b) + { + return ((pt_a.X == pt_b.X) && (pt_a.Y == pt_b.Y)); + } + + public static bool operator != (Point pt_a, Point pt_b) + { + return ((pt_a.X != pt_b.X) || (pt_a.Y != pt_b.Y)); + } + } +} + diff --git a/gdk/Point.custom b/gdk/Point.custom deleted file mode 100644 index 7e17cd949..000000000 --- a/gdk/Point.custom +++ /dev/null @@ -1,81 +0,0 @@ -// Gdk.Point.custom - Gdk Point class customizations -// -// Authors: -// Jasper van Putten -// Martin Willemoes Hansen -// Ben Maurer -// Contains lots of c&p from System.Drawing -// -// Copyright (c) 2002 Jasper van Putten -// Copyright (c) 2003 Martin Willemoes Hansen -// Copyright (c) 2005 Novell, Inc -// -// This code is inserted after the automatically generated code. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the Lesser GNU General -// Public License as published by the Free Software Foundation. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - -public override string ToString () -{ - return String.Format ("({0},{1})", X, Y); -} - -public Point (int x, int y) -{ - this.X = x; - this.Y = y; -} - -public Point (Size sz) -{ - this.X = sz.Width; - this.Y = sz.Height; -} - -public void Offset (int dx, int dy) -{ - X += dx; - Y += dy; -} - -public bool IsEmpty { - get { - return ((X == 0) && (Y == 0)); - } -} - -public static explicit operator Size (Point pt) -{ - return new Size (pt.X, pt.Y); -} - -public static Point operator + (Point pt, Size sz) -{ - return new Point (pt.X + sz.Width, pt.Y + sz.Height); -} - -public static Point operator - (Point pt, Size sz) -{ - return new Point (pt.X - sz.Width, pt.Y - sz.Height); -} - -public static bool operator == (Point pt_a, Point pt_b) -{ - return ((pt_a.X == pt_b.X) && (pt_a.Y == pt_b.Y)); -} - -public static bool operator != (Point pt_a, Point pt_b) -{ - return ((pt_a.X != pt_b.X) || (pt_a.Y != pt_b.Y)); -} diff --git a/gdk/Property.custom b/gdk/Property.cs similarity index 97% rename from gdk/Property.custom rename to gdk/Property.cs index 81a726e38..5c8c04781 100644 --- a/gdk/Property.custom +++ b/gdk/Property.cs @@ -1,4 +1,4 @@ -// Gdk.Property.custom - Custom implementation for Property class +// Gdk.Property.cs - Custom implementation for Property class // // Authors: Mike Kestner // @@ -19,6 +19,12 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class Property { [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gdk_property_change(IntPtr window, IntPtr property, IntPtr type, int format, int mode, out byte data, int nelements); @@ -155,3 +161,6 @@ return true; } #endif + } +} + diff --git a/gdk/Screen.custom b/gdk/Screen.cs similarity index 94% rename from gdk/Screen.custom rename to gdk/Screen.cs index 4a4890b45..c6c59262a 100644 --- a/gdk/Screen.custom +++ b/gdk/Screen.cs @@ -1,4 +1,4 @@ -// Screen.custom - customizations to Gdk.Screen +// Screen.cs - customizations to Gdk.Screen // // Authors: Mike Kestner // @@ -18,6 +18,13 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + using System.Runtime.InteropServices; + + public partial class Screen { + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gdk_screen_get_toplevel_windows (IntPtr raw); @@ -69,4 +76,6 @@ gdk_screen_set_font_options(Handle, value == null ? IntPtr.Zero : value.Handle); } } + } +} diff --git a/gdk/Selection.custom b/gdk/Selection.cs similarity index 88% rename from gdk/Selection.custom rename to gdk/Selection.cs index 2b4873ac6..53842f816 100644 --- a/gdk/Selection.custom +++ b/gdk/Selection.cs @@ -1,4 +1,4 @@ -// Gdk.Selection.custom - Gdk Selection class customizations +// Gdk.Selection.cs - Gdk Selection class customizations // // Author: Mike Kestner // @@ -20,9 +20,17 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + + public partial class Selection { + public static Atom Primary = new Atom (new IntPtr (1)); public static Atom Secondary = new Atom (new IntPtr (2)); public static Atom Clipboard = new Atom (new IntPtr (69)); + } +} diff --git a/gdk/Window.cs b/gdk/Window.cs new file mode 100644 index 000000000..8ff699e86 --- /dev/null +++ b/gdk/Window.cs @@ -0,0 +1,198 @@ +// Gdk.Window.cs - Gdk Window class customizations +// +// Author: Moritz Balz +// Mike Kestner +// +// Copyright (c) 2003 Moritz Balz +// Copyright (c) 2004 - 2008 Novell, Inc. +// +// This code is inserted after the automatically generated code. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +namespace Gdk { + + using System; + using System.Collections; + using System.Runtime.InteropServices; + + public partial class Window { + + public Window (Gdk.Window parent, Gdk.WindowAttr attributes, Gdk.WindowAttributesType attributes_mask) : this (parent, attributes, (int)attributes_mask) {} + + [DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gdk_window_get_background_pattern(IntPtr raw); + + [DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_window_set_background_pattern(IntPtr raw, IntPtr pattern); + + public Cairo.Pattern BackgroundPattern { + get { + IntPtr raw_ret = gdk_window_get_background_pattern(Handle); + Cairo.Pattern ret = Cairo.Pattern.Lookup (raw_ret); + return ret; + } + set { + gdk_window_set_background_pattern(Handle, (value == null) ? IntPtr.Zero : value.Handle); + } + } + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gdk_window_get_children(IntPtr raw); + + public Window[] Children { + get { + IntPtr raw_ret = gdk_window_get_children(Handle); + if (raw_ret == IntPtr.Zero) + return new Window [0]; + GLib.List list = new GLib.List(raw_ret); + Window[] result = new Window [list.Count]; + for (int i = 0; i < list.Count; i++) + result [i] = list [i] as Window; + return result; + } + } + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_window_set_icon_list(IntPtr raw, IntPtr pixbufs); + + public Pixbuf[] IconList { + set { + GLib.List list = new GLib.List(IntPtr.Zero); + foreach (Pixbuf val in value) + list.Append (val.Handle); + gdk_window_set_icon_list(Handle, list.Handle); + } + } + + [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr g_object_ref (IntPtr raw); + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_window_destroy(IntPtr raw); + + public void Destroy () + { + // native method assumes an outstanding normal ref, but we hold a + // toggle ref. take out a normal ref for it to release, and let + // Dispose release our toggle ref. + g_object_ref (Handle); + gdk_window_destroy(Handle); + Dispose (); + } + + public void MoveResize (Gdk.Rectangle rect) { + gdk_window_move_resize (Handle, rect.X, rect.Y, rect.Width, rect.Height); + } + +#if FIXME30 + public void ClearArea (Gdk.Rectangle rect, bool expose) { + if (expose) + gdk_window_clear_area_e (Handle, rect.X, rect.Y, rect.Width, rect.Height); + else + gdk_window_clear_area (Handle, rect.X, rect.Y, rect.Width, rect.Height); + } +#endif + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_window_get_user_data (IntPtr raw, out IntPtr data); + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_window_set_user_data(IntPtr raw, IntPtr user_data); + public IntPtr UserData { + get { + IntPtr data; + gdk_window_get_user_data (Handle, out data); + return data; + } + set { + gdk_window_set_user_data(Handle, value); + } + } + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_window_add_filter (IntPtr handle, GdkSharp.FilterFuncNative wrapper, IntPtr data); + + [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gdk_window_remove_filter (IntPtr handle, GdkSharp.FilterFuncNative wrapper, IntPtr data); + + static Hashtable filter_all_hash; + static Hashtable FilterAllHash { + get { + if (filter_all_hash == null) + filter_all_hash = new Hashtable (); + return filter_all_hash; + } + } + + public static void AddFilterForAll (FilterFunc func) + { + GdkSharp.FilterFuncWrapper wrapper = new GdkSharp.FilterFuncWrapper (func); + FilterAllHash [func] = wrapper; + gdk_window_add_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero); + } + + public static void RemoveFilterForAll (FilterFunc func) + { + GdkSharp.FilterFuncWrapper wrapper = FilterAllHash [func] as GdkSharp.FilterFuncWrapper; + if (wrapper == null) + return; + FilterAllHash.Remove (func); + gdk_window_remove_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero); + } + + public void AddFilter (FilterFunc function) + { + if (!Data.Contains ("filter_func_hash")) + Data ["filter_func_hash"] = new Hashtable (); + Hashtable hash = Data ["filter_func_hash"] as Hashtable; + GdkSharp.FilterFuncWrapper wrapper = new GdkSharp.FilterFuncWrapper (function); + hash [function] = wrapper; + gdk_window_add_filter (Handle, wrapper.NativeDelegate, IntPtr.Zero); + } + + public void RemoveFilter (FilterFunc function) + { + Hashtable hash = Data ["filter_func_hash"] as Hashtable; + GdkSharp.FilterFuncWrapper wrapper = hash [function] as GdkSharp.FilterFuncWrapper; + if (wrapper == null) + return; + hash.Remove (function); + gdk_window_remove_filter (Handle, wrapper.NativeDelegate, IntPtr.Zero); + } + +#if MANLY_ENOUGH_TO_INCLUDE + public Cairo.Graphics CairoGraphics (out int offset_x, out int offset_y) + { + IntPtr real_drawable; + Cairo.Graphics o = new Cairo.Graphics (); + + gdk_window_get_internal_paint_info (Handle, out real_drawable, out offset_x, out offset_y); + IntPtr x11 = gdk_x11_drawable_get_xid (real_drawable); + IntPtr display = gdk_x11_drawable_get_xdisplay (real_drawable); + o.SetTargetDrawable (display, x11); + + return o; + } + + + public override Cairo.Graphics CairoGraphics () + { + int x, y; + return CairoGraphics (out x, out y); + } +#endif + } +} diff --git a/gdk/Window.custom b/gdk/Window.custom deleted file mode 100644 index 3e2178769..000000000 --- a/gdk/Window.custom +++ /dev/null @@ -1,188 +0,0 @@ -// Gdk.Window.custom - Gdk Window class customizations -// -// Author: Moritz Balz -// Mike Kestner -// -// Copyright (c) 2003 Moritz Balz -// Copyright (c) 2004 - 2008 Novell, Inc. -// -// This code is inserted after the automatically generated code. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the Lesser GNU General -// Public License as published by the Free Software Foundation. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - - public Window (Gdk.Window parent, Gdk.WindowAttr attributes, Gdk.WindowAttributesType attributes_mask) : this (parent, attributes, (int)attributes_mask) {} - - [DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr gdk_window_get_background_pattern(IntPtr raw); - - [DllImport("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_window_set_background_pattern(IntPtr raw, IntPtr pattern); - - public Cairo.Pattern BackgroundPattern { - get { - IntPtr raw_ret = gdk_window_get_background_pattern(Handle); - Cairo.Pattern ret = Cairo.Pattern.Lookup (raw_ret); - return ret; - } - set { - gdk_window_set_background_pattern(Handle, (value == null) ? IntPtr.Zero : value.Handle); - } - } - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr gdk_window_get_children(IntPtr raw); - - public Window[] Children { - get { - IntPtr raw_ret = gdk_window_get_children(Handle); - if (raw_ret == IntPtr.Zero) - return new Window [0]; - GLib.List list = new GLib.List(raw_ret); - Window[] result = new Window [list.Count]; - for (int i = 0; i < list.Count; i++) - result [i] = list [i] as Window; - return result; - } - } - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_window_set_icon_list(IntPtr raw, IntPtr pixbufs); - - public Pixbuf[] IconList { - set { - GLib.List list = new GLib.List(IntPtr.Zero); - foreach (Pixbuf val in value) - list.Append (val.Handle); - gdk_window_set_icon_list(Handle, list.Handle); - } - } - - [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr g_object_ref (IntPtr raw); - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_window_destroy(IntPtr raw); - - public void Destroy () - { - // native method assumes an outstanding normal ref, but we hold a - // toggle ref. take out a normal ref for it to release, and let - // Dispose release our toggle ref. - g_object_ref (Handle); - gdk_window_destroy(Handle); - Dispose (); - } - - public void MoveResize (Gdk.Rectangle rect) { - gdk_window_move_resize (Handle, rect.X, rect.Y, rect.Width, rect.Height); - } - -#if FIXME30 - public void ClearArea (Gdk.Rectangle rect, bool expose) { - if (expose) - gdk_window_clear_area_e (Handle, rect.X, rect.Y, rect.Width, rect.Height); - else - gdk_window_clear_area (Handle, rect.X, rect.Y, rect.Width, rect.Height); - } -#endif - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_window_get_user_data (IntPtr raw, out IntPtr data); - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_window_set_user_data(IntPtr raw, IntPtr user_data); - public IntPtr UserData { - get { - IntPtr data; - gdk_window_get_user_data (Handle, out data); - return data; - } - set { - gdk_window_set_user_data(Handle, value); - } - } - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_window_add_filter (IntPtr handle, GdkSharp.FilterFuncNative wrapper, IntPtr data); - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_window_remove_filter (IntPtr handle, GdkSharp.FilterFuncNative wrapper, IntPtr data); - - static Hashtable filter_all_hash; - static Hashtable FilterAllHash { - get { - if (filter_all_hash == null) - filter_all_hash = new Hashtable (); - return filter_all_hash; - } - } - - public static void AddFilterForAll (FilterFunc func) - { - GdkSharp.FilterFuncWrapper wrapper = new GdkSharp.FilterFuncWrapper (func); - FilterAllHash [func] = wrapper; - gdk_window_add_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero); - } - - public static void RemoveFilterForAll (FilterFunc func) - { - GdkSharp.FilterFuncWrapper wrapper = FilterAllHash [func] as GdkSharp.FilterFuncWrapper; - if (wrapper == null) - return; - FilterAllHash.Remove (func); - gdk_window_remove_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero); - } - - public void AddFilter (FilterFunc function) - { - if (!Data.Contains ("filter_func_hash")) - Data ["filter_func_hash"] = new Hashtable (); - Hashtable hash = Data ["filter_func_hash"] as Hashtable; - GdkSharp.FilterFuncWrapper wrapper = new GdkSharp.FilterFuncWrapper (function); - hash [function] = wrapper; - gdk_window_add_filter (Handle, wrapper.NativeDelegate, IntPtr.Zero); - } - - public void RemoveFilter (FilterFunc function) - { - Hashtable hash = Data ["filter_func_hash"] as Hashtable; - GdkSharp.FilterFuncWrapper wrapper = hash [function] as GdkSharp.FilterFuncWrapper; - if (wrapper == null) - return; - hash.Remove (function); - gdk_window_remove_filter (Handle, wrapper.NativeDelegate, IntPtr.Zero); - } - -#if MANLY_ENOUGH_TO_INCLUDE - public Cairo.Graphics CairoGraphics (out int offset_x, out int offset_y) - { - IntPtr real_drawable; - Cairo.Graphics o = new Cairo.Graphics (); - - gdk_window_get_internal_paint_info (Handle, out real_drawable, out offset_x, out offset_y); - IntPtr x11 = gdk_x11_drawable_get_xid (real_drawable); - IntPtr display = gdk_x11_drawable_get_xdisplay (real_drawable); - o.SetTargetDrawable (display, x11); - - return o; - } - - - public override Cairo.Graphics CairoGraphics () - { - int x, y; - return CairoGraphics (out x, out y); - } -#endif diff --git a/gdk/WindowAttr.custom b/gdk/WindowAttr.cs similarity index 91% rename from gdk/WindowAttr.custom rename to gdk/WindowAttr.cs index 590a5e35f..a8f1f3aaa 100644 --- a/gdk/WindowAttr.custom +++ b/gdk/WindowAttr.cs @@ -1,4 +1,4 @@ -// Gdk.WindowAttr.custom - Gdk Window class customizations +// Gdk.WindowAttr.cs - Gdk Window class customizations // // Author: Mike Kestner // @@ -20,6 +20,12 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. +namespace Gdk { + + using System; + + public partial struct WindowAttr { + public EventMask Mask { get { return (EventMask) EventMask; @@ -47,4 +53,6 @@ } set { _cursor = value.Handle; } } + } +}