mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-12 06:45:40 +00:00
77d1b452f5
* generator/ObjectGen.cs : generate protected ctor () for all GLib.Objects that don't have any ctors. * gtk/CellRenderer.custom : remove ctor (). * gtkhtml/Gtk.metadata : add a disable_void_ctor rule for HTML. svn path=/trunk/gtk-sharp/; revision=28645
80 lines
3.6 KiB
Plaintext
80 lines
3.6 KiB
Plaintext
//
|
|
// CellRenderer.custom - Gtk CellRenderer class customizations
|
|
//
|
|
// Author: Todd Berman <tberman@sevenl.net>
|
|
//
|
|
// Copyright (C) 2004 Todd Berman
|
|
//
|
|
// This code is inserted after the automatically generated code.
|
|
//
|
|
|
|
[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);
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern void gtksharp_cellrenderer_override_get_size (GLib.GType gtype, GetSizeDelegate cb);
|
|
|
|
delegate void GetSizeDelegate (IntPtr item, IntPtr widget, IntPtr cell_area_ptr, IntPtr x_offset, IntPtr y_offset, IntPtr width, IntPtr height);
|
|
|
|
static GetSizeDelegate GetSizeCallback;
|
|
|
|
static void GetSize_cb (IntPtr item, IntPtr widget, IntPtr cell_area_ptr, IntPtr x_offset, IntPtr y_offset, IntPtr width, IntPtr height)
|
|
{
|
|
CellRenderer obj = GLib.Object.GetObject (item, false) as CellRenderer;
|
|
Gtk.Widget widg = GLib.Object.GetObject (widget, false) as Gtk.Widget;
|
|
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);
|
|
if (x_offset != IntPtr.Zero)
|
|
Marshal.WriteInt32 (x_offset, a);
|
|
if (y_offset != IntPtr.Zero)
|
|
Marshal.WriteInt32 (y_offset, b);
|
|
if (width != IntPtr.Zero)
|
|
Marshal.WriteInt32 (width, c);
|
|
if (height != IntPtr.Zero)
|
|
Marshal.WriteInt32 (height, d);
|
|
}
|
|
|
|
protected static void OverrideGetSize (GLib.GType gtype)
|
|
{
|
|
if (GetSizeCallback == null)
|
|
GetSizeCallback = new GetSizeDelegate (GetSize_cb);
|
|
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);
|
|
}
|
|
|
|
[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);
|
|
|
|
[DllImport("gtksharpglue")]
|
|
static extern void gtksharp_cellrenderer_override_render (GLib.GType gtype, RenderDelegate cb);
|
|
|
|
delegate void RenderDelegate (IntPtr item, IntPtr window, IntPtr widget, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, ref Gdk.Rectangle expose_area, Gtk.CellRendererState flags);
|
|
|
|
static RenderDelegate RenderCallback;
|
|
|
|
static void Render_cb (IntPtr item, IntPtr window, IntPtr widget, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, ref Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
|
|
{
|
|
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);
|
|
}
|
|
|
|
protected static void OverrideRender (GLib.GType gtype)
|
|
{
|
|
if (RenderCallback == null)
|
|
RenderCallback = new RenderDelegate (Render_cb);
|
|
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)
|
|
{
|
|
gtksharp_cellrenderer_base_render (Handle, window.Handle, widget.Handle, background_area, cell_area, expose_area, flags);
|
|
}
|