diff --git a/ChangeLog b/ChangeLog index ff7400fab..b95fbc455 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-02-11 Mike Kestner + + * 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 * gconf/GConf.PropertyEditors/PropertyEditorColorPicker.cs : diff --git a/gtk/Combo.custom b/gtk/Combo.custom index 4f35df0c1..b5d17bdd6 100644 --- a/gtk/Combo.custom +++ b/gtk/Combo.custom @@ -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")] diff --git a/gtk/Container.custom b/gtk/Container.custom new file mode 100644 index 000000000..f9625e182 --- /dev/null +++ b/gtk/Container.custom @@ -0,0 +1,51 @@ +// Container.custom - customizations to Gtk.Container +// +// Authors: Mike Kestner +// +// 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); + } + +} + diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index e3563a1c0..85285879d 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -76,6 +76,10 @@ 1 1 1 + 1 + 1 + 1 + 1 Added ResizeChecked Removed @@ -181,6 +185,7 @@ PixbufInserted ChildAnchorRemoved TagRemoved + 1 out ScrollAdjustmentsSet ProcessEvent @@ -196,8 +201,7 @@ out out out - out - Gtk.TreePath + 1 1 1 out @@ -208,10 +212,12 @@ ref 1 Click + 1 1 1 1 out + 1 out out out @@ -268,9 +274,14 @@ SizeRequested Unmapped Unrealized + 1 out + 1 out out + 1 + 1 + 1 1 DefaultActivated FocusActivated diff --git a/gtk/TextChildAnchor.custom b/gtk/TextChildAnchor.custom new file mode 100644 index 000000000..b4a30a3d0 --- /dev/null +++ b/gtk/TextChildAnchor.custom @@ -0,0 +1,22 @@ +// TextChildAnchor.custom - customizations to Gtk.TextChildAnchor +// +// Authors: Mike Kestner +// +// 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; + } + } + diff --git a/gtk/TreeSelection.custom b/gtk/TreeSelection.custom index 457e797e5..fab9f51f5 100644 --- a/gtk/TreeSelection.custom +++ b/gtk/TreeSelection.custom @@ -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 +// +// 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; + } + diff --git a/gtk/TreeView.custom b/gtk/TreeView.custom index 255a024f3..ecc001907 100644 --- a/gtk/TreeView.custom +++ b/gtk/TreeView.custom @@ -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); - /// Model Property - /// Gets the model being displayed by the TreeView - /// public Gtk.TreeModel Model { get { IntPtr raw_ret = gtk_tree_view_get_model (Handle); diff --git a/gtk/TreeViewColumn.custom b/gtk/TreeViewColumn.custom index 0c6b3be5a..99b7e640f 100644 --- a/gtk/TreeViewColumn.custom +++ b/gtk/TreeViewColumn.custom @@ -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; + } + } + diff --git a/gtk/Window.custom b/gtk/Window.custom index 5012c9286..6482ab7bc 100755 --- a/gtk/Window.custom +++ b/gtk/Window.custom @@ -1,8 +1,9 @@ // Gtk.Window.custom - Gtk Window class customizations // -// Author: Mike Kestner +// Author: Mike Kestner // -// (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 @@ } } - /// - /// Window Constructor - /// - /// - /// - /// Constructs a new Window of type TopLevel with the - /// specified Title. - /// - public Window (String title) : this (WindowType.Toplevel) { this.Title = title; } - /// - /// DefaultSize Property - /// - /// - /// - /// The default Size of the Window in Screen Coordinates. - /// + [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; + } diff --git a/gtk/gtk-api.xml b/gtk/gtk-api.xml index 675ffe323..e66fc1f16 100644 --- a/gtk/gtk-api.xml +++ b/gtk/gtk-api.xml @@ -2408,7 +2408,7 @@ - + - + - +