2004-06-04 Todd Berman <tberman@sevenl.net>

* gnome/CanvasItem.custom: Changed from OnXXX vmethods to XXX vmethods
        * gnome/CanvasProxy.cs: removed, unused code
        * gnome/GtkSharp.BoundsHandler.cs: removed
        * gnome/GtkSharp.DrawHandler.cs: removed
        * gnome/GtkSharp.PointHandler.cs: removed
        * gnome/GtkSharp.RenderHandler.cs: removed
        * gnome/GtkSharp.UpdateHandler.cs: removed
        * gnome/Makefile.am: updated to reflect removing of old files.
        * gtk/CellRenderer.custom: Changed from OnXXX vmethods to XXX vmethods,
        and added StartEditing vmethod
        * gtk/Container.custom: Changed from OnForall to ForAll
        * gtk/Gtk.metadata: hide CellRenderer.GetSize and StartEditing
        * gtk/glue/cellrenderer.c: new glue for CellRenderer.StartEditing
        override.
        * sample/CustomCellRenderer.cs: updated signatures to reflect new
        code.

svn path=/trunk/gtk-sharp/; revision=28815
This commit is contained in:
Todd Berman 2004-06-04 04:55:48 +00:00
parent 73a0c307bd
commit 12bc3b0550
14 changed files with 102 additions and 370 deletions

View file

@ -1,3 +1,22 @@
2004-06-04 Todd Berman <tberman@sevenl.net>
* gnome/CanvasItem.custom: Changed from OnXXX vmethods to XXX vmethods
* gnome/CanvasProxy.cs: removed, unused code
* gnome/GtkSharp.BoundsHandler.cs: removed
* gnome/GtkSharp.DrawHandler.cs: removed
* gnome/GtkSharp.PointHandler.cs: removed
* gnome/GtkSharp.RenderHandler.cs: removed
* gnome/GtkSharp.UpdateHandler.cs: removed
* gnome/Makefile.am: updated to reflect removing of old files.
* gtk/CellRenderer.custom: Changed from OnXXX vmethods to XXX vmethods,
and added StartEditing vmethod
* gtk/Container.custom: Changed from OnForall to ForAll
* gtk/Gtk.metadata: hide CellRenderer.GetSize and StartEditing
* gtk/glue/cellrenderer.c: new glue for CellRenderer.StartEditing
override.
* sample/CustomCellRenderer.cs: updated signatures to reflect new
code.
2004-06-02 Vladimir Vukicevic <vladimir@pobox.com>
* gdk/Pixbuf.custom : Pixels prop isn't unsafe

View file

@ -70,7 +70,7 @@
static void Realize_cb (IntPtr item)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
obj.OnRealize ();
obj.Realize ();
}
protected static void OverrideRealize (GLib.GType gtype)
@ -80,7 +80,7 @@
gnomesharp_canvas_item_override_realize (gtype, RealizeCallback);
}
protected virtual void OnRealize ()
protected virtual void Realize ()
{
gnomesharp_canvas_item_base_realize (Handle);
}
@ -99,7 +99,7 @@
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
CanvasItem actual_item;
double result = obj.OnPoint (x, y, cx, cy, out actual_item);
double result = obj.Point (x, y, cx, cy, out actual_item);
actual_item_handle = actual_item != null ? actual_item.Handle : IntPtr.Zero;
return result;
}
@ -111,7 +111,7 @@
gnomesharp_canvas_item_override_point (gtype, PointCallback);
}
protected virtual double OnPoint (double x, double y, int cx, int cy, out CanvasItem actual_item)
protected virtual double Point (double x, double y, int cx, int cy, out CanvasItem actual_item)
{
IntPtr actual_item_handle;
double result = gnomesharp_canvas_item_base_point (Handle, x, y, cx, cy, out actual_item_handle);
@ -133,7 +133,7 @@
{
CanvasItem obj = GLib.Object.GetObject (handle, false) as CanvasItem;
Gdk.Drawable drawable = GLib.Object.GetObject (drawable_handle, false) as Gdk.Drawable;
obj.OnDraw (drawable, x, y, width, height);
obj.Draw (drawable, x, y, width, height);
}
protected static void OverrideDraw (GLib.GType gtype)
@ -143,7 +143,7 @@
gnomesharp_canvas_item_override_draw (gtype, DrawCallback);
}
protected virtual void OnDraw (Gdk.Drawable drawable, int x, int y, int width, int height)
protected virtual void Draw (Gdk.Drawable drawable, int x, int y, int width, int height)
{
gnomesharp_canvas_item_base_draw (Handle, drawable.Handle, x, y, width, height);
}
@ -161,7 +161,7 @@
static void Render_cb (IntPtr handle, ref CanvasBuf buf)
{
CanvasItem obj = GLib.Object.GetObject (handle, false) as CanvasItem;
obj.OnRender (ref buf);
obj.Render (ref buf);
}
protected static void OverrideRender (GLib.GType gtype)
@ -171,7 +171,7 @@
gnomesharp_canvas_item_override_render (gtype, RenderCallback);
}
protected virtual void OnRender (ref CanvasBuf buf)
protected virtual void Render (ref CanvasBuf buf)
{
gnomesharp_canvas_item_base_render (Handle, ref buf);
}
@ -196,7 +196,7 @@
clip_path = Art.SVP.Zero;
else
clip_path = (Art.SVP) Marshal.PtrToStructure (clip_path_handle, typeof(Art.SVP));
obj.OnUpdate (affine, ref clip_path, flags);
obj.Update (affine, ref clip_path, flags);
}
protected static void OverrideUpdate (GLib.GType gtype)
@ -206,7 +206,7 @@
gnomesharp_canvas_item_override_update (gtype, UpdateCallback);
}
protected virtual void OnUpdate (double[] affine, ref Art.SVP clip_path, int flags)
protected virtual void Update (double[] affine, ref Art.SVP clip_path, int flags)
{
gnomesharp_canvas_item_base_update (Handle, affine, ref clip_path, flags);
}

View file

@ -1,147 +0,0 @@
//
// CanvasProxy.cs - For subclassing CanvasItems
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
using System;
using System.Collections;
namespace Gnome {
public class CanvasProxy : Gnome.CanvasItem
{
public CanvasProxy (IntPtr raw) : base (raw) {}
protected CanvasProxy () : base (IntPtr.Zero) {}
public event UpdateHandler Update {
add {
if (AfterHandlers["update"] == null)
AfterSignals["update"] = new GtkSharp.voidObjectAffineSVPintSignal(this, "update", value, System.Type.GetType("EventArgs"));
AfterHandlers.AddHandler("update", value);
}
remove {
AfterHandlers.RemoveHandler ("update", value);
if (AfterHandlers ["update"] == null)
AfterSignals.Remove ("update");
}
}
public event EventHandler Realize {
add {
if (AfterHandlers["realize"] == null)
AfterSignals["realize"] = new GnomeSharp.voidObjectSignal(this, "realize", value, System.Type.GetType("EventArgs"), 1);
AfterHandlers.AddHandler("realize", value);
}
remove {
AfterHandlers.RemoveHandler("realize", value);
if (AfterHandlers["realize"] == null)
AfterSignals.Remove("realize");
}
}
public event EventHandler Unrealize {
add {
if (AfterHandlers["unrealize"] == null)
AfterSignals["unrealize"] = new GnomeSharp.voidObjectSignal(this, "unrealize", value, System.Type.GetType("EventArgs"), 1);
AfterHandlers.AddHandler("unrealize", value);
}
remove {
AfterHandlers.RemoveHandler("unrealize", value);
if (AfterHandlers["unrealize"] == null)
AfterSignals.Remove("unrealize");
}
}
public event EventHandler Map {
add {
if (AfterHandlers["map"] == null)
AfterSignals["map"] = new GnomeSharp.voidObjectSignal(this, "map", value, System.Type.GetType("EventArgs"), 1);
AfterHandlers.AddHandler("map", value);
}
remove {
AfterHandlers.RemoveHandler("map", value);
if (AfterHandlers["map"] == null)
AfterSignals.Remove("map");
}
}
public event EventHandler Unmap {
add {
if (AfterHandlers["unmap"] == null)
AfterSignals["unmap"] = new GnomeSharp.voidObjectSignal(this, "unmap", value, System.Type.GetType("EventArgs"), 1);
AfterHandlers.AddHandler("unmap", value);
}
remove {
AfterHandlers.RemoveHandler("unmap", value);
if (AfterHandlers["unmap"] == null)
AfterSignals.Remove("unmap");
}
}
public event EventHandler Coverage {
add {
throw new NotImplementedException ();
}
remove {
AfterHandlers.RemoveHandler ("coverage", value);
if (AfterHandlers ["coverage"] == null)
AfterSignals.Remove ("coverage");
}
}
public event DrawHandler Draw {
add {
throw new NotImplementedException ();
}
remove {
AfterHandlers.RemoveHandler ("draw", value);
if (AfterHandlers ["draw"] == null)
AfterSignals.Remove ("draw");
}
}
public event RenderHandler Render {
add {
throw new NotImplementedException ();
}
remove {
AfterHandlers.RemoveHandler ("render", value);
if (AfterHandlers ["render"] == null)
AfterSignals.Remove ("render");
}
}
public event PointHandler Point {
add {
throw new NotImplementedException ();
}
remove {
AfterHandlers.RemoveHandler ("point", value);
if (AfterHandlers ["point"] == null)
AfterSignals.Remove ("point");
}
}
public event BoundsHandler Bounds {
add {
throw new NotImplementedException ();
}
remove {
AfterHandlers.RemoveHandler ("bounds", value);
if (AfterHandlers ["bounds"] == null)
AfterSignals.Remove ("bounds");
}
}
}
}

View file

@ -1,41 +0,0 @@
//
// GtkSharp.BoundsHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace Gnome {
using System;
public delegate void BoundsHandler(object o, BoundsArgs args);
public class BoundsArgs : GLib.SignalArgs {
public double [] X1 {
get {
return (double []) Args [0];
}
}
public double [] Y1 {
get {
return (double []) Args [1];
}
}
public double [] X2 {
get {
return (double []) Args [2];
}
}
public double [] Y2 {
get {
return (double []) Args [3];
}
}
}
}

View file

@ -1,47 +0,0 @@
//
// Gnome.DrawHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace Gnome {
using System;
public delegate void DrawHandler(object o, DrawArgs args);
public class DrawArgs : GLib.SignalArgs {
public Gdk.Drawable Drawable {
get {
return (Gdk.Drawable) Args [0];
}
}
public int X {
get {
return (int) Args [1];
}
}
public int Y {
get {
return (int) Args [2];
}
}
public int Width {
get {
return (int) Args [3];
}
}
public int Height {
get {
return (int) Args [4];
}
}
}
}

View file

@ -1,47 +0,0 @@
//
// Gnome.PointHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace Gnome {
using System;
public delegate void PointHandler(object o, PointArgs args);
public class PointArgs : GLib.SignalArgs {
public double X {
get {
return (double) Args [0];
}
}
public double Y {
get {
return (double) Args [1];
}
}
public int CX {
get {
return (int) Args [2];
}
}
public int CY {
get {
return (int) Args [3];
}
}
public Gnome.CanvasItem [] ActualItem {
get {
return (Gnome.CanvasItem []) Args [4];
}
}
}
}

View file

@ -1,23 +0,0 @@
//
// Gnome.RenderHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace Gnome {
using System;
public delegate void RenderHandler(object o, RenderArgs args);
public class RenderArgs : GLib.SignalArgs {
public Gnome.CanvasBuf Buf {
get {
return (Gnome.CanvasBuf) Args [0];
}
}
}
}

View file

@ -1,35 +0,0 @@
//
// Gnome.CanvasUpdateHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace Gnome {
using System;
public delegate void UpdateHandler (object o, UpdateArgs args);
public class UpdateArgs : GLib.SignalArgs {
public double [] Affine {
get {
return (double []) Args [0];
}
}
public Art.SVP ClipPath {
get {
return (Art.SVP) Args [1];
}
}
public int Flags {
get {
return (int) Args [2];
}
}
}
}

View file

@ -28,12 +28,6 @@ CLEANFILES = $(ASSEMBLY) generated-stamp generated/*.cs $(API) gtk-sharp.pub
DISTCLEANFILES = gnome-sharp.pc $(ASSEMBLY).config AssemblyInfo.cs
sources = \
CanvasProxy.cs \
GtkSharp.BoundsHandler.cs \
GtkSharp.DrawHandler.cs \
GtkSharp.PointHandler.cs \
GtkSharp.RenderHandler.cs \
GtkSharp.UpdateHandler.cs \
Modules.cs \
voidObjectAffineSVPintSignal.cs

View file

@ -9,8 +9,8 @@
//
[DllImport("gtksharpglue")]
static extern void gtksharp_cellrenderer_base_get_size (IntPtr handle, IntPtr widget, Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height);
static extern void gtksharp_cellrenderer_base_get_size (IntPtr handle, IntPtr widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height);
[DllImport("gtksharpglue")]
static extern void gtksharp_cellrenderer_override_get_size (GLib.GType gtype, GetSizeDelegate cb);
@ -25,7 +25,7 @@
Gdk.Rectangle cell_area = Gdk.Rectangle.New (cell_area_ptr);
int a, b, c, d;
obj.OnGetSize (widg, cell_area, out a, out b, out c, out d);
obj.GetSize (widg, ref cell_area, out a, out b, out c, out d);
if (x_offset != IntPtr.Zero)
Marshal.WriteInt32 (x_offset, a);
if (y_offset != IntPtr.Zero)
@ -43,11 +43,11 @@
gtksharp_cellrenderer_override_get_size (gtype, GetSizeCallback);
}
protected virtual void OnGetSize (Gtk.Widget widget, Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
gtksharp_cellrenderer_base_get_size (Handle, widget.Handle, cell_area, out x_offset, out y_offset, out width, out height);
public virtual void GetSize(Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height) {
gtksharp_cellrenderer_base_get_size(Handle, widget.Handle, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[DllImport("gtksharpglue")]
static extern void gtksharp_cellrenderer_base_render (IntPtr handle, IntPtr window, IntPtr widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags);
@ -63,7 +63,7 @@
CellRenderer obj = GLib.Object.GetObject (item, false) as CellRenderer;
Gdk.Drawable wind = GLib.Object.GetObject (window, false) as Gdk.Drawable;
Gtk.Widget widg = GLib.Object.GetObject (widget, false) as Gtk.Widget;
obj.OnRender (wind, widg, background_area, cell_area, expose_area, flags);
obj.Render (wind, widg, background_area, cell_area, expose_area, flags);
}
protected static void OverrideRender (GLib.GType gtype)
@ -73,7 +73,41 @@
gtksharp_cellrenderer_override_render (gtype, RenderCallback);
}
protected virtual void OnRender (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
protected virtual void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
gtksharp_cellrenderer_base_render (Handle, window.Handle, widget.Handle, background_area, cell_area, expose_area, flags);
}
[DllImport("gtksharpglue")]
static extern void gtksharp_cellrenderer_override_start_editing (GLib.GType gtype, StartEditingDelegate cb);
delegate IntPtr StartEditingDelegate (IntPtr raw, IntPtr evnt, IntPtr widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags);
static StartEditingDelegate StartEditingCallback;
static IntPtr StartEditing_cb (IntPtr raw, IntPtr evnt, IntPtr widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
CellRenderer obj = GLib.Object.GetObject (raw, false) as CellRenderer;
Gdk.Event _event = new Gdk.Event (evnt);
Widget widg = GLib.Object.GetObject (widget, false) as Gtk.Widget;
CellEditable retval = obj.StartEditing (_event, widg, path, background_area, cell_area, flags);
if (retval == null)
return IntPtr.Zero;
return retval.Handle;
}
protected static void OverrideStartEditing (GLib.GType gtype)
{
if (StartEditingCallback == null)
StartEditingCallback = new StartEditingDelegate (StartEditing_cb);
gtksharp_cellrenderer_override_start_editing (gtype, StartEditingCallback);
}
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_cellrenderer_base_start_editing(IntPtr raw, IntPtr evnt, IntPtr widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, int flags);
public virtual Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
IntPtr raw_ret = gtksharp_cellrenderer_base_start_editing(Handle, evnt.Handle, widget.Handle, path, ref background_area, ref cell_area, (int) flags);
Gtk.CellEditable ret = (Gtk.CellEditable) GLib.Object.GetObject(raw_ret);
return ret;
}

View file

@ -94,7 +94,7 @@ static void Forall_cb (IntPtr container, bool include_internals, IntPtr cb, IntP
{
Container obj = GLib.Object.GetObject (container, false) as Container;
CallbackInvoker invoker = new CallbackInvoker (cb, data);
obj.OnForall (include_internals, invoker);
obj.ForAll (include_internals, invoker);
}
protected static void OverrideForall (GLib.GType gtype)
@ -104,7 +104,7 @@ protected static void OverrideForall (GLib.GType gtype)
gtksharp_container_override_forall (gtype, ForallCallback);
}
protected virtual void OnForall (bool include_internals, CallbackInvoker invoker)
protected virtual void ForAll (bool include_internals, CallbackInvoker invoker)
{
gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data);
}

View file

@ -79,6 +79,8 @@
<attr path="/api/namespace/object[@cname='GtkButton']/signal[@name='Enter']" name="name">Entered</attr>
<attr path="/api/namespace/object[@cname='GtkButton']/signal[@name='Leave']" name="name">Left</attr>
<attr path="/api/namespace/object[@cname='GtkCalendar']/method[@name='DisplayOptions']" name="name">SetDisplayOptions</attr>
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/method[@name='StartEditing']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/method[@name='GetSize']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCheckButton']/constructor[@cname='gtk_check_button_new_with_mnemonic']" name="preferred">1</attr>
<attr path="/api/namespace/object[@cname='GtkCheckMenuItem']/constructor[@cname='gtk_check_menu_item_new_with_mnemonic']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCheckMenuItem']/constructor[@cname='gtk_check_menu_item_new_with_label']" name="hidden">1</attr>

View file

@ -48,3 +48,26 @@ gtksharp_cellrenderer_override_render (GType gtype, gpointer cb)
klass = g_type_class_ref (gtype);
((GtkCellRendererClass *) klass)->render = cb;
}
GtkCellEditable * gtksharp_cellrenderer_base_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags);
GtkCellEditable *
gtksharp_cellrenderer_base_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags)
{
GtkCellRendererClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (cell));
if (parent->start_editing)
return (*parent->start_editing) (cell, event, widget, path, background_area, cell_area, flags);
return NULL;
}
void gtksharp_cellrenderer_override_start_editing (GType gtype, gpointer cb);
void
gtksharp_cellrenderer_override_start_editing (GType gtype, gpointer cb)
{
GtkCellRendererClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((GtkCellRendererClass *) klass)->start_editing = cb;
}

View file

@ -25,14 +25,14 @@ public class CustomCellRenderer : CellRenderer
percent = value;
}
}
static CustomCellRenderer ()
{
OverrideGetSize (GLib.Object.LookupGType (typeof (CustomCellRenderer)));
OverrideRender (GLib.Object.LookupGType (typeof (CustomCellRenderer)));
}
protected override void OnGetSize (Widget widget, Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
public override void GetSize (Widget widget, ref Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
int calc_width = (int) this.Xpad * 2 + 100;
int calc_height = (int) this.Ypad * 2 + 10;
@ -51,11 +51,11 @@ public class CustomCellRenderer : CellRenderer
}
}
protected override void OnRender (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
protected override void Render (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
{
int width = 0, height = 0, x_offset = 0, y_offset = 0;
StateType state;
OnGetSize (widget, cell_area, out x_offset, out y_offset, out width, out height);
GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
if (widget.HasFocus)
state = StateType.Active;