2004-09-09 Mike Kestner <mkestner@ximian.com>

* gdk/Device.custom : manual GetHistory impl.
	* gdk/Display.custom : manual GetPointer overloads.
	* gdk/Gdk.metadata : hides and array params.
	* gdk/Makefile.am : add new file.
	* gdk/TextProperty.cs : new manual impl of methods.

svn path=/trunk/gtk-sharp/; revision=33664
This commit is contained in:
Mike Kestner 2004-09-09 18:05:37 +00:00
parent 9e9ba80d18
commit 48e9e4d138
6 changed files with 163 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2004-09-09 Mike Kestner <mkestner@ximian.com>
* gdk/Device.custom : manual GetHistory impl.
* gdk/Display.custom : manual GetPointer overloads.
* gdk/Gdk.metadata : hides and array params.
* gdk/Makefile.am : add new file.
* gdk/TextProperty.cs : new manual impl of methods.
2004-09-03 Mike Kestner <mkestner@ximian.com>
* configure.in : expand new doc/updater makefile

View file

@ -104,3 +104,27 @@
public Gdk.DeviceKey GetDeviceKey (uint axis) {
return gtksharp_gdk_device_get_device_key (Handle, axis);
}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern void gdk_device_free_history(IntPtr events, int n_events);
[DllImport("libgdk-win32-2.0-0.dll")]
static extern bool gdk_device_get_history(IntPtr device, IntPtr window, uint start, uint stop, out IntPtr events, out int n_events);
public TimeCoord[] GetHistory (Gdk.Window window, uint start, uint stop)
{
IntPtr coords_handle;
int count;
if (gdk_device_get_history (Handle, window.Handle, start, stop, out coords_handle, out count)) {
TimeCoord[] result = new TimeCoord [count];
for (int i = 0; i < count; i++) {
IntPtr ptr = Marshal.ReadIntPtr (coords_handle, i + IntPtr.Size);
result [i] = TimeCoord.New (ptr);
}
gdk_device_free_history (coords_handle, count);
return result;
} else
return new TimeCoord [0];
}

View file

@ -18,6 +18,46 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport("libgdk-win32-2.0-0.dll")]
static extern void gdk_display_get_pointer(IntPtr raw, IntPtr screen, out int x, out int y, out int mask);
[Obsolete]
public void GetPointer(Gdk.Screen screen, out int x, out int y, out Gdk.ModifierType mask) {
int mask_as_int;
gdk_display_get_pointer(Handle, screen.Handle, out x, out y, out mask_as_int);
mask = (Gdk.ModifierType) mask_as_int;
}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern void gdk_display_get_pointer(IntPtr raw, out IntPtr screen, out int x, out int y, out int mask);
public void GetPointer(out Gdk.Screen screen, out int x, out int y, out Gdk.ModifierType mask) {
IntPtr screen_handle;
int mask_as_int;
gdk_display_get_pointer(Handle, out screen_handle, out x, out y, out mask_as_int);
screen = (Gdk.Screen) GLib.Object.GetObject(screen_handle);
mask = (Gdk.ModifierType) mask_as_int;
}
public void GetPointer (out int x, out int y)
{
Gdk.ModifierType mod;
Gdk.Screen screen;
GetPointer (out screen, out x, out y, out mod);
}
public void GetPointer (out int x, out int y, out Gdk.ModifierType mod)
{
Gdk.Screen screen;
GetPointer (out screen, out x, out y, out mod);
}
public void GetPointer (out Gdk.Screen screen, out int x, out int y)
{
Gdk.ModifierType mod;
GetPointer (out screen, out x, out y, out mod);
}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_display_list_devices (IntPtr raw);

View file

@ -10,19 +10,23 @@
<attr path="/api/namespace/boxed[@cname='GdkRectangle']/method[@name='Union']/*/*[@name='dest']" name="pass_as">out</attr>
<attr path="/api/namespace/callback[@cname='GdkPixbufDestroyNotify']/*/*[@type='guchar*']" name="array">1</attr>
<attr path="/api/namespace/class[@cname='GdkDrag_']/method[@name='Begin']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GdkDrag_']/method[@name='FindWindow']/*/*[@name='dest_window']" name="pass_as">out</attr>
<attr path="/api/namespace/class[@cname='GdkDrag_']/method[@name='FindWindowForScreen']/*/*[@name='dest_window']" name="pass_as">out</attr>
<attr path="/api/namespace/class[@cname='GdkEvent_']" name="name">EventHelper</attr>
<attr path="/api/namespace/class[@cname='GdkKeyval_']/method[@name='Name']/return-type" name="type">const-gchar*</attr>
<attr path="/api/namespace/class[@cname='GdkGlobal']/method[@name='DevicesList']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GdkGlobal']/method[@name='FreeTextList']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GdkGlobal']/method[@name='ListVisuals']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GdkPango_']" name="name">PangoHelper</attr>
<attr path="/api/namespace/class[@cname='GdkPixbuf_']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GdkPointer_']/method[@name='Grab']/*/*[@name='confine_to']" name="null_ok">1</attr>
<attr path="/api/namespace/class[@cname='GdkPointer_']/method[@name='Grab']/*/*[@name='cursor']" name="null_ok">1</attr>
<attr path="/api/namespace/class[@cname='GdkProperty_']/method[@name='Get']/*/*[@name='actual_property_type']" name="pass_as">out</attr>
<attr path="/api/namespace/enum[@cname='GdkWindowClass']/member[@name='Output']" name="name">InputOutput</attr>
<attr path="/api/namespace/enum[@cname='GdkWindowClass']/member[@name='Only']" name="name">InputOnly</attr>
<attr path="/api/namespace/class[@cname='GdkProperty_']/method[@name='Get']/*/*[@name='data']" name="pass_as">out</attr>
<attr path="/api/namespace/class[@cname='GdkProperty_']/method[@name='Get']/*/*[@name='data']" name="array">1</attr>
<attr path="/api/namespace/class[@cname='GdkText_']" name="hidden">1</attr>
<attr path="/api/namespace/enum[@cname='GdkWindowClass']/member[@name='Output']" name="name">InputOutput</attr>
<attr path="/api/namespace/enum[@cname='GdkWindowClass']/member[@name='Only']" name="name">InputOnly</attr>
<attr path="/api/namespace/object[@cname='GdkBitmap']" name="parent">GdkDrawable</attr>
<attr path="/api/namespace/object[@cname='GdkColormap']/method[@name='AllocColor']/*/*[@type='GdkColor*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GdkColormap']/method[@name='AllocColors']/*/*[@type='GdkColor*']" name="array">1</attr>
@ -30,8 +34,11 @@
<attr path="/api/namespace/object[@cname='GdkColormap']/method[@name='QueryColor']/*/*[@type='GdkColor*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GdkColormap']/method[@name='FreeColors']/*/*[@type='GdkColor*']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GdkDevice']/method[@name='GetAxis']/*/*[@name='axes']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GdkDevice']/method[@name='FreeHistory']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkDevice']/method[@name='GetHistory']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkDevice']/method[@name='GetState']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkDevice']/method[@name='SetSource']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='GetPointer']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='ListDevices']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkDisplayManager']/method[@name='ListDisplays']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkDrawable']/method[@name='DrawGrayImage']/*/*[@name='buf']" name="array">1</attr>
@ -58,7 +65,12 @@
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderToDrawable']" name="library">libgdk-win32-2.0-0.dll</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderToDrawableAlpha']" name="library">libgdk-win32-2.0-0.dll</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderPixmapAndMaskForColormap']" name="library">libgdk-win32-2.0-0.dll</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderPixmapAndMaskForColormap']/*/*[@name='pixmap_return']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderPixmapAndMaskForColormap']/*/*[@name='mask_return']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderPixmapAndMask']" name="library">libgdk-win32-2.0-0.dll</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderPixmapAndMask']/*/*[@name='pixmap_return']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='RenderPixmapAndMask']/*/*[@name='mask_return']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Save']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Savev']/*/*[@type='char**']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='ScaleSimple']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GdkPixbufLoader']/method[@name='GetPixbuf']" name="needs_ref">1</attr>
@ -113,7 +125,10 @@
<attr path="/api/namespace/struct[@cname='GdkPixdata']/method[@name='Serialize']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GdkPixmapObject']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']" name="opaque">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='GetClipbox']/*/*[@name='rectangle']" name="pass_as">out</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='GetRectangles']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='Polygon']/*/*[@name='points']" name="array">1</attr>
<attr path="/api/namespace/struct[@cname='GdkRegion']/method[@name='Polygon']/*/*[@name='npoints']" name="name">n_points</attr>
<attr path="/api/namespace/struct[@cname='GdkTimeCoord']/field[@cname='axes']" name="array_len">128</attr>
<attr path="/api/namespace/struct[@cname='GdkWindowObject']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GdkAtom']/method[@name='Name']" name="name">GetName</attr>

View file

@ -35,7 +35,8 @@ sources = \
EventVisibility.cs \
EventWindowState.cs \
Key.cs \
Size.cs
Size.cs \
TextProperty.cs
build_sources = $(addprefix $(srcdir)/, $(sources)) AssemblyInfo.cs

72
gdk/TextProperty.cs Normal file
View file

@ -0,0 +1,72 @@
// Gdk.Text.cs - Custom implementation for Text class
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2004 Novell, Inc.
//
// 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.Runtime.InteropServices;
public class TextProperty {
[DllImport("libgdk-win32-2.0-0.dll")]
static extern void gdk_free_text_list(IntPtr ptr);
[DllImport("libgdk-win32-2.0-0.dll")]
static extern int gdk_text_property_to_utf8_list(IntPtr encoding, int format, byte[] text, int length, out IntPtr list);
public static string[] ToStringList (Gdk.Atom encoding, int format, byte[] text, int length)
{
IntPtr list_ptr;
int count = gdk_text_property_to_utf8_list(encoding.Handle, format, text, length, out list_ptr);
if (count == 0)
return new string [0];
string[] result = new string [count];
for (int i = 0; i < count; i++) {
IntPtr ptr = Marshal.ReadIntPtr (list_ptr, i * IntPtr.Size);
result [i] = Marshal.PtrToStringAnsi (ptr);
}
gdk_free_text_list (list_ptr);
return result;
}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern int gdk_text_property_to_utf8_list_for_display(IntPtr display, IntPtr encoding, int format, byte[] text, int length, out IntPtr list);
public static string[] ToStringListForDisplay (Gdk.Display display, Gdk.Atom encoding, int format, byte[] text, int length)
{
IntPtr list_ptr;
int count = gdk_text_property_to_utf8_list_for_display (display.Handle, encoding.Handle, format, text, length, out list_ptr);
if (count == 0)
return new string [0];
string[] result = new string [count];
for (int i = 0; i < count; i++) {
IntPtr ptr = Marshal.ReadIntPtr (list_ptr, i * IntPtr.Size);
result [i] = Marshal.PtrToStringAnsi (ptr);
}
gdk_free_text_list (list_ptr);
return result;
}
}
}