Fix bugs #27835 and #38672 by correcting problems in the generated ColorSelection binding.

svn path=/trunk/gtk-sharp/; revision=13600
This commit is contained in:
Lee Mallabone 2003-04-14 17:04:13 +00:00
parent 19c85a596d
commit 6395590d34
4 changed files with 83 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2003-04-14 Lee Mallabone <gnome@fonicmonkey.net>
* api/gtk-api.xml, sources/Gtk.metadata, gtk/ColorSelection.custom:
Fix up API in ColorSelection - Palette{From,To}String now work, and
PreviousColor is now a C# property.
2003-04-12 Alp Toker <alp@atoker.com>
* parser/gen_keysyms: Generates a C# Key enum from the Gdk headers

View File

@ -2152,7 +2152,7 @@
<method name="GetPreviousAlpha" cname="gtk_color_selection_get_previous_alpha">
<return-type type="guint16"/>
</method>
<method name="GetPreviousColor" cname="gtk_color_selection_get_previous_color">
<method name="GetPreviousColor" cname="gtk_color_selection_get_previous_color" hidden="1">
<return-type type="void"/>
<parameters>
<parameter type="GdkColor*" name="color"/>
@ -2165,7 +2165,7 @@
<return-type type="gboolean"/>
</method>
<constructor cname="gtk_color_selection_new"/>
<method name="PaletteFromString" cname="gtk_color_selection_palette_from_string" shared="true">
<method name="PaletteFromString" cname="gtk_color_selection_palette_from_string" shared="true" hidden="1">
<return-type type="gboolean"/>
<parameters>
<parameter type="const-gchar*" name="str"/>
@ -2173,7 +2173,7 @@
<parameter type="gint*" name="n_colors"/>
</parameters>
</method>
<method name="PaletteToString" cname="gtk_color_selection_palette_to_string" shared="true">
<method name="PaletteToString" cname="gtk_color_selection_palette_to_string" shared="true" hidden="1">
<return-type type="gchar*"/>
<parameters>
<parameter type="const-GdkColor*" name="colors"/>
@ -2216,7 +2216,7 @@
<parameter type="guint16" name="alpha"/>
</parameters>
</method>
<method name="SetPreviousColor" cname="gtk_color_selection_set_previous_color">
<method name="SetPreviousColor" cname="gtk_color_selection_set_previous_color" hidden="1">
<return-type type="void"/>
<parameters>
<parameter type="GdkColor*" name="color"/>
@ -12312,12 +12312,6 @@
<parameter type="HTMLColor*" name="color"/>
</parameters>
</method>
<method name="SetDefaultBackgroundColor" cname="gtk_html_set_default_background_color">
<return-type type="void"/>
<parameters>
<parameter type="GdkColor*" name="c"/>
</parameters>
</method>
<method name="SetDefaultContentType" cname="gtk_html_set_default_content_type">
<return-type type="void"/>
<parameters>

59
gtk/ColorSelection.custom Normal file
View File

@ -0,0 +1,59 @@
// Gtk.ColorSelection.custom - customizations and corrections for ColorSelection
// Author: Lee Mallabone <gnome@fonicmonkey.net>
// Author: Justin Malcolm
[DllImport("libgtk-win32-2.0-0.dll")]
static extern string gtk_color_selection_palette_to_string(Gdk.Color[] colors, int n_colors);
/// <summary> PaletteToString Method </summary>
public static string PaletteToString(Gdk.Color[] colors) {
int n_colors = colors.Length;
string raw_ret = gtk_color_selection_palette_to_string(colors, n_colors);
string ret = raw_ret;
return ret;
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_color_selection_palette_from_string(string str, out IntPtr colors, out int n_colors);
public static Gdk.Color[] PaletteFromString(string str) {
IntPtr parsedColors;
int n_colors;
bool raw_ret = gtk_color_selection_palette_from_string(str, out parsedColors, out n_colors);
// If things failed, return silently
if (!raw_ret)
{
return null;
}
System.Console.WriteLine("Raw call finished, making " + n_colors + " actual colors");
Gdk.Color[] colors = new Gdk.Color[n_colors];
for (int i=0; i < n_colors; i++)
{
colors[i] = Gdk.Color.New(parsedColors);
parsedColors = (IntPtr) ((int)parsedColors + Marshal.SizeOf(colors[i]));
}
return colors;
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_color_selection_set_previous_color(IntPtr raw, ref Gdk.Color color);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_color_selection_get_previous_color(IntPtr raw, out Gdk.Color color);
// Create Gtk# property to replace two Gtk+ functions
public Gdk.Color PreviousColor
{
get
{
Gdk.Color returnColor;
gtk_color_selection_get_previous_color(Handle, out returnColor);
return returnColor;
}
set
{
gtk_color_selection_set_previous_color(Handle, ref value);
}
}

View File

@ -1605,6 +1605,20 @@
</attribute>
</data>
</rule>
<rule>
<class name="GtkColorSelection">
<method>PaletteToString</method>
<method>PaletteFromString</method>
<method>GetPreviousColor</method>
<method>SetPreviousColor</method>
</class>
<data>
<attribute target="method">
<name>hidden</name>
<value>1</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkWidget">
<method>ListAccelClosures</method>