2004-02-18 Mike Kestner <mkestner@ximian.com>
* gdk/Gdk.metadata : hide EventButton * gdk/EventButton.cs : glue-based manual implementation. * gdk/EventButton.custom : kill * gdk/gdk-api.xml : regen * gdk/gdk-symbols.xml : manual mapping for EventButton. * glue/event.cs : expose Button struct fields. * sample/CanvasExample.cs : fix EventButton ctor * sample/GnomeHelloWorld.cs : fix EventButton ctor svn path=/trunk/gtk-sharp/; revision=23220
This commit is contained in:
parent
21ddf92108
commit
2665037c0e
9 changed files with 181 additions and 28 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2004-02-18 Mike Kestner <mkestner@ximian.com>
|
||||||
|
|
||||||
|
* gdk/Gdk.metadata : hide EventButton
|
||||||
|
* gdk/EventButton.cs : glue-based manual implementation.
|
||||||
|
* gdk/EventButton.custom : kill
|
||||||
|
* gdk/gdk-api.xml : regen
|
||||||
|
* gdk/gdk-symbols.xml : manual mapping for EventButton.
|
||||||
|
* glue/event.cs : expose Button struct fields.
|
||||||
|
* sample/CanvasExample.cs : fix EventButton ctor
|
||||||
|
* sample/GnomeHelloWorld.cs : fix EventButton ctor
|
||||||
|
|
||||||
2004-02-17 Radek Doulik <rodo@ximian.com>
|
2004-02-17 Radek Doulik <rodo@ximian.com>
|
||||||
|
|
||||||
* glib/Value.cs: use g_value_set_pointer for
|
* glib/Value.cs: use g_value_set_pointer for
|
||||||
|
|
101
gdk/EventButton.cs
Normal file
101
gdk/EventButton.cs
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
// Gdk.EventButton.cs - Custom button event wrapper
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@ximian.com>
|
||||||
|
//
|
||||||
|
// (c) 2004 Novell, Inc.
|
||||||
|
|
||||||
|
namespace Gdk {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
public class EventButton : Event {
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern uint gtksharp_gdk_event_button_get_time (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_button_get_x (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_button_get_y (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_button_get_x_root (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern double gtksharp_gdk_event_button_get_y_root (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern uint gtksharp_gdk_event_button_get_state (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern uint gtksharp_gdk_event_button_get_button (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern IntPtr gtksharp_gdk_event_button_get_device (IntPtr evt);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern IntPtr gtksharp_gdk_event_button_get_axes (IntPtr evt);
|
||||||
|
|
||||||
|
public EventButton (IntPtr raw) : base (raw) {}
|
||||||
|
|
||||||
|
public uint Time {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_button_get_time (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModifierType State {
|
||||||
|
get {
|
||||||
|
return (ModifierType) gtksharp_gdk_event_button_get_state (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double X {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_button_get_x (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Y {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_button_get_y (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double XRoot {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_button_get_x_root (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double YRoot {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_button_get_y_root (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint Button {
|
||||||
|
get {
|
||||||
|
return gtksharp_gdk_event_button_get_button (Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Device Device {
|
||||||
|
get {
|
||||||
|
return GLib.Object.GetObject (gtksharp_gdk_event_button_get_device (Handle)) as Device;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] Axes {
|
||||||
|
get {
|
||||||
|
double[] result = new double [2];
|
||||||
|
IntPtr axes = gtksharp_gdk_event_button_get_axes (Handle);
|
||||||
|
Marshal.Copy (result, 0, axes, 2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
//
|
|
||||||
// gdk/EventButton.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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -64,6 +64,7 @@
|
||||||
<attr path="/api/namespace/object[@cname='GdkWindow']/method[@name='SetCursor']/parameters/parameter[@name='cursor']" name="null_ok">1</attr>
|
<attr path="/api/namespace/object[@cname='GdkWindow']/method[@name='SetCursor']/parameters/parameter[@name='cursor']" name="null_ok">1</attr>
|
||||||
<attr path="//object[@cname='GdkWindow']/method[@name='SetIconList']" name="hidden">1</attr>
|
<attr path="//object[@cname='GdkWindow']/method[@name='SetIconList']" name="hidden">1</attr>
|
||||||
<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='GdkEventKey']" name="hidden">1</attr>
|
<attr path="//struct[@cname='GdkEventKey']" 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>
|
||||||
|
|
|
@ -2270,7 +2270,7 @@
|
||||||
<field cname="window" type="GdkWindow*" />
|
<field cname="window" type="GdkWindow*" />
|
||||||
<field cname="send_event" type="gint8" />
|
<field cname="send_event" type="gint8" />
|
||||||
</struct>
|
</struct>
|
||||||
<struct name="EventButton" cname="GdkEventButton">
|
<struct name="EventButton" cname="GdkEventButton" 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" />
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<api>
|
<api>
|
||||||
<symbol type="manual" cname="GdkEvent" name="Gdk.Event"/>
|
<symbol type="manual" cname="GdkEvent" name="Gdk.Event"/>
|
||||||
<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="GdkEventKey" name="Gdk.EventKey"/>
|
<symbol type="manual" cname="GdkEventKey" name="Gdk.EventKey"/>
|
||||||
</api>
|
</api>
|
||||||
|
|
||||||
|
|
65
glue/event.c
65
glue/event.c
|
@ -19,6 +19,15 @@ guint gtksharp_gdk_event_key_get_state (GdkEventKey *event);
|
||||||
guint gtksharp_gdk_event_key_get_keyval (GdkEventKey *event);
|
guint gtksharp_gdk_event_key_get_keyval (GdkEventKey *event);
|
||||||
guint16 gtksharp_gdk_event_key_get_hardware_keycode (GdkEventKey *event);
|
guint16 gtksharp_gdk_event_key_get_hardware_keycode (GdkEventKey *event);
|
||||||
guint8 gtksharp_gdk_event_key_get_group (GdkEventKey *event);
|
guint8 gtksharp_gdk_event_key_get_group (GdkEventKey *event);
|
||||||
|
guint32 gtksharp_gdk_event_button_get_time (GdkEventButton *event);
|
||||||
|
guint gtksharp_gdk_event_button_get_state (GdkEventButton *event);
|
||||||
|
guint gtksharp_gdk_event_button_get_button (GdkEventButton *event);
|
||||||
|
gdouble gtksharp_gdk_event_button_get_x (GdkEventButton *event);
|
||||||
|
gdouble gtksharp_gdk_event_button_get_y (GdkEventButton *event);
|
||||||
|
gdouble gtksharp_gdk_event_button_get_x_root (GdkEventButton *event);
|
||||||
|
gdouble gtksharp_gdk_event_button_get_y_root (GdkEventButton *event);
|
||||||
|
gdouble* gtksharp_gdk_event_button_get_axes (GdkEventButton *event);
|
||||||
|
GdkDevice* gtksharp_gdk_event_button_get_device (GdkEventButton *event);
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
GdkEventType
|
GdkEventType
|
||||||
|
@ -48,7 +57,7 @@ gtksharp_gdk_event_key_get_time (GdkEventKey *event)
|
||||||
guint
|
guint
|
||||||
gtksharp_gdk_event_key_get_state (GdkEventKey *event)
|
gtksharp_gdk_event_key_get_state (GdkEventKey *event)
|
||||||
{
|
{
|
||||||
return event->time;
|
return event->state;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
|
@ -69,3 +78,57 @@ gtksharp_gdk_event_key_get_group (GdkEventKey *event)
|
||||||
return event->group;
|
return event->group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint32
|
||||||
|
gtksharp_gdk_event_button_get_time (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->time;
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gtksharp_gdk_event_button_get_state (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->state;
|
||||||
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
gtksharp_gdk_event_button_get_button (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->button;
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkDevice*
|
||||||
|
gtksharp_gdk_event_button_get_device (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->device;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_button_get_x (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->x;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_button_get_y (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->y;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_button_get_x_root (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->x_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble
|
||||||
|
gtksharp_gdk_event_button_get_y_root (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->y_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
gdouble*
|
||||||
|
gtksharp_gdk_event_button_get_axes (GdkEventButton *event)
|
||||||
|
{
|
||||||
|
return event->axes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace GtkSamples {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_Event (object obj, Gnome.CanvasEventArgs args) {
|
void Item_Event (object obj, Gnome.CanvasEventArgs args) {
|
||||||
EventButton ev = EventButton.New (args.Event.Handle);
|
EventButton ev = new EventButton (args.Event.Handle);
|
||||||
CanvasRE item = (CanvasRE) obj;
|
CanvasRE item = (CanvasRE) obj;
|
||||||
|
|
||||||
switch (ev.Type) {
|
switch (ev.Type) {
|
||||||
|
|
|
@ -151,13 +151,7 @@ namespace GtkSamples {
|
||||||
void icon_selected_cb (object obj, Gnome.IconSelectedArgs args)
|
void icon_selected_cb (object obj, Gnome.IconSelectedArgs args)
|
||||||
{
|
{
|
||||||
int idx = args.Num;
|
int idx = args.Num;
|
||||||
Event ev_any = args.Event;
|
EventButton ev = new EventButton (args.Event.Handle);
|
||||||
EventButton ev = EventButton.New (ev_any.Handle);
|
|
||||||
|
|
||||||
// test the accessor, this is unnecessary in real code
|
|
||||||
Gdk.WindowType type = ev.window.WindowType;
|
|
||||||
if (type != Gdk.WindowType.Child)
|
|
||||||
Console.WriteLine ("Struct field accessors appear to be broken.");
|
|
||||||
|
|
||||||
if (ev.Type == EventType.TwoButtonPress && ev.Button == 1) {
|
if (ev.Type == EventType.TwoButtonPress && ev.Button == 1) {
|
||||||
g_spawn_command_line_async ("mono " + entries[idx].program, IntPtr.Zero);
|
g_spawn_command_line_async ("mono " + entries[idx].program, IntPtr.Zero);
|
||||||
|
|
Loading…
Reference in a new issue