2004-02-11 Mike Kestner <mkestner@ximian.com>

* gtk/Gtk.metadata : hide the GList API
	* gtk/*.custom : manually wrap GList api using typed arrays
	* gtk/gtk-api.xml : regen.

svn path=/trunk/gtk-sharp/; revision=22990
This commit is contained in:
Mike Kestner 2004-02-11 21:34:32 +00:00
parent f774796311
commit 1e15749553
10 changed files with 235 additions and 44 deletions

View file

@ -1,3 +1,9 @@
2004-02-11 Mike Kestner <mkestner@ximian.com>
* gtk/Gtk.metadata : hide the GList API
* gtk/*.custom : manually wrap GList api using typed arrays
* gtk/gtk-api.xml : regen.
2004-02-10 Mike Kestner <mkestner@ximian.com>
* gconf/GConf.PropertyEditors/PropertyEditorColorPicker.cs :

View file

@ -1,9 +1,14 @@
public void SetPopdownStrings (params string[] args) {
GLib.List list = new GLib.List (IntPtr.Zero, typeof (string));
foreach (string arg in args)
list.Append (Marshal.StringToHGlobalAnsi (arg));
PopdownStrings = list;
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_combo_set_popdown_strings(IntPtr raw, IntPtr strings);
public string[] PopdownStrings {
set {
GLib.List list = new GLib.List (IntPtr.Zero, typeof (string));
foreach (string val in value)
list.Append (val);
gtk_combo_set_popdown_strings(Handle, list.Handle);
}
}
[DllImport("gtksharpglue")]

51
gtk/Container.custom Normal file
View file

@ -0,0 +1,51 @@
// Container.custom - customizations to Gtk.Container
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2004 Novell, Inc.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_container_get_children (IntPtr raw);
public Widget[] Children {
get {
IntPtr list_ptr = gtk_container_get_children (Handle);
if (list_ptr == IntPtr.Zero)
return null;
GLib.List list = new GLib.List (list_ptr, typeof (Gtk.Widget));
Widget[] result = new Widget [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Widget;
return result;
}
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_container_get_focus_chain (IntPtr raw, out IntPtr list_ptr);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_container_set_focus_chain (IntPtr raw, IntPtr list_ptr);
public Widget[] FocusChain {
get {
IntPtr list_ptr;
bool success = gtk_container_get_focus_chain (Handle, out list_ptr);
if (!success)
return null;
GLib.List list = new GLib.List (list_ptr, typeof (Gtk.Widget));
Widget[] result = new Widget [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Widget;
return result;
}
set {
GLib.List list = new GLib.List (IntPtr.Zero, typeof (Gtk.Widget));
foreach (Widget val in value)
list.Append (val.Handle);
gtk_container_set_focus_chain (Handle, list.Handle);
}
}

View file

@ -76,6 +76,10 @@
<attr path="/api/namespace/object[@cname='GtkColorSelection']/method[@name='SetChangePaletteHook']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkColorSelection']/method[@name='SetChangePaletteWithScreenHook']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkColorSelection']/method[@name='SetPreviousColor']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCombo']/method[@name='SetPopdownStrings']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/method[@name='GetChildren']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/method[@name='GetFocusChain']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/method[@name='SetFocusChain']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/signal[@name='Add']" name="name">Added</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/signal[@name='CheckResize']" name="name">ResizeChecked</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/signal[@name='Remove']" name="name">Removed</attr>
@ -181,6 +185,7 @@
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='InsertPixbuf']" name="name">PixbufInserted</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='RemoveChildAnchor']" name="name">ChildAnchorRemoved</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='RemoveTag']" name="name">TagRemoved</attr>
<attr path="/api/namespace/object[@cname='GtkTextChildAnchor']/method[@name='GetWidgets']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextLayout']/method[@name='GetIterAtLine']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkText']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr>
<attr path="/api/namespace/object[@cname='GtkTextTag']/method[@name='Event']" name="name">ProcessEvent</attr>
@ -196,8 +201,7 @@
<attr path="/api/namespace/object[@cname='GtkTreeModelSort']/method[@name='ConvertChildIterToIter']/*/*[@name='sort_iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeModelSort']/method[@name='ConvertIterToChildIter']/*/*[@name='child_iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeSelection']/method[@name='GetSelected']/*/*" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeSelection']/method[@name='GetSelectedRows']/*/*" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeSelection']/method[@name='GetSelectedRows']/return-type" name="element_type">Gtk.TreePath</attr>
<attr path="/api/namespace/object[@cname='GtkTreeSelection']/method[@name='GetSelectedRows']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/constructor[@cname='gtk_tree_store_newv']/*/*[@name='types']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/constructor[@cname='gtk_tree_store_newv']/*/*[@name='types']" name="params">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='Append']/*/*[@name='iter']" name="pass_as">out</attr>
@ -208,10 +212,12 @@
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='Remove']/*/*[@name='iter']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='SetColumnTypes']/*/*[@name='types']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeViewColumn']/method[@name='Clicked']" name="name">Click</attr>
<attr path="/api/namespace/object[@cname='GtkTreeViewColumn']/method[@name='GetCellRenderers']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/constructor[@cname='gtk_tree_view_new_with_model']/*/*[@type='GtkTreeModel*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='EnableModelDragDest']/*/*[@name='targets']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='EnableModelDragSource']/*/*[@name='targets']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetCellArea']/*/*[@name='rect']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetColumns']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetCursor']/*/*[@name='focus_column']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetCursor']/*/*[@name='path']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetDestRowAtPos']/*/*[@name='path']" name="pass_as">out</attr>
@ -268,9 +274,14 @@
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='SizeRequest']" name="name">SizeRequested</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='Unmap']" name="name">Unmapped</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='Unrealize']" name="name">Unrealized</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetDefaultIconList']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetDefaultSize']/*/*[@type='gint*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetIconList']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetPosition']/*/*[@type='gint*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetSize']/*/*[@type='gint*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='ListToplevels']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='SetDefaultIconList']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='SetIconList']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/property[@name='Screen']" name="new_flag">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/signal[@name='ActivateDefault']" name="name">DefaultActivated</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/signal[@name='ActivateFocus']" name="name">FocusActivated</attr>

View file

@ -0,0 +1,22 @@
// TextChildAnchor.custom - customizations to Gtk.TextChildAnchor
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2004 Novell, Inc.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_text_child_anchor_get_widgets (IntPtr raw);
public Widget[] Widgets {
get {
IntPtr raw_ret = gtk_text_child_anchor_get_widgets (Handle);
if (raw_ret == IntPtr.Zero)
return null;
GLib.List list = new GLib.List(raw_ret, typeof (Widget));
Widget[] result = new Widget [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Widget;
return result;
}
}

View file

@ -1,3 +1,24 @@
// Gtk.TreeSelection.Custom - Gtk TreeSelection calss customizations
// this file was emptied when the generator became capable of generating its contents,
// but was not removed in the event future customizations are needed.
// TreeSelection.custom - customizations to Gtk.TreeSelection
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2004 Novell, Inc.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_selection_get_selected_rows (IntPtr raw, out IntPtr model);
public TreePath[] GetSelectedRows (out TreeModel model)
{
IntPtr model_handle;
IntPtr list_ptr = gtk_tree_selection_get_selected_rows (Handle, out model_handle);
model = (Gtk.TreeModel) GLib.Object.GetObject(model_handle);
if (list_ptr == IntPtr.Zero)
return null;
GLib.List list = new GLib.List (list_ptr, typeof (Gtk.TreePath));
TreePath[] result = new TreePath [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (TreePath) list [i];
return result;
}

View file

@ -15,15 +15,28 @@
Raw = gtk_tree_view_new_with_model (store.Handle);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_view_get_columns (IntPtr raw);
public TreeViewColumn[] Columns {
get {
IntPtr raw_ret = gtk_tree_view_get_columns (Handle);
if (raw_ret == IntPtr.Zero)
return null;
GLib.List list = new GLib.List (raw_ret, typeof (Gtk.TreeViewColumn));
TreeViewColumn[] result = new TreeViewColumn [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as TreeViewColumn;
return result;
}
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_view_get_model (IntPtr raw);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_view_set_model (IntPtr raw, IntPtr raw_model);
/// <summary>Model Property</summary>
/// <remarks>Gets the model being displayed by the TreeView
/// </remarks>
public Gtk.TreeModel Model {
get {
IntPtr raw_ret = gtk_tree_view_get_model (Handle);

View file

@ -32,3 +32,19 @@
_NewWithAttributes (title, cell, attrs);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_tree_view_column_get_cell_renderers (IntPtr raw);
public CellRenderer[] CellRenderers {
get {
IntPtr raw_ret = gtk_tree_view_column_get_cell_renderers (Handle);
if (raw_ret == IntPtr.Zero)
return null;
GLib.List list = new GLib.List (raw_ret, typeof (CellRenderer));
CellRenderer[] result = new CellRenderer [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as CellRenderer;
return result;
}
}

View file

@ -1,8 +1,9 @@
// Gtk.Window.custom - Gtk Window class customizations
//
// Author: Mike Kestner <mkestner@speakeasy.net>
// Author: Mike Kestner <mkestner@ximian.com>
//
// (c) 2001 Mike Kestner
// Copyright (c) 2001 Mike Kestner
// Copyright (c) 2004 Novell, Inc.
//
// This code is inserted after the automatically generated code.
@ -20,27 +21,33 @@
}
}
/// <summary>
/// Window Constructor
/// </summary>
///
/// <remarks>
/// Constructs a new Window of type TopLevel with the
/// specified Title.
/// </remarks>
public Window (String title) : this (WindowType.Toplevel)
{
this.Title = title;
}
/// <summary>
/// DefaultSize Property
/// </summary>
///
/// <remarks>
/// The default Size of the Window in Screen Coordinates.
/// </remarks>
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_window_get_default_icon_list();
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_window_set_default_icon_list(IntPtr list);
public static Gdk.Pixbuf[] DefaultIconList {
get {
IntPtr raw_ret = gtk_window_get_default_icon_list();
GLib.List list = new GLib.List(raw_ret, typeof (Gdk.Pixbuf));
Gdk.Pixbuf[] result = new Gdk.Pixbuf [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Gdk.Pixbuf;
return result;
}
set {
GLib.List list = new GLib.List(IntPtr.Zero, typeof (Gdk.Pixbuf));
foreach (Gdk.Pixbuf val in value)
list.Append (val.Handle);
gtk_window_set_default_icon_list(list.Handle);
}
}
public System.Drawing.Size DefaultSize {
get {
@ -53,6 +60,29 @@
}
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_window_get_icon_list(IntPtr raw);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_window_set_icon_list(IntPtr raw, IntPtr list);
public Gdk.Pixbuf[] IconList {
get {
IntPtr raw_ret = gtk_window_get_icon_list(Handle);
GLib.List list = new GLib.List(raw_ret, typeof (Gdk.Pixbuf));
Gdk.Pixbuf[] result = new Gdk.Pixbuf [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Gdk.Pixbuf;
return result;
}
set {
GLib.List list = new GLib.List(IntPtr.Zero, typeof (Gdk.Pixbuf));
foreach (Gdk.Pixbuf val in value)
list.Append (val.Handle);
gtk_window_set_icon_list(Handle, list.Handle);
}
}
public System.Drawing.Size Position {
get {
int x, y;
@ -72,3 +102,19 @@
x, y);
}
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_window_list_toplevels();
public static Window[] ListToplevels ()
{
IntPtr raw_ret = gtk_window_list_toplevels();
if (raw_ret == IntPtr.Zero)
return null;
GLib.List list = new GLib.List(raw_ret, typeof (Gtk.Window));
Window[] result = new Window [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Window;
return result;
}

View file

@ -2408,7 +2408,7 @@
<parameter type="const-gchar*" name="item_value" />
</parameters>
</method>
<method name="SetPopdownStrings" cname="gtk_combo_set_popdown_strings">
<method name="SetPopdownStrings" cname="gtk_combo_set_popdown_strings" hidden="1">
<return-type type="void" />
<parameters>
<parameter type="GList*" name="strings" />
@ -2578,10 +2578,10 @@
<method name="GetBorderWidth" cname="gtk_container_get_border_width">
<return-type type="guint" />
</method>
<method name="GetChildren" cname="gtk_container_get_children">
<method name="GetChildren" cname="gtk_container_get_children" hidden="1">
<return-type type="GList*" />
</method>
<method name="GetFocusChain" cname="gtk_container_get_focus_chain">
<method name="GetFocusChain" cname="gtk_container_get_focus_chain" hidden="1">
<return-type type="gboolean" />
<parameters>
<parameter type="GList**" name="focusable_widgets" />
@ -2621,7 +2621,7 @@
<parameter type="guint" name="border_width" />
</parameters>
</method>
<method name="SetFocusChain" cname="gtk_container_set_focus_chain">
<method name="SetFocusChain" cname="gtk_container_set_focus_chain" hidden="1">
<return-type type="void" />
<parameters>
<parameter type="GList*" name="focusable_widgets" />
@ -7207,7 +7207,7 @@
<method name="GetType" cname="gtk_text_child_anchor_get_type" shared="true">
<return-type type="GType" />
</method>
<method name="GetWidgets" cname="gtk_text_child_anchor_get_widgets">
<method name="GetWidgets" cname="gtk_text_child_anchor_get_widgets" hidden="1">
<return-type type="GList*" />
</method>
<constructor cname="gtk_text_child_anchor_new" />
@ -8245,7 +8245,7 @@
<parameter type="GtkTreeIter*" name="iter" pass_as="out" />
</parameters>
</method>
<method name="GetSelectedRows" cname="gtk_tree_selection_get_selected_rows">
<method name="GetSelectedRows" cname="gtk_tree_selection_get_selected_rows" hidden="1">
<return-type type="GList*" element_type="Gtk.TreePath" />
<parameters>
<parameter type="GtkTreeModel**" name="model" pass_as="out" />
@ -8704,7 +8704,7 @@
<parameter type="gint" name="n" />
</parameters>
</method>
<method name="GetColumns" cname="gtk_tree_view_get_columns">
<method name="GetColumns" cname="gtk_tree_view_get_columns" hidden="1">
<return-type type="GList*" />
</method>
<method name="GetCursor" cname="gtk_tree_view_get_cursor">
@ -9116,7 +9116,7 @@
<method name="GetAlignment" cname="gtk_tree_view_column_get_alignment">
<return-type type="gfloat" />
</method>
<method name="GetCellRenderers" cname="gtk_tree_view_column_get_cell_renderers">
<method name="GetCellRenderers" cname="gtk_tree_view_column_get_cell_renderers" hidden="1">
<return-type type="GList*" />
</method>
<method name="GetClickable" cname="gtk_tree_view_column_get_clickable">
@ -10597,7 +10597,7 @@
<method name="GetDecorated" cname="gtk_window_get_decorated">
<return-type type="gboolean" />
</method>
<method name="GetDefaultIconList" cname="gtk_window_get_default_icon_list" shared="true">
<method name="GetDefaultIconList" cname="gtk_window_get_default_icon_list" shared="true" hidden="1">
<return-type type="GList*" />
</method>
<method name="GetDefaultSize" cname="gtk_window_get_default_size">
@ -10631,7 +10631,7 @@
<method name="GetIcon" cname="gtk_window_get_icon">
<return-type type="GdkPixbuf*" />
</method>
<method name="GetIconList" cname="gtk_window_get_icon_list">
<method name="GetIconList" cname="gtk_window_get_icon_list" hidden="1">
<return-type type="GList*" />
</method>
<method name="GetMnemonicModifier" cname="gtk_window_get_mnemonic_modifier">
@ -10684,7 +10684,7 @@
<method name="Iconify" cname="gtk_window_iconify">
<return-type type="void" />
</method>
<method name="ListToplevels" cname="gtk_window_list_toplevels" shared="true">
<method name="ListToplevels" cname="gtk_window_list_toplevels" shared="true" hidden="1">
<return-type type="GList*" />
</method>
<method name="Maximize" cname="gtk_window_maximize">
@ -10772,7 +10772,7 @@
<parameter type="GError**" name="err" />
</parameters>
</method>
<method name="SetDefaultIconList" cname="gtk_window_set_default_icon_list" shared="true">
<method name="SetDefaultIconList" cname="gtk_window_set_default_icon_list" shared="true" hidden="1">
<return-type type="void" />
<parameters>
<parameter type="GList*" name="list" />
@ -10839,7 +10839,7 @@
<parameter type="GError**" name="err" />
</parameters>
</method>
<method name="SetIconList" cname="gtk_window_set_icon_list">
<method name="SetIconList" cname="gtk_window_set_icon_list" hidden="1">
<return-type type="void" />
<parameters>
<parameter type="GList*" name="list" />