[Monodevelop-patches-list] r604 - in trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui: . FolderDialog
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Tue Jan 20 19:13:33 EST 2004
Author: benm
Date: 2004-01-20 19:13:33 -0500 (Tue, 20 Jan 2004)
New Revision: 604
Added:
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/BaseFileEntry.cs
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FileEntry.cs
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderDialog.cs
trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderEntry.cs
Log:
bring these back
Added: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/BaseFileEntry.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/BaseFileEntry.cs 2004-01-20 23:46:56 UTC (rev 603)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/BaseFileEntry.cs 2004-01-21 00:13:33 UTC (rev 604)
@@ -0,0 +1,66 @@
+using System;
+using System.IO;
+using Gtk;
+using Gdk;
+using GtkSharp;
+using GdkSharp;
+
+namespace MonoDevelop.Gui {
+ public abstract class BaseFileEntry : Gtk.HBox {
+
+ string name;
+
+ Entry text;
+ Button browse;
+
+ public event EventHandler PathChanged;
+
+ protected BaseFileEntry (string name) : base (false, 6)
+ {
+ this.name = name;
+ text = new Entry ();
+ browse = Button.NewWithMnemonic ("_Browse...");
+
+ text.Changed += new EventHandler (OnTextChanged);
+ browse.Clicked += new EventHandler (OnButtonClicked);
+
+ PackStart (text, true, true, 0);
+ PackEnd (browse, false, false, 0);
+ }
+
+ protected abstract string ShowBrowseDialog (string name, string start_in);
+
+
+ string default_path;
+ public string DefaultPath {
+ get { return default_path; }
+ set { default_path = value; }
+ }
+
+ public string Path {
+ get { return System.IO.Path.Combine (default_path, text.Text); }
+ }
+
+ void OnButtonClicked (object o, EventArgs args)
+ {
+ string start_in;
+
+ if (Directory.Exists (Path))
+ start_in = Path;
+ else
+ start_in = default_path;
+
+ string path = ShowBrowseDialog (name, start_in + System.IO.Path.DirectorySeparatorChar);
+ if (path != null) {
+ text.Text = path;
+ OnTextChanged (null, null);
+ }
+ }
+
+ void OnTextChanged (object o, EventArgs args)
+ {
+ if (PathChanged != null)
+ PathChanged (this, EventArgs.Empty);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FileEntry.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FileEntry.cs 2004-01-20 23:46:56 UTC (rev 603)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FileEntry.cs 2004-01-21 00:13:33 UTC (rev 604)
@@ -0,0 +1,30 @@
+using System;
+using System.IO;
+using Gtk;
+using Gdk;
+using GtkSharp;
+using GdkSharp;
+
+namespace MonoDevelop.Gui {
+ public class FileEntry : BaseFileEntry{
+
+ public FileEntry (string name) : base (name)
+ {
+ }
+
+ protected override string ShowBrowseDialog (string name, string start_in)
+ {
+ FileSelection fd = new FileSelection (name);
+ if (start_in != null)
+ fd.Filename = start_in;
+
+ int response = fd.Run ();
+ fd.Hide ();
+
+ if (response == (int) ResponseType.Ok)
+ return fd.Filename;
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderDialog.cs 2004-01-20 23:46:56 UTC (rev 603)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderDialog.cs 2004-01-21 00:13:33 UTC (rev 604)
@@ -0,0 +1,24 @@
+using System;
+using Gtk;
+using GtkSharp;
+
+namespace MonoDevelop.Gui
+{
+ public class FolderDialog : FileSelection
+ {
+ static GLib.GType type;
+
+ static FolderDialog ()
+ {
+ type = RegisterGType (typeof (FolderDialog));
+ }
+
+ public FolderDialog (string title) : base (type)
+ {
+ this.Title = title;
+ this.SelectMultiple = false;
+ this.ShowFileops = false;
+ this.FileList.Sensitive = false;
+ }
+ }
+}
Added: trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderEntry.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderEntry.cs 2004-01-20 23:46:56 UTC (rev 603)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Gui/FolderDialog/FolderEntry.cs 2004-01-21 00:13:33 UTC (rev 604)
@@ -0,0 +1,30 @@
+using System;
+using System.IO;
+using Gtk;
+using Gdk;
+using GtkSharp;
+using GdkSharp;
+
+namespace MonoDevelop.Gui {
+ public class FolderEntry : BaseFileEntry {
+
+ public FolderEntry (string name) : base (name)
+ {
+ }
+
+ protected override string ShowBrowseDialog (string name, string start_in)
+ {
+ FolderDialog fd = new FolderDialog (name);
+ if (start_in != null)
+ fd.Filename = start_in;
+
+ int response = fd.Run ();
+ fd.Hide ();
+
+ if (response == (int) ResponseType.Ok)
+ return fd.Filename;
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
More information about the Monodevelop-patches-list
mailing list