[Monodevelop-patches-list] r526 - in trunk/MonoDevelop: samples/HtmlControl src/Main/Base/Gui/BrowserDisplayBinding src/Main/Base/Gui/HtmlControl

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sat Jan 17 16:40:58 EST 2004


Author: jluke
Date: 2004-01-17 16:40:58 -0500 (Sat, 17 Jan 2004)
New Revision: 526

Modified:
   trunk/MonoDevelop/samples/HtmlControl/Test.cs
   trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs
   trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs
Log:
use MozillaControl directly
and hookup some events


Modified: trunk/MonoDevelop/samples/HtmlControl/Test.cs
===================================================================
--- trunk/MonoDevelop/samples/HtmlControl/Test.cs	2004-01-17 21:12:35 UTC (rev 525)
+++ trunk/MonoDevelop/samples/HtmlControl/Test.cs	2004-01-17 21:40:58 UTC (rev 526)
@@ -6,9 +6,10 @@
 class HtmlTest
 {
 	Window win;
-	HtmlControl html;
+	MozillaControl html;
 	Button go;
 	Entry url;
+	Statusbar status;
 	
 	static void Main ()
 	{
@@ -65,21 +66,18 @@
 		go.Clicked += new EventHandler (OnGoClicked);
 		tbar.AppendWidget (go, "Go", "");
 
-		html = new HtmlControl ();
+		html = new MozillaControl ();
+		html.NetStart += new EventHandler (OnNetStart);
+		html.NetStop += new EventHandler (OnNetStop);
+		html.Title += new EventHandler (OnTitleChanged);
 		//html.Control.Title += new EventHandler (OnHtmlTitle);
 		// this loads html from a string
 		html.Html = "<html><body>testing</body></html>";
 		
-		// this loads html from a Url
-		// html.Url = "http://localhost";
-		
-		// set the stylesheet
-		html.CascadingStyleSheet = "";
-		
 		html.ShowAll ();
 		vbox.PackStart (html, true, true, 0);
 
-		Statusbar status = new Statusbar ();
+		status = new Statusbar ();
 		vbox.PackStart (status, false, true, 0);
 		
 		win.Add (vbox);
@@ -92,9 +90,24 @@
 		Application.Quit ();
 	}
 
+	void OnNetStart (object o, EventArgs args)
+	{
+		status.Push (1, "Loading ...");
+	}
+
+	void OnNetStop (object o, EventArgs args)
+	{
+		status.Push (1, "Done.");
+	}
+
+	void OnTitleChanged (object o, EventArgs args)
+	{
+		win.Title = html.GeckoTitle;
+	}
+
 	void OnGoClicked (object o, EventArgs args)
 	{
-		html.Url = url.Text;
+		html.LoadUrl (url.Text);
 	}
 
 	void OnUrlActivated (object o, EventArgs args)

Modified: trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs	2004-01-17 21:12:35 UTC (rev 525)
+++ trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs	2004-01-17 21:40:58 UTC (rev 526)
@@ -77,17 +77,18 @@
 	
 	public class HtmlViewPane : Gtk.Frame
 	{
-		HtmlControl htmlControl = null;
+		MozillaControl htmlControl = null;
 		
 		VBox   topPanel   = new VBox (false, 2);
 		Toolbar toolBar    = new Toolbar ();
 		Entry urlTextBox = new Entry ();
+		Statusbar status;
 		
 		bool   isHandleCreated  = false;
 		string lastUrl     = null;
 		static GLib.GType type;
 		
-		public HtmlControl HtmlControl {
+		public MozillaControl MozillaControl {
 			get {
 				return htmlControl;
 			}
@@ -147,10 +148,16 @@
 				mainbox.PackStart (topPanel, false, false, 2);
 			} 
 			
-			htmlControl = new HtmlControl ();
+			htmlControl = new MozillaControl ();
+			htmlControl.NetStart += new EventHandler (OnNetStart);
+			htmlControl.NetStop += new EventHandler (OnNetStop);
+			htmlControl.Title += new EventHandler (OnTitleChanged);
 			htmlControl.ShowAll ();
 
 			mainbox.PackStart (htmlControl);
+
+			status = new Statusbar ();
+			mainbox.PackStart (status, false, true, 0);
 			
 			this.Add (mainbox);
 			this.ShowAll ();
@@ -163,7 +170,7 @@
 		
 		void OnEntryActivated (object o, EventArgs args)
 		{
-			htmlControl.Url = urlTextBox.Text;
+			htmlControl.LoadUrl (urlTextBox.Text);
 		}
 		
 		public void CreatedWebBrowserHandle(object sender, EventArgs evArgs) 
@@ -177,8 +184,23 @@
 		public void Navigate(string name)
 		{
 			urlTextBox.Text = name;
-			htmlControl.Url = name;
+			htmlControl.LoadUrl (name);
 		}
+
+		private void OnNetStart (object o, EventArgs args)
+		{
+			status.Push (1, "Loading...");
+		}
+
+		private void OnNetStop (object o, EventArgs args)
+		{
+			status.Push (1, "Done.");
+		}
+
+		private void OnTitleChanged (object o, EventArgs args)
+		{
+			Console.WriteLine ("title: " + htmlControl.GeckoTitle); 
+		}
 		
 		private void OnBackClicked (object o, EventArgs args)
 		{

Modified: trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs	2004-01-17 21:12:35 UTC (rev 525)
+++ trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs	2004-01-17 21:40:58 UTC (rev 526)
@@ -15,6 +15,7 @@
 	public class MozillaControl : EmbedWidget, IWebBrowser
 	{
 		private static GLib.GType type;
+		private string html;
 		
 		static MozillaControl ()
 		{
@@ -73,5 +74,19 @@
 		{
 			return null;
 		}
+
+		public string Html
+		{
+			get { return html; }
+			set { html = value; }
+		}
+
+		public void DelayedInitialize ()
+		{
+			if (html.Length > 0)
+			{
+				this.RenderData (html, "file://", "text/html");
+			}
+		}
 	}
 }




More information about the Monodevelop-patches-list mailing list