* gtk/Gtk.metadata: Don't rename GtkStock to StockManager, hide

Lookup (so we can customize it) and AddStatic (since it can't work
        right from managed code), and tweak the params of Add.

        * gtk/Stock.custom: Implement Lookup() using a special
        ConstStockItem struct so the p/invoke layer won't try to free
        static strings. [#70589]

svn path=/trunk/gtk-sharp/; revision=37995
This commit is contained in:
Dan Winship 2004-12-20 19:33:29 +00:00
parent c9683719ef
commit 86d4828d5d
3 changed files with 40 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2004-12-20 Dan Winship <danw@novell.com>
* gtk/Gtk.metadata: Don't rename GtkStock to StockManager, hide
Lookup (so we can customize it) and AddStatic (since it can't work
right from managed code), and tweak the params of Add.
* gtk/Stock.custom: Implement Lookup() using a special
ConstStockItem struct so the p/invoke layer won't try to free
static strings. [#70589]
2004-12-20 Mike Kestner <mkestner@novell.com>
* generator/Property.cs : generate Interface properties.

View File

@ -49,9 +49,10 @@
<attr path="/api/namespace/class[@cname='GtkInit_']/method[@name='Check']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GtkInit_']/method[@name='CheckAbiCheck']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GtkInit_']/method[@name='AbiCheck']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GtkStock_']" name="name">StockManager</attr>
<attr path="/api/namespace/class[@cname='GtkStock_']/method[@name='Add']/*/*[@name='items']" name="array">1</attr>
<attr path="/api/namespace/class[@cname='GtkStock_']/method[@name='AddStatic']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GtkStock_']/method[@name='ListIds']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GtkStock_']/method[@name='Lookup']/*/*[@name='item']" name="pass_as">ref</attr>
<attr path="/api/namespace/class[@cname='GtkStock_']/method[@name='Lookup']" name="hidden">1</attr>
<attr path="/api/namespace/class[@cname='GtkTree_']/method[@name='GetRowDragData']/*/*[@name='tree_model']" name="pass_as">out</attr>
<attr path="/api/namespace/class[@cname='GtkTree_']/method[@name='GetRowDragData']/*/*[@name='path']" name="pass_as">out</attr>
<attr path="/api/namespace/class[@cname='GtkType_']" name="hidden">1</attr>

View File

@ -34,3 +34,30 @@
return result;
}
[StructLayout(LayoutKind.Sequential)]
struct ConstStockItem {
public IntPtr StockId;
public IntPtr Label;
public Gdk.ModifierType Modifier;
public uint Keyval;
public IntPtr TranslationDomain;
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_stock_lookup (string stock_id, out ConstStockItem item);
public static Gtk.StockItem Lookup (string stock_id) {
ConstStockItem const_item;
if (!gtk_stock_lookup (stock_id, out const_item))
return Gtk.StockItem.Zero;
Gtk.StockItem item = new Gtk.StockItem ();
item.StockId = Marshal.PtrToStringAnsi (const_item.StockId);
item.Label = Marshal.PtrToStringAnsi (const_item.Label);
item.Modifier = const_item.Modifier;
item.Keyval = const_item.Keyval;
item.TranslationDomain = Marshal.PtrToStringAnsi (const_item.TranslationDomain);
return item;
}