2008-01-02 Mike Kestner <mkestner@novell.com>

* gtk/MoveFocusHandler.cs: obsolete event types.
	* gtk/TextView.custom: obsolete move-focus signal. 
	* gtk/Window.custom: obsolete move-focus signal. 
	Compat fixes for removal of signals from gtk+ API. [Fixes #350770]

svn path=/trunk/gtk-sharp/; revision=92127
This commit is contained in:
Mike Kestner 2008-01-02 20:57:28 +00:00
parent 6c5f622c43
commit e07e7d5ecb
5 changed files with 170 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2008-01-02 Mike Kestner <mkestner@novell.com>
* gtk/MoveFocusHandler.cs: obsolete event types.
* gtk/TextView.custom: obsolete move-focus signal.
* gtk/Window.custom: obsolete move-focus signal.
Compat fixes for removal of signals from gtk+ API. [Fixes #350770]
2007-12-17 Mike Kestner <mkestner@novell.com>
* parser/gapi_pp.pl: parse 'typedef struct\n{' properly.

View File

@ -16,6 +16,7 @@ sources = \
BindingAttribute.cs \
ChildPropertyAttribute.cs \
ITreeNode.cs \
MoveFocusHandler.cs \
NodeCellDataFunc.cs \
NodeSelection.cs \
NodeStore.cs \

20
gtk/MoveFocusHandler.cs Normal file
View File

@ -0,0 +1,20 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gtk {
using System;
[Obsolete ("Events using this type were replaced by Gtk.Widget keybinding signal")]
public delegate void MoveFocusHandler(object o, MoveFocusArgs args);
[Obsolete ("Events using this type were replaced by Gtk.Widget keybinding signal")]
public class MoveFocusArgs : GLib.SignalArgs {
public Gtk.DirectionType Direction{
get {
return (Gtk.DirectionType) Args[0];
}
}
}
}

View File

@ -35,3 +35,74 @@
Raw = gtk_text_view_new_with_buffer (buffer.Handle);
}
[GLib.CDeclCallback]
delegate void MoveFocusSignalDelegate (IntPtr arg0, int arg1, IntPtr gch);
static void MoveFocusSignalCallback (IntPtr arg0, int arg1, IntPtr gch)
{
Gtk.MoveFocusArgs args = new Gtk.MoveFocusArgs ();
try {
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
if (sig == null)
throw new Exception("Unknown signal GC handle received " + gch);
args.Args = new object[1];
args.Args[0] = (Gtk.DirectionType) arg1;
Gtk.MoveFocusHandler handler = (Gtk.MoveFocusHandler) sig.Handler;
handler (GLib.Object.GetObject (arg0), args);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[GLib.CDeclCallback]
delegate void MoveFocusVMDelegate (IntPtr text_view, int direction);
static MoveFocusVMDelegate MoveFocusVMCallback;
static void movefocus_cb (IntPtr text_view, int direction)
{
try {
TextView text_view_managed = GLib.Object.GetObject (text_view, false) as TextView;
text_view_managed.OnMoveFocus ((Gtk.DirectionType) direction);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
private static void OverrideMoveFocus (GLib.GType gtype)
{
if (MoveFocusVMCallback == null)
MoveFocusVMCallback = new MoveFocusVMDelegate (movefocus_cb);
OverrideVirtualMethod (gtype, "move_focus", MoveFocusVMCallback);
}
[Obsolete ("Replaced by keybinding signal on Gtk.Widget")]
[GLib.DefaultSignalHandler(Type=typeof(Gtk.TextView), ConnectionMethod="OverrideMoveFocus")]
protected virtual void OnMoveFocus (Gtk.DirectionType direction)
{
GLib.Value ret = GLib.Value.Empty;
GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
GLib.Value[] vals = new GLib.Value [2];
vals [0] = new GLib.Value (this);
inst_and_params.Append (vals [0]);
vals [1] = new GLib.Value (direction);
inst_and_params.Append (vals [1]);
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
foreach (GLib.Value v in vals)
v.Dispose ();
}
[Obsolete ("Replaced by keybinding signal on Gtk.Widget")]
[GLib.Signal("move_focus")]
public event Gtk.MoveFocusHandler MoveFocus {
add {
GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback));
sig.AddDelegate (value);
}
remove {
GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback));
sig.RemoveDelegate (value);
}
}

View File

@ -86,3 +86,74 @@
}
}
[GLib.CDeclCallback]
delegate void MoveFocusSignalDelegate (IntPtr arg0, int arg1, IntPtr gch);
static void MoveFocusSignalCallback (IntPtr arg0, int arg1, IntPtr gch)
{
Gtk.MoveFocusArgs args = new Gtk.MoveFocusArgs ();
try {
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
if (sig == null)
throw new Exception("Unknown signal GC handle received " + gch);
args.Args = new object[1];
args.Args[0] = (Gtk.DirectionType) arg1;
Gtk.MoveFocusHandler handler = (Gtk.MoveFocusHandler) sig.Handler;
handler (GLib.Object.GetObject (arg0), args);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[GLib.CDeclCallback]
delegate void MoveFocusVMDelegate (IntPtr window, int direction);
static MoveFocusVMDelegate MoveFocusVMCallback;
static void movefocus_cb (IntPtr window, int direction)
{
try {
Window window_managed = GLib.Object.GetObject (window, false) as Window;
window_managed.OnMoveFocus ((Gtk.DirectionType) direction);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
private static void OverrideMoveFocus (GLib.GType gtype)
{
if (MoveFocusVMCallback == null)
MoveFocusVMCallback = new MoveFocusVMDelegate (movefocus_cb);
OverrideVirtualMethod (gtype, "move_focus", MoveFocusVMCallback);
}
[Obsolete ("Replaced by Keybinding signal on Gtk.Widget")]
[GLib.DefaultSignalHandler(Type=typeof(Gtk.Window), ConnectionMethod="OverrideMoveFocus")]
protected virtual void OnMoveFocus (Gtk.DirectionType direction)
{
GLib.Value ret = GLib.Value.Empty;
GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
GLib.Value[] vals = new GLib.Value [2];
vals [0] = new GLib.Value (this);
inst_and_params.Append (vals [0]);
vals [1] = new GLib.Value (direction);
inst_and_params.Append (vals [1]);
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
foreach (GLib.Value v in vals)
v.Dispose ();
}
[Obsolete ("Replaced by Keybinding signal on Gtk.Widget")]
[GLib.Signal("move_focus")]
public event Gtk.MoveFocusHandler MoveFocus {
add {
GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback));
sig.AddDelegate (value);
}
remove {
GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback));
sig.RemoveDelegate (value);
}
}