2004-06-10 Todd Berman <tberman@sevenl.net>

* 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.

svn path=/trunk/gtk-sharp/; revision=29217
This commit is contained in:
Todd Berman 2004-06-10 18:37:05 +00:00
parent 32116e27c7
commit e525e9bd55
8 changed files with 239 additions and 24 deletions

View file

@ -1,3 +1,13 @@
2004-06-10 Todd Berman <tberman@sevenl.net>
* 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 <tberman@sevenl.net>
* gdk/Gdk.metadata: mark Window.SetBackPixmap as null_ok.

View file

@ -534,19 +534,6 @@
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="ChildType">
<MemberSignature Language="C#" Value="public GLib.GType ChildType ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>GLib.GType</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<returns>a <see cref="T:GLib.GType" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="Forall">
<MemberSignature Language="C#" Value="public void Forall (Gtk.Callback cb);" />
<MemberType>Method</MemberType>
@ -671,5 +658,33 @@
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="OverrideChildType">
<MemberSignature Language="C#" Value="protected static void OverrideChildType (GLib.GType gtype);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="gtype" Type="GLib.GType" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="gtype">a <see cref="T:GLib.GType" /></param>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="ChildType">
<MemberSignature Language="C#" Value="public virtual GLib.GType ChildType ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>GLib.GType</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<returns>a <see cref="T:GLib.GType" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -4748,31 +4748,126 @@ handle focus grabs.</returns>
<remarks>None.</remarks>
</Docs>
</Member>
<Member MemberName="NoWindow">
<MemberSignature Language="C#" Value="public bool NoWindow { get; };" />
<Member MemberName="IsNoWindow">
<MemberSignature Language="C#" Value="public bool IsNoWindow { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Checks for the NoWindow <see cref="T:Gtk.WidgetFlags" /></summary>
<returns>returns true if the NoWindow flag is set</returns>
<summary>Convenience property to check Flags for WidgetFlags.NoWindow</summary>
<returns>True if the NoWindow flag is set.</returns>
<remarks>None.</remarks>
</Docs>
</Member>
<Member MemberName="Drawable">
<MemberSignature Language="C#" Value="public bool Drawable { get; };" />
<Member MemberName="IsTopLevel">
<MemberSignature Language="C#" Value="public bool IsTopLevel { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Checks to see if the widget is Drawable</summary>
<returns>returns true if the widget is Drawable</returns>
<summary>Convenience property to check Flags for WidgetFlags.Toplevel</summary>
<returns>True if the Toplevel flag is set.</returns>
<remarks>None</remarks>
</Docs>
</Member>
<Member MemberName="HasGrab">
<MemberSignature Language="C#" Value="public bool HasGrab { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Convenience property to check Flags for WidgetFlags.HasGrab</summary>
<returns>True if the HasGrab flag is set.</returns>
<remarks>None.</remarks>
</Docs>
</Member>
<Member MemberName="IsCompositeChild">
<MemberSignature Language="C#" Value="public bool IsCompositeChild { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Convenience property to check Flags for WidgetFlags.CompositeChild</summary>
<returns>True if the CompositeChild flag is set</returns>
<remarks>None</remarks>
</Docs>
</Member>
<Member MemberName="IsAppPaintable">
<MemberSignature Language="C#" Value="public bool IsAppPaintable { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Convenience property to check Flags for WidgetFlags.AppPaintable</summary>
<returns>True if the AppPaintable flag is set</returns>
<remarks>None</remarks>
</Docs>
</Member>
<Member MemberName="IsDoubleBuffered">
<MemberSignature Language="C#" Value="public bool IsDoubleBuffered { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Convenience property to check Flags for WidetFlags.DoubleBuffered</summary>
<returns>True if the DoubleBuffered flag is set.</returns>
<remarks>None</remarks>
</Docs>
</Member>
<Member MemberName="IsDrawable">
<MemberSignature Language="C#" Value="public bool IsDrawable { get; };" />
<MemberType>Property</MemberType>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Convenience property to check if the widget is Visible and Realized.</summary>
<returns>True if the widget is able to be drawn on</returns>
<remarks>None</remarks>
</Docs>
</Member>
<Member MemberName="SetFlag">
<MemberSignature Language="C#" Value="public void SetFlag (Gtk.WidgetFlags flag);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="flag" Type="Gtk.WidgetFlags" />
</Parameters>
<Docs>
<summary>Convenience method to set a flag.</summary>
<param name="flag">a <see cref="T:Gtk.WidgetFlags" /> to set</param>
<remarks>None.</remarks>
</Docs>
</Member>
<Member MemberName="ClearFlag">
<MemberSignature Language="C#" Value="public void ClearFlag (Gtk.WidgetFlags flag);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="flag" Type="Gtk.WidgetFlags" />
</Parameters>
<Docs>
<summary>Convenince method to clear a flag</summary>
<param name="flag">a <see cref="T:Gtk.WidgetFlags" /> to set</param>
<remarks>None</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -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;
}

View file

@ -101,6 +101,7 @@
<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>
<attr path="/api/namespace/object[@cname='GtkContainer']/signal[@name='SetFocusChild']" name="name">FocusChildSet</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/method[@cname='gtk_container_child_type']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/constructor[@cname='gtk_dialog_new_with_buttons']/*/*[@type='GtkWindow*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='Response']" name="name">Respond</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='SetDefaultResponse']/*/*[@name='response_id']" name="type">GtkResponseType</attr>

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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