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" />)
@ -532,4 +534,4 @@ namespace GtkDialogSample
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -10,7 +10,7 @@
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>A dialog box for choosing files.</summary>
<remarks>Similar to <see cref="T:Gtk.FileChooserWidget"/> but in a dialog.</remarks>
<remarks>Similar to <see cref="T:Gtk.FileChooserWidget" /> but in a dialog.</remarks>
</Docs>
<Base>
<BaseTypeName>Gtk.Dialog</BaseTypeName>
@ -74,7 +74,7 @@
<Parameters />
<Docs>
<summary>Unselects all the files in the current folder of a file chooser.</summary>
<remarks/>
<remarks />
</Docs>
</Member>
<Member MemberName="SetFilename">
@ -88,11 +88,11 @@
</Parameters>
<Docs>
<summary>
Sets <paramref name="filename"/> as the current filename for
Sets <paramref name="filename" /> as the current filename for
the file chooser;
If the file name isn't in the current folder of the file chooser, then the
current folder of the file chooser will be changed to the folder containing
<paramref name="filename"/>.
<paramref name="filename" />.
</summary>
<param name="filename">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:System.Boolean" />, true if both the
@ -100,12 +100,12 @@
selected successfully, false otherwise. </returns>
<remarks>
This is equivalent to a sequence of
<see cref="M:Gtk.FileChooser.UnselectAll"/>
followed by <see cref="M:Gtk.FileChooser.SelectFilename"/>.
<see cref="M:Gtk.FileChooser.UnselectAll" />
followed by <see cref="M:Gtk.FileChooser.SelectFilename" />.
Note that the file must exist, or nothing will be done except
for the directory change. To pre-enter a filename for the user, as in
a save-as dialog, use <see cref="M:Gtk.FileChooser.SetCurrentFilename"/>.
a save-as dialog, use <see cref="M:Gtk.FileChooser.SetCurrentFilename" />.
</remarks>
</Docs>
</Member>
@ -125,7 +125,7 @@
<param name="uri">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:System.Boolean" /></returns>
<remarks>
See also <see cref="M:Gtk.FileChooser.AddShortcutFolderUri"/>.
See also <see cref="M:Gtk.FileChooser.AddShortcutFolderUri" />.
</remarks>
</Docs>
</Member>
@ -177,9 +177,9 @@
</Parameters>
<Docs>
<summary>
Selects the file at <paramref name="uri"/>. If the URI doesn't refer to a
Selects the file at <paramref name="uri" />. If the URI doesn't refer to a
file in the current folder of the file chooser, then the current folder of
the file chooser will be changed to the folder that's part of <paramref name="uri"/> .
the file chooser will be changed to the folder that's part of <paramref name="uri" /> .
</summary>
<param name="uri">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:System.Boolean" />, true if both the
@ -199,10 +199,10 @@
<Parameter Name="filter" Type="Gtk.FileFilter" />
</Parameters>
<Docs>
<summary>Removes <paramref name="filter"/> from the list of filters that the user can select between.</summary>
<summary>Removes <paramref name="filter" /> from the list of filters that the user can select between.</summary>
<param name="filter">a <see cref="T:Gtk.FileFilter" /></param>
<remarks>
</remarks>
</remarks>
</Docs>
</Member>
<Member MemberName="AddShortcutFolder">
@ -241,7 +241,7 @@
<remarks>
If the file name isn't in the current
folder of the file chooser, then the current folder of the file chooser will
be changed to the folder containing <paramref name="filename"/>.
be changed to the folder containing <paramref name="filename" />.
</remarks>
</Docs>
</Member>
@ -276,7 +276,7 @@
</Parameters>
<Docs>
<summary>
Adds <paramref name="filter"/> to the list of filters that the
Adds <paramref name="filter" /> to the list of filters that the
user can select between.
</summary>
<param name="filter">a <see cref="T:Gtk.FileFilter" /></param>
@ -299,7 +299,7 @@
<summary>Removes a folder from a file chooser's list of shortcut folders.</summary>
<param name="folder">a <see cref="T:System.String" /></param>
<returns>a <see cref="T:System.Boolean" /></returns>
<remarks>See also <see cref="M:Gtk.FileChooser.AddShortcutFolder"/>.</remarks>
<remarks>See also <see cref="M:Gtk.FileChooser.AddShortcutFolder" />.</remarks>
</Docs>
</Member>
<Member MemberName="UnselectUri">
@ -313,7 +313,7 @@
</Parameters>
<Docs>
<summary>
Unselects the file referred to by <paramref name="uri"/>.
Unselects the file referred to by <paramref name="uri" />.
</summary>
<param name="uri">a <see cref="T:System.String" /></param>
<remarks>
@ -354,7 +354,7 @@
</Parameters>
<Docs>
<summary>
Sets the file referred to by <paramref name="uri"/> as the
Sets the file referred to by <paramref name="uri" /> as the
current file for the the file chooser.
</summary>
<param name="uri">a <see cref="T:System.String" /></param>
@ -364,13 +364,13 @@
<remarks>
If the file name isn't in the current folder of the file chooser,
then the current folder of the file chooser will be changed to the folder containing
<paramref name="uri"/>. This is equivalent to a sequence of
<see cref="M:Gtk.FileChooser.UnselectAll"/>
followed by <see cref="M:Gtk.FileChooserDialog.SelectUri"/>.
<paramref name="uri" />. This is equivalent to a sequence of
<see cref="M:Gtk.FileChooser.UnselectAll" />
followed by <see cref="M:Gtk.FileChooserDialog.SelectUri" />.
Note that the file must exist, or nothing will be done except
for the directory change. To pre-enter a filename for the user, as in
a save-as dialog, use <see cref="M:Gtk.FileChooserDialog.SetCurrentFilename"/>.
a save-as dialog, use <see cref="M:Gtk.FileChooserDialog.SetCurrentFilename" />.
</remarks>
</Docs>
</Member>
@ -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>
@ -591,10 +546,10 @@
accessible through the operating systems native file
file system and therefore the application only
needs to worry about the filename functions in
<see cref="T:Gtk.FileChooser"/>, like
<see cref="M:Gtk.FileChooser.GetFilename"/>,
<see cref="T:Gtk.FileChooser" />, like
<see cref="M:Gtk.FileChooser.GetFilename" />,
rather than the URI functions like
<see cref="M:Gtk.FileChooser.GetUri"/>.
<see cref="M:Gtk.FileChooser.GetUri" />.
</remarks>
</Docs>
</Member>
@ -607,7 +562,7 @@
<Parameters />
<Docs>
<summary>
Sets whether the preview widget set by <see cref="M:Gtk.FileChooser.SetPreviewWidget"/>
Sets whether the preview widget set by <see cref="M:Gtk.FileChooser.SetPreviewWidget" />
should be shown for the current filename.
</summary>
<returns>a <see cref="T:System.Boolean" /></returns>
@ -710,8 +665,8 @@
<returns>a <see cref="T:System.Boolean" /></returns>
<remarks>
This is only relevant if the action is set to be
<see cref="M:Gtk.FileChooserAction.Open"/> or
<see cref="M:Gtk.FileChooserAction.Save"/>.
<see cref="M:Gtk.FileChooserAction.Open" /> or
<see cref="M:Gtk.FileChooserAction.Save" />.
It cannot be set with either of the folder actions.
</remarks>
</Docs>
@ -730,26 +685,26 @@
</summary>
<returns>a <see cref="T:Gtk.Widget" /></returns>
<remarks>
<para>
<para>
To implement a preview, after setting the
preview widget, you connect to the
<see cref="E:Gtk.FileChooser.SelectionChanged"/>
<see cref="E:Gtk.FileChooser.SelectionChanged" />
signal, and check
<see cref="P:Gtk.FileChooser.PreviewFilename"/> or
<see cref="P:Gtk.FileChooser.PreviewUri"/>
<see cref="P:Gtk.FileChooser.PreviewFilename" /> or
<see cref="P:Gtk.FileChooser.PreviewUri" />
on each change. If you can
display a preview of the new file, update your widget and
set the preview active using
<see cref="P:Gtk.FileChooser.PreviewWidgetActive"/>
<see cref="P:Gtk.FileChooser.PreviewWidgetActive" />
Otherwise, set the preview inactive.
</para>
<para>
<para>
When there is no application-supplied preview widget, or the
application-supplied preview widget is not active, the file chooser
may display an internally generated preview of the current file or
it may display no preview at all.
</para>
</remarks>
</remarks>
</Docs>
</Member>
<Member MemberName="Action">
@ -768,8 +723,8 @@
<remarks>
For example,
an option to create a new folder might be shown if the action is
<see cref="M:Gtk.FileChooserAction.Save"/> but not if the action is
<see cref="M:Gtk.FileChooserAction.Open"/>.
<see cref="M:Gtk.FileChooserAction.Save" /> but not if the action is
<see cref="M:Gtk.FileChooserAction.Open" />.
</remarks>
</Docs>
</Member>
@ -867,7 +822,7 @@
<Docs>
<summary>This event is fired every time the selected file changes.</summary>
<remarks>
</remarks>
</remarks>
</Docs>
</Member>
<Member MemberName="FileActivated">
@ -905,23 +860,22 @@
selected file changes.
</summary>
<remarks>
<para>You should use this signal if you want your file chooser to have
<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
<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
<see cref="P:Gtk.FileChooser.PreviewFilename"/> or
<see cref="P:Gtk.FileChooser.PreviewUri"/>
<see cref="P:Gtk.FileChooser.PreviewFilename" /> or
<see cref="P:Gtk.FileChooser.PreviewUri" />
to get the name of the file to preview.
Your widget may not be able to preview all kinds of files; your callback
must set <see cref="P:Gtk.FileChooser.PreviewWidgetActive"/> to inform the file
must set <see cref="P:Gtk.FileChooser.PreviewWidgetActive" /> to inform the file
chooser about whether the preview was generated successfully or not.
</para>
<para>
<para>
TODO: insert example from gtkfilechooser-preview in gtk+ docs.
</para>
</remarks>
</remarks>
</Docs>
</Member>
<Member MemberName="CurrentFolderChanged">
@ -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);
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;
}
Raw = gtk_file_chooser_dialog_new (title, parent == null ? IntPtr.Zero : parent.Handle, (int)action, IntPtr.Zero);
} 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;
}
Raw = gtk_file_chooser_dialog_new_with_backend (title, parent == null ? IntPtr.Zero : parent.Handle, (int)action, backend, IntPtr.Zero);
} 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,49 +96,41 @@ 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 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;
dialog.VBox.PackStart (hbox, false, false, 0);
Table table = new Table (2, 2, false);
table.RowSpacing = 4;
table.ColumnSpacing = 4;
hbox.PackStart (table, false, false, 0);
Label label = new Label ("_Entry1");
table.Attach (label, 0, 1, 0, 1);
Entry localEntry1 = new Entry();
localEntry1.Text = entry1.Text;
table.Attach (localEntry1, 1, 2, 0, 1);
label.MnemonicWidget = localEntry1;
label = new Label ("E_ntry2");
table.Attach (label, 0, 1, 1, 2);
Entry localEntry2 = new Entry();
localEntry2.Text = entry2.Text;
table.Attach (localEntry2, 1, 2, 1, 2);
label.MnemonicWidget = localEntry2;
dialog.AddButton ("_Non-stock Button", (int) ResponseType.Cancel);
HBox hbox = new HBox (false, 8);
hbox.BorderWidth = 8;
dialog.VBox.PackStart (hbox, false, false, 0);
Table table = new Table (2, 2, false);
table.RowSpacing = 4;
table.ColumnSpacing = 4;
hbox.PackStart (table, false, false, 0);
Label label = new Label ("_Entry1");
table.Attach (label, 0, 1, 0, 1);
Entry localEntry1 = new Entry();
localEntry1.Text = entry1.Text;
table.Attach (localEntry1, 1, 2, 0, 1);
label.MnemonicWidget = localEntry1;
label = new Label ("E_ntry2");
table.Attach (label, 0, 1, 1, 2);
Entry localEntry2 = new Entry();
localEntry2.Text = entry2.Text;
table.Attach (localEntry2, 1, 2, 1, 2);
label.MnemonicWidget = localEntry2;
hbox.ShowAll ();
hbox.ShowAll ();
ResponseType response = (ResponseType) dialog.Run ();
ResponseType response = (ResponseType) dialog.Run ();
if (response == ResponseType.Ok)
{
entry1.Text = localEntry1.Text;
entry2.Text = localEntry2.Text;
}
if (response == ResponseType.Ok) {
entry1.Text = localEntry1.Text;
entry2.Text = localEntry2.Text;
}
dialog.Hide ();
}
dialog.Destroy ();
}
}
}