2004-02-18 Mike Kestner <mkestner@ximian.com>
* gdk/Gdk.metadata : hide EventMotion * gdk/EventMotion.cs : glue-based manual implementation. * gdk/EventMotion.custom : kill * gdk/gdk-api.xml : regen * gdk/gdk-symbols.xml : manual mapping for EventMotion. * glue/event.cs : expose Motion struct fields. * sample/Scribble.cs : fix some EventMotion api breakage svn path=/trunk/gtk-sharp/; revision=23224
This commit is contained in:
parent
1ca02083f6
commit
c0db7bdbcb
8 changed files with 180 additions and 22 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2004-02-18 Mike Kestner <mkestner@ximian.com>
|
||||||
|
|
||||||
|
* gdk/Gdk.metadata : hide EventMotion
|
||||||
|
* gdk/EventMotion.cs : glue-based manual implementation.
|
||||||
|
* gdk/EventMotion.custom : kill
|
||||||
|
* gdk/gdk-api.xml : regen
|
||||||
|
* gdk/gdk-symbols.xml : manual mapping for EventMotion.
|
||||||
|
* glue/event.cs : expose Motion struct fields.
|
||||||
|
* sample/Scribble.cs : fix some EventMotion api breakage
|
||||||
|
|
||||||
2004-02-18 Mike Kestner <mkestner@ximian.com>
|
2004-02-18 Mike Kestner <mkestner@ximian.com>
|
||||||
|
|
||||||
* gdk/Gdk.metadata : hide EventScroll
|
* gdk/Gdk.metadata : hide EventScroll
|
||||||
|
|
101
gdk/EventMotion.cs
Normal file
101
gdk/EventMotion.cs
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
// Gdk.EventMotion.cs - Custom motion event wrapper
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@ximian.com>
|
||||||
|
//
|
||||||
|
// (c) 2004 Novell, Inc.
|
||||||
|
|
||||||
|
namespace Gdk {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
public class EventMotion : Event {
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern uint gtksharp_gdk_event_motion_get_time (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_motion_get_x (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_motion_get_y (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_motion_get_x_root (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_motion_get_y_root (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern uint gtksharp_gdk_event_motion_get_state (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern ushort gtksharp_gdk_event_motion_get_is_hint (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern IntPtr gtksharp_gdk_event_motion_get_device (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern IntPtr gtksharp_gdk_event_motion_get_axes (IntPtr evt);
|
||||||
|
|
||||||
|
public EventMotion (IntPtr raw) : base (raw) {}
|
||||||
|
|
||||||
|
public uint Time {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_motion_get_time (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModifierType State {
|
||||||
|
get {
|
||||||
|
return (ModifierType) gtksharp_gdk_event_motion_get_state (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double X {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_motion_get_x (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Y {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_motion_get_y (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double XRoot {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_motion_get_x_root (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double YRoot {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_motion_get_y_root (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsHint {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_motion_get_is_hint (Handle) == 0 ? false : true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Device Device {
|
||||||
|
get {
|
||||||
|
return GLib.Object.GetObject (gtksharp_gdk_event_motion_get_device (Handle)) as Device;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] Axes {
|
||||||
|
get {
|
||||||
|
double[] result = new double [2];
|
||||||
|
IntPtr axes = gtksharp_gdk_event_motion_get_axes (Handle);
|
||||||
|
Marshal.Copy (result, 0, axes, 2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
//
|
|
||||||
// gdk/EventMotion.custom
|
|
||||||
//
|
|
||||||
// Author: Gustavo Giraldez <gustavo.giraldez@gmx.net>
|
|
||||||
//
|
|
||||||
// Copyright (C) 2004 Gustavo Giraldez.
|
|
||||||
//
|
|
||||||
|
|
||||||
[DllImport("libgdk-win32-2.0-0.dll")]
|
|
||||||
static extern IntPtr gdk_event_get_type();
|
|
||||||
|
|
||||||
public static GLib.GType GType {
|
|
||||||
get {
|
|
||||||
IntPtr raw_ret = gdk_event_get_type();
|
|
||||||
GLib.GType ret = new GLib.GType(raw_ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -66,6 +66,7 @@
|
||||||
<attr path="//struct[@cname='GdkEventAny']" name="hidden">1</attr>
|
<attr path="//struct[@cname='GdkEventAny']" name="hidden">1</attr>
|
||||||
<attr path="//struct[@cname='GdkEventButton']" name="hidden">1</attr>
|
<attr path="//struct[@cname='GdkEventButton']" name="hidden">1</attr>
|
||||||
<attr path="//struct[@cname='GdkEventKey']" name="hidden">1</attr>
|
<attr path="//struct[@cname='GdkEventKey']" name="hidden">1</attr>
|
||||||
|
<attr path="//struct[@cname='GdkEventMotion']" name="hidden">1</attr>
|
||||||
<attr path="//struct[@cname='GdkEventScroll']" name="hidden">1</attr>
|
<attr path="//struct[@cname='GdkEventScroll']" name="hidden">1</attr>
|
||||||
<attr path="//struct[@cname='GdkPixmapObject']" name="hidden">1</attr>
|
<attr path="//struct[@cname='GdkPixmapObject']" name="hidden">1</attr>
|
||||||
<attr path="//struct[@cname='GdkTimeCoord']/field[@cname='axes']" name="array_len">128</attr>
|
<attr path="//struct[@cname='GdkTimeCoord']/field[@cname='axes']" name="array_len">128</attr>
|
||||||
|
|
|
@ -2351,7 +2351,7 @@
|
||||||
<field cname="hardware_keycode" type="guint16" />
|
<field cname="hardware_keycode" type="guint16" />
|
||||||
<field cname="group" type="guint8" />
|
<field cname="group" type="guint8" />
|
||||||
</struct>
|
</struct>
|
||||||
<struct name="EventMotion" cname="GdkEventMotion">
|
<struct name="EventMotion" cname="GdkEventMotion" hidden="1">
|
||||||
<field cname="type" type="GdkEventType" />
|
<field cname="type" type="GdkEventType" />
|
||||||
<field cname="window" type="GdkWindow*" />
|
<field cname="window" type="GdkWindow*" />
|
||||||
<field cname="send_event" type="gint8" />
|
<field cname="send_event" type="gint8" />
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<symbol type="manual" cname="GdkEventAny" name="Gdk.Event"/>
|
<symbol type="manual" cname="GdkEventAny" name="Gdk.Event"/>
|
||||||
<symbol type="manual" cname="GdkEventButton" name="Gdk.EventButton"/>
|
<symbol type="manual" cname="GdkEventButton" name="Gdk.EventButton"/>
|
||||||
<symbol type="manual" cname="GdkEventKey" name="Gdk.EventKey"/>
|
<symbol type="manual" cname="GdkEventKey" name="Gdk.EventKey"/>
|
||||||
|
<symbol type="manual" cname="GdkEventMotion" name="Gdk.EventMotion"/>
|
||||||
<symbol type="manual" cname="GdkEventScroll" name="Gdk.EventScroll"/>
|
<symbol type="manual" cname="GdkEventScroll" name="Gdk.EventScroll"/>
|
||||||
</api>
|
</api>
|
||||||
|
|
||||||
|
|
63
glue/event.c
63
glue/event.c
|
@ -36,6 +36,15 @@ gdouble gtksharp_gdk_event_scroll_get_y (GdkEventScroll *event);
|
||||||
gdouble gtksharp_gdk_event_scroll_get_x_root (GdkEventScroll *event);
|
gdouble gtksharp_gdk_event_scroll_get_x_root (GdkEventScroll *event);
|
||||||
gdouble gtksharp_gdk_event_scroll_get_y_root (GdkEventScroll *event);
|
gdouble gtksharp_gdk_event_scroll_get_y_root (GdkEventScroll *event);
|
||||||
GdkDevice* gtksharp_gdk_event_scroll_get_device (GdkEventScroll *event);
|
GdkDevice* gtksharp_gdk_event_scroll_get_device (GdkEventScroll *event);
|
||||||
|
guint32 gtksharp_gdk_event_motion_get_time (GdkEventMotion *event);
|
||||||
|
guint gtksharp_gdk_event_motion_get_state (GdkEventMotion *event);
|
||||||
|
guint16 gtksharp_gdk_event_motion_get_is_hint (GdkEventMotion *event);
|
||||||
|
gdouble gtksharp_gdk_event_motion_get_x (GdkEventMotion *event);
|
||||||
|
gdouble gtksharp_gdk_event_motion_get_y (GdkEventMotion *event);
|
||||||
|
gdouble gtksharp_gdk_event_motion_get_x_root (GdkEventMotion *event);
|
||||||
|
gdouble gtksharp_gdk_event_motion_get_y_root (GdkEventMotion *event);
|
||||||
|
gdouble* gtksharp_gdk_event_motion_get_axes (GdkEventMotion *event);
|
||||||
|
GdkDevice* gtksharp_gdk_event_motion_get_device (GdkEventMotion *event);
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
GdkEventType
|
GdkEventType
|
||||||
|
@ -188,3 +197,57 @@ gtksharp_gdk_event_scroll_get_y_root (GdkEventScroll *event)
|
||||||
return event->y_root;
|
return event->y_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint32
|
||||||
|
gtksharp_gdk_event_motion_get_time (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->time;
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gtksharp_gdk_event_motion_get_state (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
guint16
|
||||||
|
gtksharp_gdk_event_motion_get_is_hint (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->is_hint;
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkDevice*
|
||||||
|
gtksharp_gdk_event_motion_get_device (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->device;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_motion_get_x (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->x;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_motion_get_y (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->y;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_motion_get_x_root (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->x_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_motion_get_y_root (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->y_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble*
|
||||||
|
gtksharp_gdk_event_motion_get_axes (GdkEventMotion *event)
|
||||||
|
{
|
||||||
|
return event->axes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,16 +108,16 @@ namespace GtkSamples {
|
||||||
int x, y;
|
int x, y;
|
||||||
Gdk.ModifierType state;
|
Gdk.ModifierType state;
|
||||||
Gdk.EventMotion ev = args.Event;
|
Gdk.EventMotion ev = args.Event;
|
||||||
Gdk.Window window = ev.window;
|
Gdk.Window window = ev.Window;
|
||||||
|
|
||||||
if (ev.IsHint != 0) {
|
if (ev.IsHint) {
|
||||||
Gdk.ModifierType s;
|
Gdk.ModifierType s;
|
||||||
window.GetPointer (out x, out y, out s);
|
window.GetPointer (out x, out y, out s);
|
||||||
state = s;
|
state = s;
|
||||||
} else {
|
} else {
|
||||||
x = (int) ev.X;
|
x = (int) ev.X;
|
||||||
y = (int) ev.Y;
|
y = (int) ev.Y;
|
||||||
state = (Gdk.ModifierType) ev.State;
|
state = ev.State;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((state & Gdk.ModifierType.Button1Mask) != 0 && pixmap != null)
|
if ((state & Gdk.ModifierType.Button1Mask) != 0 && pixmap != null)
|
||||||
|
|
Loading…
Reference in a new issue