gdk: Move all .custom files to partial classes

This commit is contained in:
Bertrand Lorentz 2012-04-08 21:25:54 +02:00
parent 412fe3d9d1
commit d2a93817a1
21 changed files with 488 additions and 333 deletions

View file

@ -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)
{
namespace Gdk {
public partial class Atom {
public static implicit operator string (Gdk.Atom atom)
{
return atom.Name;
}
}
}

View file

@ -1,4 +1,4 @@
// Gdk.Color.custom - Gdk Color class customizations
// Gdk.Color.cs - Gdk Color class customizations
//
// Author: Jasper van Putten <Jaspervp@gmx.net>, 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)
{
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);
[DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern uint gdk_color_hash(ref Gdk.Color raw);
public override int GetHashCode() {
public override int GetHashCode() {
return (int) gdk_color_hash(ref this);
}
}
}

View file

@ -1,4 +1,4 @@
// Device.custom - customizations to Gdk.Device
// Device.cs - customizations to Gdk.Device
//
// Authors: Manuel V. Santos <mvsl@telefonica.net>
//
@ -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];
}
}
}

View file

@ -1,4 +1,4 @@
// Display.custom - customizations to Gdk.Display
// Display.cs - customizations to Gdk.Display
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
@ -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);
}
}
}

View file

@ -1,4 +1,4 @@
// DisplayManager.custom - customizations to Gdk.DisplayManager
// DisplayManager.cs - customizations to Gdk.DisplayManager
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
@ -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;
}
}
}

View file

@ -1,4 +1,4 @@
// Global.custom - customizations to Gdk.Global
// Global.cs - customizations to Gdk.Global
//
// Authors: Mike Kestner <mkestner@ximian.com>
// Boyd Timothy <btimothy@novell.com>
@ -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);
}
}
}

View file

@ -1,4 +1,4 @@
// Keymap.custom - customizations to Gdk.Keymap
// Keymap.cs - customizations to Gdk.Keymap
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
@ -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];
}
}
}

View file

@ -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 =

View file

@ -1,4 +1,4 @@
// Pixbuf.custom - Gdk Pixbuf class customizations
// Pixbuf.cs - Gdk Pixbuf class customizations
//
// Authors:
// Vladimir Vukicevic <vladimir@pobox.com>
@ -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;
}
}
}

View file

@ -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);
}
}
}

View file

@ -1,4 +1,4 @@
// Gdk.PixbufFrame.custom - Gdk PixbufFrame class customizations
// Gdk.PixbufFrame.cs - Gdk PixbufFrame class customizations
//
// Author: Mike Kestner <mkestner@novell.com>
//
@ -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; }
}
}
}

View file

@ -1,4 +1,4 @@
// PixbufLoader.custom - Gdk PixbufLoader class customizations
// PixbufLoader.cs - Gdk PixbufLoader class customizations
//
// Authors:
// Mike Kestner <mkestner@ximian.com>
@ -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);
}
}
}

View file

@ -1,4 +1,4 @@
// Pixdata.Custom
// Pixdata.cs
//
// Copyright (c) 2004 Novell, Inc.
//
@ -16,6 +16,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 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);
@ -28,3 +35,6 @@
GLib.Marshaller.Free (raw_ret);
return data;
}
}
}

90
gdk/Point.cs Normal file
View file

@ -0,0 +1,90 @@
// Gdk.Point.cs - Gdk Point class customizations
//
// Authors:
// Jasper van Putten <Jaspervp@gmx.net>
// Martin Willemoes Hansen <mwh@sysrq.dk>
// Ben Maurer <bmaurer@novell.com>
// 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));
}
}
}

View file

@ -1,81 +0,0 @@
// Gdk.Point.custom - Gdk Point class customizations
//
// Authors:
// Jasper van Putten <Jaspervp@gmx.net>
// Martin Willemoes Hansen <mwh@sysrq.dk>
// Ben Maurer <bmaurer@novell.com>
// 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));
}

View file

@ -1,4 +1,4 @@
// Gdk.Property.custom - Custom implementation for Property class
// Gdk.Property.cs - Custom implementation for Property class
//
// Authors: Mike Kestner <mkestner@novell.com>
//
@ -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
}
}

View file

@ -1,4 +1,4 @@
// Screen.custom - customizations to Gdk.Screen
// Screen.cs - customizations to Gdk.Screen
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
@ -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);
}
}
}
}

View file

@ -1,4 +1,4 @@
// Gdk.Selection.custom - Gdk Selection class customizations
// Gdk.Selection.cs - Gdk Selection class customizations
//
// Author: Mike Kestner <mkestner@novell.com>
//
@ -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));
}
}

198
gdk/Window.cs Normal file
View file

@ -0,0 +1,198 @@
// Gdk.Window.cs - Gdk Window class customizations
//
// Author: Moritz Balz <ich@mbalz.de>
// Mike Kestner <mkestner@ximian.com>
//
// 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
}
}

View file

@ -1,188 +0,0 @@
// Gdk.Window.custom - Gdk Window class customizations
//
// Author: Moritz Balz <ich@mbalz.de>
// Mike Kestner <mkestner@ximian.com>
//
// 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

View file

@ -1,4 +1,4 @@
// Gdk.WindowAttr.custom - Gdk Window class customizations
// Gdk.WindowAttr.cs - Gdk Window class customizations
//
// Author: Mike Kestner <mkestner@novell.com>
//
@ -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; }
}
}
}