2005-03-29 Mike Kestner <mkestner@novell.com>
* generator/Parser.cs : add symbol type='marshal' support. * gdk/Event.cs : add GetEvent method to wrap arbitrary events. * gdk/gdk-symbols.xml : make Event, EventAny, and EventNoExpose marshal symbols using Event.GetEvent (). [Fixes #74184] svn path=/trunk/gtk-sharp/; revision=42344
This commit is contained in:
parent
9001c6fa25
commit
639c24e0de
5 changed files with 91 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-03-29 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/Parser.cs : add symbol type='marshal' support.
|
||||
* gdk/Event.cs : add GetEvent method to wrap arbitrary events.
|
||||
* gdk/gdk-symbols.xml : make Event, EventAny, and EventNoExpose
|
||||
marshal symbols using Event.GetEvent (). [Fixes #74184]
|
||||
|
||||
2005-03-29 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* glib/Marshaller.cs : special case ucs4 "0" conversion.
|
||||
|
|
|
@ -99,5 +99,21 @@
|
|||
<remarks>None.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="GetEvent">
|
||||
<MemberSignature Language="C#" Value="public static Gdk.Event GetEvent (IntPtr raw);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>Gdk.Event</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="raw" Type="System.IntPtr" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>Gets an Event or Event subclass for a native event pointer.</summary>
|
||||
<param name="raw">a <see cref="T:System.IntPtr" /></param>
|
||||
<returns>a <see cref="T:Gdk.Event" /></returns>
|
||||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
</Type>
|
||||
|
|
58
gdk/Event.cs
58
gdk/Event.cs
|
@ -76,6 +76,64 @@ namespace Gdk {
|
|||
return gtksharp_gdk_event_get_send_event (Handle) == 0 ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
public static Event GetEvent (IntPtr raw)
|
||||
{
|
||||
switch (gtksharp_gdk_event_get_event_type (raw)) {
|
||||
case EventType.Expose:
|
||||
return new EventExpose (raw);
|
||||
case EventType.MotionNotify:
|
||||
return new EventMotion (raw);
|
||||
case EventType.ButtonPress:
|
||||
case EventType.TwoButtonPress:
|
||||
case EventType.ThreeButtonPress:
|
||||
case EventType.ButtonRelease:
|
||||
return new EventButton (raw);
|
||||
case EventType.KeyPress:
|
||||
case EventType.KeyRelease:
|
||||
return new EventKey (raw);
|
||||
case EventType.EnterNotify:
|
||||
case EventType.LeaveNotify:
|
||||
return new EventCrossing (raw);
|
||||
case EventType.FocusChange:
|
||||
return new EventFocus (raw);
|
||||
case EventType.Configure:
|
||||
return new EventConfigure (raw);
|
||||
case EventType.PropertyNotify:
|
||||
return new EventProperty (raw);
|
||||
case EventType.SelectionClear:
|
||||
case EventType.SelectionRequest:
|
||||
case EventType.SelectionNotify:
|
||||
return new EventSelection (raw);
|
||||
case EventType.ProximityIn:
|
||||
case EventType.ProximityOut:
|
||||
return new EventProximity (raw);
|
||||
case EventType.DragEnter:
|
||||
case EventType.DragLeave:
|
||||
case EventType.DragMotion:
|
||||
case EventType.DragStatus:
|
||||
case EventType.DropStart:
|
||||
case EventType.DropFinished:
|
||||
return new EventDND (raw);
|
||||
case EventType.ClientEvent:
|
||||
return new EventClient (raw);
|
||||
case EventType.VisibilityNotify:
|
||||
return new EventVisibility (raw);
|
||||
case EventType.Scroll:
|
||||
return new EventScroll (raw);
|
||||
case EventType.WindowState:
|
||||
return new EventWindowState (raw);
|
||||
case EventType.Setting:
|
||||
return new EventSetting (raw);
|
||||
case EventType.Map:
|
||||
case EventType.Unmap:
|
||||
case EventType.NoExpose:
|
||||
case EventType.Delete:
|
||||
case EventType.Destroy:
|
||||
default:
|
||||
return new Gdk.Event (raw);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<api>
|
||||
<symbol type="alias" cname="GdkBitmap" name="GdkPixmap" />
|
||||
<symbol type="manual" cname="GdkEvent" name="Gdk.Event"/>
|
||||
<symbol type="manual" cname="GdkEventAny" name="Gdk.Event"/>
|
||||
<symbol type="marshal" cname="GdkEvent" name="Gdk.Event" marshal_type="IntPtr" call_fmt="{0}.Handle" from_fmt="Gdk.Event.GetEvent ({0})"/>
|
||||
<symbol type="marshal" cname="GdkEventAny" name="Gdk.Event" marshal_type="IntPtr" call_fmt="{0}.Handle" from_fmt="Gdk.Event.GetEvent ({0})"/>
|
||||
<symbol type="manual" cname="GdkEventButton" name="Gdk.EventButton"/>
|
||||
<symbol type="manual" cname="GdkEventClient" name="Gdk.EventClient"/>
|
||||
<symbol type="manual" cname="GdkEventConfigure" name="Gdk.EventConfigure"/>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<symbol type="manual" cname="GdkEventFocus" name="Gdk.EventFocus"/>
|
||||
<symbol type="manual" cname="GdkEventKey" name="Gdk.EventKey"/>
|
||||
<symbol type="manual" cname="GdkEventMotion" name="Gdk.EventMotion"/>
|
||||
<symbol type="manual" cname="GdkEventNoExpose" name="Gdk.Event"/>
|
||||
<symbol type="marshal" cname="GdkEventNoExpose" name="Gdk.Event" marshal_type="IntPtr" call_fmt="{0}.Handle" from_fmt="Gdk.Event.GetEvent ({0})"/>
|
||||
<symbol type="manual" cname="GdkEventProperty" name="Gdk.EventProperty"/>
|
||||
<symbol type="manual" cname="GdkEventProximity" name="Gdk.EventProximity"/>
|
||||
<symbol type="manual" cname="GdkEventScroll" name="Gdk.EventScroll"/>
|
||||
|
|
|
@ -150,7 +150,12 @@ namespace GtkSharp.Generation {
|
|||
result = new ManualGen (cname, name);
|
||||
else if (type == "alias")
|
||||
result = new AliasGen (cname, name);
|
||||
else
|
||||
else if (type == "marshal") {
|
||||
string mtype = symbol.GetAttribute ("marshal_type");
|
||||
string call = symbol.GetAttribute ("call_fmt");
|
||||
string from = symbol.GetAttribute ("from_fmt");
|
||||
result = new MarshalGen (cname, name, mtype, call, from);
|
||||
} else
|
||||
Console.WriteLine ("Parser::ParseSymbol - Unexpected symbol type " + type);
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue