// 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 new Widget [0]; GLib.List list = new GLib.List (list_ptr); 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 new Widget [0]; GLib.List list = new GLib.List (list_ptr); 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); foreach (Widget val in value) list.Append (val.Handle); gtk_container_set_focus_chain (Handle, list.Handle); } } [DllImport("gtksharpglue")] static extern void gtksharp_container_base_forall (IntPtr handle, bool include_internals, Gtk.Callback cb, IntPtr data); [DllImport("gtksharpglue")] static extern void gtksharp_container_override_forall (GLib.GType gtype, ForallDelegate cb); delegate void ForallDelegate (IntPtr container, bool include_internals, Gtk.Callback cb, IntPtr data); static ForallDelegate ForallCallback; static void Forall_cb (IntPtr container, bool include_internals, Gtk.Callback cb, IntPtr data) { Container obj = GLib.Object.GetObject (container, false) as Container; obj.OnForall (include_internals, cb, data); } protected static void OverrideForall (GLib.GType gtype) { if (ForallCallback == null) ForallCallback = new ForallDelegate (Forall_cb); gtksharp_container_override_forall (gtype, ForallCallback); } protected virtual void OnForall (bool include_internals, Gtk.Callback cb, IntPtr data) { gtksharp_container_base_forall (Handle, include_internals, cb, data); }