diff --git a/ChangeLog b/ChangeLog index 96cf88d65..7a6f1d89f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-06-10 Todd Berman + + * gtk/Container.custom: add C# glue for virtualizing ChildType () + * gtk/glue/container.c: add C glue for virtualizing ChildType () + * gtk/Gtk.metadata: hide Container.ChildType () + * gtk/Widget.custom: Add ClearFlag, and SetFlag convenience methods. + Also add various IsFlag bool properties for checking for flags. + * gtk/glue/widget.c: Fix setting flags. + * doc/*: updated Widget docs. + 2004-06-09 Todd Berman * gdk/Gdk.metadata: mark Window.SetBackPixmap as null_ok. diff --git a/doc/en/Gtk/Container.xml b/doc/en/Gtk/Container.xml index 4e8574fdb..28370b0d7 100644 --- a/doc/en/Gtk/Container.xml +++ b/doc/en/Gtk/Container.xml @@ -534,19 +534,6 @@ To be added - - - Method - - GLib.GType - - - - To be added - a - To be added - - Method @@ -671,5 +658,33 @@ To be added + + + Method + + System.Void + + + + + + To be added + a + To be added + + + + + Method + + GLib.GType + + + + To be added + a + To be added + + \ No newline at end of file diff --git a/doc/en/Gtk/Widget.xml b/doc/en/Gtk/Widget.xml index b16ce2596..fe2996a62 100644 --- a/doc/en/Gtk/Widget.xml +++ b/doc/en/Gtk/Widget.xml @@ -4748,31 +4748,126 @@ handle focus grabs. None. - - + + Property System.Boolean - Checks for the NoWindow - returns true if the NoWindow flag is set + Convenience property to check Flags for WidgetFlags.NoWindow + True if the NoWindow flag is set. None. - - + + Property System.Boolean - Checks to see if the widget is Drawable - returns true if the widget is Drawable + Convenience property to check Flags for WidgetFlags.Toplevel + True if the Toplevel flag is set. + None + + + + + Property + + System.Boolean + + + + Convenience property to check Flags for WidgetFlags.HasGrab + True if the HasGrab flag is set. None. + + + Property + + System.Boolean + + + + Convenience property to check Flags for WidgetFlags.CompositeChild + True if the CompositeChild flag is set + None + + + + + Property + + System.Boolean + + + + Convenience property to check Flags for WidgetFlags.AppPaintable + True if the AppPaintable flag is set + None + + + + + Property + + System.Boolean + + + + Convenience property to check Flags for WidetFlags.DoubleBuffered + True if the DoubleBuffered flag is set. + None + + + + + Property + + System.Boolean + + + + Convenience property to check if the widget is Visible and Realized. + True if the widget is able to be drawn on + None + + + + + Method + + System.Void + + + + + + Convenience method to set a flag. + a to set + None. + + + + + Method + + System.Void + + + + + + Convenince method to clear a flag + a to set + None + + \ No newline at end of file diff --git a/gtk/Container.custom b/gtk/Container.custom index 572bc8e4a..3ed64b7d4 100644 --- a/gtk/Container.custom +++ b/gtk/Container.custom @@ -110,3 +110,33 @@ protected virtual void ForAll (bool include_internals, CallbackInvoker invoker) gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data); } +[DllImport("gtksharpglue")] +static extern IntPtr gtksharp_container_base_child_type(IntPtr raw); + +[DllImport("gtksharpglue")] +static extern void gtksharp_container_override_child_type (GLib.GType type, ChildTypeDelegate cb); + +delegate IntPtr ChildTypeDelegate (IntPtr raw); + +static ChildTypeDelegate ChildTypeCallback; + +static IntPtr ChildType_cb (IntPtr raw) +{ + Container obj = GLib.Object.GetObject (raw, false) as Container; + GLib.GType gtype = obj.ChildType (); + return gtype.Val; +} + +protected static void OverrideChildType (GLib.GType gtype) +{ + if (ChildTypeCallback == null) + ChildTypeCallback = new ChildTypeDelegate (ChildType_cb); + gtksharp_container_override_child_type (gtype, ChildTypeCallback); +} + +[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideChildType")] +public virtual GLib.GType ChildType() { + IntPtr raw_ret = gtksharp_container_base_child_type(Handle); + GLib.GType ret = new GLib.GType(raw_ret); + return ret; +} diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index 5ab623e4d..b2974f987 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -101,6 +101,7 @@ ResizeChecked Removed FocusChildSet + 1 1 Respond GtkResponseType diff --git a/gtk/Widget.custom b/gtk/Widget.custom index 81dbfb2ba..3ff839613 100644 --- a/gtk/Widget.custom +++ b/gtk/Widget.custom @@ -76,6 +76,16 @@ public int Flags { } } +public void SetFlag (WidgetFlags flag) +{ + Flags |= (int)flag; +} + +public void ClearFlag (WidgetFlags flag) +{ + Flags &= ~((int)flag); +} + public bool IsMapped { get { return ((Flags & (int)Gtk.WidgetFlags.Mapped) != 0); @@ -88,13 +98,44 @@ public bool IsRealized { } } -public bool NoWindow { +public bool IsNoWindow { get { return ((Flags & (int)Gtk.WidgetFlags.NoWindow) != 0); } } -public bool Drawable { +public bool IsTopLevel { + get { + return ((Flags & (int)Gtk.WidgetFlags.Toplevel) != 0); + } +} + +public bool HasGrab { + get { + return ((Flags & (int)Gtk.WidgetFlags.HasGrab) != 0); + } +} + +public bool IsCompositeChild { + get { + return ((Flags & (int)Gtk.WidgetFlags.CompositeChild) != 0); + } +} + +public bool IsAppPaintable { + get { + return ((Flags & (int)Gtk.WidgetFlags.AppPaintable) != 0); + } +} + +public bool IsDoubleBuffered { + get { + return ((Flags & (int)Gtk.WidgetFlags.DoubleBuffered) != 0); + } +} + + +public bool IsDrawable { get { return (Visible && IsMapped); } diff --git a/gtk/glue/container.c b/gtk/glue/container.c index 5283e5da2..c4e8b63e4 100644 --- a/gtk/glue/container.c +++ b/gtk/glue/container.c @@ -35,3 +35,26 @@ gtksharp_container_invoke_gtk_callback (GtkCallback cb, GtkWidget *widget, gpoin { cb (widget, data); } + +GType gtksharp_container_base_child_type (GtkContainer *container); + +GType +gtksharp_container_base_child_type (GtkContainer *container) +{ + GtkContainerClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (container)); + GType slot; + if (parent->child_type) + slot = (*parent->child_type) (container); + else + slot = G_TYPE_NONE; + return slot; +} + +void +gtksharp_container_override_child_type (GType gtype, gpointer cb) +{ + GtkContainerClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + ((GtkContainerClass *) klass)->child_type = cb; +} diff --git a/gtk/glue/widget.c b/gtk/glue/widget.c index 7ec70b3a6..a67208a55 100644 --- a/gtk/glue/widget.c +++ b/gtk/glue/widget.c @@ -57,7 +57,7 @@ gtksharp_gtk_widget_get_flags (GtkWidget *widget) void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags) { - GTK_WIDGET_SET_FLAGS (widget, flags); + GTK_OBJECT(widget)->flags = flags; } int