2005-01-28 Mike Kestner <mkestner@novell.com>

* gtk/Dialog.custom : add a params array for button info to the ctor.
	* gtk/FileChooserDialog.custom : add a params array for button info to 
	both ctors.  Chain them to IntPtr.Zero.
	* gtk/Gtk.metadata : hide the ellipsis ctors for the dialog types.
	[Fixes #71818]
	* sample/GtkDemo/DemoDialog.cs : make the InteractiveDialog use the
	new Dialog ctor as it does in the c version.

svn path=/trunk/gtk-sharp/; revision=39713
This commit is contained in:
Mike Kestner 2005-01-28 16:03:27 +00:00
parent ccd3cebf9d
commit 289b127b10
7 changed files with 169 additions and 156 deletions

View file

@ -1,3 +1,13 @@
2005-01-28 Mike Kestner <mkestner@novell.com>
* gtk/Dialog.custom : add a params array for button info to the ctor.
* gtk/FileChooserDialog.custom : add a params array for button info to
both ctors. Chain them to IntPtr.Zero.
* gtk/Gtk.metadata : hide the ellipsis ctors for the dialog types.
[Fixes #71818]
* sample/GtkDemo/DemoDialog.cs : make the InteractiveDialog use the
new Dialog ctor as it does in the c version.
2005-01-27 Mike Kestner <mkestner@novell.com>
* gtk/NodeSelection.cs : use new GetSelectedRows() overload.

View file

@ -304,20 +304,22 @@ namespace GtkDialogSample
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags);" />
<MemberSignature Language="C#" Value="public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, object [] button_data);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="title" Type="System.String" />
<Parameter Name="parent" Type="Gtk.Window" />
<Parameter Name="flags" Type="Gtk.DialogFlags" />
<Parameter Name="button_data" Type="System.Object[]" />
</Parameters>
<Docs>
<summary>Creates a new dialog box.</summary>
<param name="title">an object of type <see cref="T:System.String" />.</param>
<param name="parent">an object of type <see cref="T:Gtk.Window" />.</param>
<param name="flags">an object of type <see cref="T:Gtk.DialogFlags" />.</param>
<returns>an object of type <see cref="T:Gtk.Dialog" />.</returns>
<param name="title">a title <see cref="T:System.String" /></param>
<param name="parent">a parent <see cref="T:Gtk.Window" />, or <see langword="null"/> for an unparented dialog.</param>
<param name="flags">dialog characteristic such as modality and destruction policy.</param>
<param name="button_data">a list of button text/response pairs if desired.</param>
<returns>a <see cref="T:Gtk.Dialog" /></returns>
<remarks>
Creates a new <see cref="T:Gtk.Dialog" /> with the specified title and parent widget.
The <see cref="T:Gtk.DialogFlags" /> argument can be used to make the dialog modal (<see cref="F:Gtk.DialogFlags.Modal" />)

View file

@ -452,51 +452,6 @@
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public FileChooserDialog (string title, Gtk.Window parent, Gtk.FileChooserAction action);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="title" Type="System.String" />
<Parameter Name="parent" Type="Gtk.Window" />
<Parameter Name="action" Type="Gtk.FileChooserAction" />
</Parameters>
<Docs>
<summary>Public constructor.</summary>
<param name="title">a <see cref="T:System.String" />, title for the dialog</param>
<param name="parent">a <see cref="T:Gtk.Window" />, parent window</param>
<param name="action">a <see cref="T:Gtk.FileChooserAction" />, the action this dialog should be doing</param>
<returns>a <see cref="T:Gtk.FileChooserDialog" /></returns>
<remarks>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public FileChooserDialog (string title, Gtk.Window parent, Gtk.FileChooserAction action, string backend);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="title" Type="System.String" />
<Parameter Name="parent" Type="Gtk.Window" />
<Parameter Name="action" Type="Gtk.FileChooserAction" />
<Parameter Name="backend" Type="System.String" />
</Parameters>
<Docs>
<summary>Makes a new file chooser dialog with a specific
file chooser backend</summary>
<param name="title">a <see cref="T:System.String" /></param>
<param name="parent">a <see cref="T:Gtk.Window" /></param>
<param name="action">a <see cref="T:System.Int32" /></param>
<param name="backend">a <see cref="T:System.String" />, the backend name</param>
<returns>a <see cref="T:Gtk.FileChooserDialog" /></returns>
<remarks>
This is especially useful if you use
<see cref="P:Gtk.FileChooser.LocalOnly" /> to allow
non-local files and you use a more expressive vfs, such as gnome-vfs,
to load files.
</remarks>
</Docs>
</Member>
<Member MemberName="GType">
<MemberSignature Language="C#" Value="public static GLib.GType GType { get; };" />
<MemberType>Property</MemberType>
@ -907,7 +862,6 @@
<remarks>
<para>You should use this signal if you want your file chooser to have
a preview widget.</para>
<para>Once you have installed a preview widget with
<see cref="P:Gtk.FileChooser.PreviewWidget" />, you should update it when this
signal is emitted. You can use the properties
@ -947,5 +901,60 @@
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected FileChooserDialog ();" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<returns>a <see cref="T:Gtk.FileChooserDialog" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public FileChooserDialog (string title, Gtk.Window parent, Gtk.FileChooserAction action, object [] button_data);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="title" Type="System.String" />
<Parameter Name="parent" Type="Gtk.Window" />
<Parameter Name="action" Type="Gtk.FileChooserAction" />
<Parameter Name="button_data" Type="System.Object[]" />
</Parameters>
<Docs>
<summary>Creates a file chooser dialog.</summary>
<param name="title">a title <see cref="T:System.String" /></param>
<param name="parent">a parent <see cref="T:Gtk.Window" /> for the dialog, or <see langword="null"/>.</param>
<param name="action">an action, for example save or open.</param>
<param name="button_data">a list of button text/response pairs for buttons to be added to the dialog, if desired.</param>
<returns>a <see cref="T:Gtk.FileChooserDialog" /></returns>
<remarks />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public FileChooserDialog (string title, Gtk.Window parent, Gtk.FileChooserAction action, string backend, object [] button_data);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="title" Type="System.String" />
<Parameter Name="parent" Type="Gtk.Window" />
<Parameter Name="action" Type="Gtk.FileChooserAction" />
<Parameter Name="backend" Type="System.String" />
<Parameter Name="button_data" Type="System.Object[]" />
</Parameters>
<Docs>
<summary>Creates a file chooser dialog with a specific file chooser backend</summary>
<param name="title">a title <see cref="T:System.String" /></param>
<param name="parent">a parent <see cref="T:Gtk.Window" /> for the dialog, or <see langword="null"/>.</param>
<param name="action">an action, for example save or open.</param>
<param name="backend">a <see cref="T:System.String" />, the backend name</param>
<param name="button_data">a list of button text/response pairs for buttons to be added to the dialog, if desired.</param>
<remarks>
This is especially useful if you use <see cref="P:Gtk.FileChooser.LocalOnly" /> to allow
non-local files and you use a more expressive vfs, such as gnome-vfs, to load files.
</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -24,10 +24,9 @@
// Boston, MA 02111-1307, USA.
// Manually wrap until we figure out how to gen ellipses.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_dialog_new_with_buttons (string title, IntPtr i, int flags, IntPtr dummy);
public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags) : base(IntPtr.Zero)
public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params object[] button_data) : base(IntPtr.Zero)
{
if (GetType() != typeof (Dialog)) {
GLib.Value[] vals = new GLib.Value [1];
@ -42,10 +41,11 @@ public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags) : base(In
DestroyWithParent = true;
if ((flags & DialogFlags.NoSeparator) > 0)
HasSeparator = false;
return;
}
} else
Raw = gtk_dialog_new_with_buttons (title, parent.Handle, (int) flags, IntPtr.Zero);
for (int i = 0; i < button_data.Length - 1; i += 2)
AddButton ((string) button_data [i], (int) button_data [i + 1]);
}
[DllImport("gtksharpglue-2")]

View file

@ -23,7 +23,7 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_file_chooser_dialog_new(string title, IntPtr parent, int action, IntPtr nil);
public FileChooserDialog (string title, Window parent, FileChooserAction action)
public FileChooserDialog (string title, Window parent, FileChooserAction action, params object[] button_data) : base (IntPtr.Zero)
{
if (GetType () != typeof (FileChooserDialog)) {
CreateNativeObject (new string[0], new GLib.Value[0]);
@ -31,15 +31,17 @@
if (parent != null)
TransientFor = parent;
Action = action;
return;
}
} else
Raw = gtk_file_chooser_dialog_new (title, parent == null ? IntPtr.Zero : parent.Handle, (int)action, IntPtr.Zero);
for (int i = 0; i < button_data.Length - 1; i += 2)
AddButton ((string) button_data [i], (int) button_data [i + 1]);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_file_chooser_dialog_new_with_backend(string title, IntPtr parent, int action, string backend, IntPtr nil);
public FileChooserDialog (string title, Window parent, FileChooserAction action, string backend)
public FileChooserDialog (string title, Window parent, FileChooserAction action, string backend, params object[] button_data) : base (IntPtr.Zero)
{
if (GetType () != typeof (FileChooserDialog)) {
CreateNativeObject (new string[] { "file-system-backend" }, new GLib.Value[] { new GLib.Value (backend) } );
@ -47,9 +49,11 @@
if (parent != null)
TransientFor = parent;
Action = action;
return;
}
} else
Raw = gtk_file_chooser_dialog_new_with_backend (title, parent == null ? IntPtr.Zero : parent.Handle, (int)action, backend, IntPtr.Zero);
for (int i = 0; i < button_data.Length - 1; i += 2)
AddButton ((string) button_data [i], (int) button_data [i + 1]);
}
[DllImport ("libgtk-win32-2.0-0.dll")]

View file

@ -158,7 +158,7 @@
<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']/constructor[@cname='gtk_dialog_new_with_buttons']" name="hidden">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>
<attr path="/api/namespace/object[@cname='GtkDialog']/method[@name='SetResponseSensitive']/*/*[@name='response_id']" name="type">GtkResponseType</attr>
@ -170,6 +170,8 @@
<attr path="/api/namespace/object[@cname='GtkEntry']/signal[@name='CutClipboard']" name="name">ClipboardCut</attr>
<attr path="/api/namespace/object[@cname='GtkEntry']/signal[@name='PasteClipboard']" name="name">ClipboardPasted</attr>
<attr path="/api/namespace/object[@cname='GtkExpander']/constructor[@cname='gtk_expander_new_with_mnemonic']" name="preferred">1</attr>
<attr path="/api/namespace/object[@cname='GtkFileChooserDialog']/constructor[@cname='gtk_file_chooser_dialog_new']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkFileChooserDialog']/constructor[@cname='gtk_file_chooser_dialog_new_with_backend']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkFileSelection']/method[@name='GetSelections']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkFilePath']" name="parent">GObject</attr>
<attr path="/api/namespace/object[@cname='GtkExpander']/signal[@name='Activate']" name="name">Activated</attr>

View file

@ -10,12 +10,6 @@
* Dialog widgets are used to pop up a transient window for user feedback.
*/
// TODO: - Couldn't find a good equivalent to gtk_dialog_new_with_buttons
// in InteractiveDialogClicked
// - Check how to handle response type. Can we make the button to have
// the binding to the cancel signal automagicly like in
// gtk_dialog_new_with_buttons or should we just use the if ?
using System;
using Gtk;
@ -102,13 +96,7 @@ namespace GtkDemo
private void InteractiveDialogClicked (object o, EventArgs args)
{
using (MessageDialog dialog = new MessageDialog (this,
DialogFlags.Modal | DialogFlags.DestroyWithParent,
MessageType.Question,
ButtonsType.Ok,
null)) {
dialog.AddButton ("_Non-stock Button", (int) ResponseType.Cancel);
Dialog dialog = new Dialog ("Interactive Dialog", this, DialogFlags.Modal | DialogFlags.DestroyWithParent, Gtk.Stock.Ok, ResponseType.Ok, "_Non-stock Button", ResponseType.Cancel);
HBox hbox = new HBox (false, 8);
hbox.BorderWidth = 8;
@ -137,14 +125,12 @@ namespace GtkDemo
ResponseType response = (ResponseType) dialog.Run ();
if (response == ResponseType.Ok)
{
if (response == ResponseType.Ok) {
entry1.Text = localEntry1.Text;
entry2.Text = localEntry2.Text;
}
dialog.Hide ();
}
dialog.Destroy ();
}
}
}