GtkSharp/gnome/IconTheme.cs
Mike Kestner 90a870e2de 2005-03-08 Mike Kestner <mkestner@novell.com>
* */*.cs : scrub for StringToPtrAnsi and string usage in DllImports.
	* */*.custom : begin the scrub here too.
	* generator/ConstStringGen.cs : implement IManualMarshaler and move to
	100% IntPtr marshaling.
	* generator/Ctor.cs : call Body.Finish too.
	* generator/IManualMarshaler.cs : new interface for generatables that
	marshal manually and need cleanup.
	* generator/Makefile.am : new file.
	* generator/MethodBody.cs : use IManualMarshaler if applicable.

svn path=/trunk/gtk-sharp/; revision=41579
2005-03-08 21:28:08 +00:00

71 lines
1.8 KiB
C#

// IconTheme.cs - Manual implementation of GnomeIconTheme class in GTK+-2.4.
//
// Authors: Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
// Copyright (c) 2004 Novell, Inc.
namespace Gnome {
using System;
using System.Collections;
using System.Runtime.InteropServices;
public class IconTheme : Gtk.IconTheme {
~IconTheme()
{
Dispose();
}
protected IconTheme(GLib.GType gtype) : base(gtype) {}
public IconTheme(IntPtr raw) : base(raw) {}
[DllImport("gnomeui-2")]
static extern IntPtr gnome_icon_theme_new();
public IconTheme() : base (IntPtr.Zero)
{
Raw = gnome_icon_theme_new();
}
[DllImport("gnomeui-2")]
static extern bool gnome_icon_theme_get_allow_svg(IntPtr raw);
[DllImport("gnomeui-2")]
static extern void gnome_icon_theme_set_allow_svg(IntPtr raw, bool allow_svg);
public bool AllowSvg {
get {
bool raw_ret = gnome_icon_theme_get_allow_svg(Handle);
bool ret = raw_ret;
return ret;
}
set {
gnome_icon_theme_set_allow_svg(Handle, value);
}
}
[DllImport("gnomeui-2")]
static extern IntPtr gnome_icon_theme_lookup_icon(IntPtr raw, IntPtr icon_name, int size, ref Gnome.IconData icon_data, out int base_size);
public string LookupIcon(string icon_name, int size, Gnome.IconData icon_data, out int base_size) {
IntPtr native_icon_name = GLib.Marshaller.StringToPtrGStrdup (icon_name);
IntPtr raw_ret = gnome_icon_theme_lookup_icon(Handle, native_icon_name, size, ref icon_data, out base_size);
GLib.Marshaller.Free (native_icon_name);
string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
return ret;
}
[DllImport("gnomeui-2")]
static extern IntPtr gnome_icon_theme_get_type();
public static new GLib.GType GType {
get {
IntPtr raw_ret = gnome_icon_theme_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}
}
}