Author: andreia
Date: 2007-11-08 11:31:00 -0500 (Thu, 08 Nov 2007)
New Revision: 89208
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlElement.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowser.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs
Log:
* HtmlElement.cs: Implement InnerText setter.
* WebBrowserBase.cs: Implement Navigated event support.
Add flag to track when the browser "document" is ready to be retrieved.
* WebBrowser.cs: Implement CanGoBack, CanGoForward, Title, Url.
Make sure browser document is ready before retrieving it.
Clean up cached objects (document) when moving to a new page through
any of the navigation methods.
Use the new Mono.WebBrowser.INavigation interface to control navigation.
Implement OnNavigated event.
2007-11-08 Andreia Gaita <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-11-08 16:29:34 UTC (rev 89207)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-11-08 16:31:00 UTC (rev 89208)
@@ -1,3 +1,15 @@
+2007-11-08 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * HtmlElement.cs: Implement InnerText setter.
+ * WebBrowserBase.cs: Implement Navigated event support.
+ Add flag to track when the browser "document" is ready to be retrieved.
+ * WebBrowser.cs: Implement CanGoBack, CanGoForward, Title, Url.
+ Make sure browser document is ready before retrieving it.
+ Clean up cached objects (document) when moving to a new page through
+ any of the navigation methods.
+ Use the new Mono.WebBrowser.INavigation interface to control navigation.
+ Implement OnNavigated event.
+
2007-11-07 Jonathan Pobst <[EMAIL PROTECTED]>
* ThemeWin32Classic.cs: Don't draw the background in DrawLabel or
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlElement.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlElement.cs
2007-11-08 16:29:34 UTC (rev 89207)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlElement.cs
2007-11-08 16:31:00 UTC (rev 89208)
@@ -56,7 +56,7 @@
public string InnerText
{
get { return this.element.InnerText; }
- set { throw new NotImplementedException (); }
+ set { this.element.InnerText = value; }
}
#endregion
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowser.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowser.cs
2007-11-08 16:29:34 UTC (rev 89207)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowser.cs
2007-11-08 16:31:00 UTC (rev 89208)
@@ -21,7 +21,7 @@
//
// Authors:
// Andreia Gaita <[EMAIL PROTECTED]>
-
+
#if NET_2_0
using System;
@@ -38,11 +38,9 @@
[Designer("System.Windows.Forms.Design.WebBrowserBaseDesigner, " +
Consts.AssemblySystem_Design,
"System.ComponentModel.Design.IDesigner")]
public class WebBrowser : WebBrowserBase
- {
+ {
private bool allowNavigation;
private bool allowWebBrowserDrop;
- private bool canGoBack;
- private bool canGoForward;
private bool isWebBrowserContextMenuEnabled;
private object objectForScripting;
private bool scriptErrorsSuppressed;
@@ -68,23 +66,20 @@
set { allowWebBrowserDrop = value; }
}
- [MonoTODO ("Stub, not implemented")]
[DefaultValue (true)]
public bool CanGoBack {
- get { return canGoBack; }
+ get { return this.WebHost.Navigation.CanGoBack; }
}
- [MonoTODO ("Stub, not implemented")]
[DefaultValue (true)]
public bool CanGoForward {
- get { return canGoForward; }
+ get { return this.WebHost.Navigation.CanGoForward; }
}
- [MonoTODO ("Stub, not implemented")]
public HtmlDocument Document {
get {
- if (document == null)
- document = new HtmlDocument
(this.WebHost);
+ if (document == null && documentReady)
+ document = new HtmlDocument
(this.WebHost);
return document;
}
}
@@ -101,10 +96,9 @@
set { throw new NotSupportedException (); }
}
- [MonoTODO ("Stub, not implemented")]
public string DocumentTitle {
- get { return String.Empty; }
- set { throw new NotSupportedException (); }
+ get { return document.Title; }
+ set { document.Title = value; }
}
[MonoTODO ("Stub, not implemented")]
@@ -168,10 +162,9 @@
set { statusText = value; }
}
- [MonoTODO ("Stub, not implemented")]
[BindableAttribute(true)]
public Uri Url {
- get { return null; }
+ get { return new Uri(WebHost.Document.Url); }
set { this.Navigate (value); }
}
@@ -197,94 +190,125 @@
public bool GoBack ()
{
- return WebHost.Back ();
+ documentReady = false;
+ document = null;
+ return WebHost.Navigation.Back ();
}
public bool GoForward ()
{
- return WebHost.Forward ();
+ documentReady = false;
+ document = null;
+ return WebHost.Navigation.Forward ();
}
public void GoHome ()
{
- WebHost.Home ();
+ documentReady = false;
+ document = null;
+ WebHost.Navigation.Home ();
}
- public void GoSearch ()
- {
- throw new NotImplementedException ();
- }
-
public void Navigate (string urlString)
{
+ documentReady = false;
+ document = null;
WebHost.Navigate (urlString);
}
public void Navigate (Uri url)
{
+ documentReady = false;
+ document = null;
WebHost.Navigate (url.ToString ());
}
public void Navigate (string urlString, bool newWindow)
{
- throw new NotImplementedException ();
+ documentReady = false;
+ document = null;
+ WebHost.Navigate (urlString);
}
public void Navigate (string urlString, string targetFrameName)
{
- throw new NotImplementedException ();
+ documentReady = false;
+ document = null;
+ WebHost.Navigate (urlString);
}
public void Navigate (Uri url, bool newWindow)
{
- throw new NotImplementedException ();
+ documentReady = false;
+ document = null;
+ WebHost.Navigate (url.ToString ());
}
public void Navigate (Uri url, string targetFrameName)
{
- throw new NotImplementedException ();
+ documentReady = false;
+ document = null;
+ WebHost.Navigate (url.ToString ());
}
public void Navigate (string urlString, string targetFrameName,
byte[] postData, string additionalHeaders)
{
- throw new NotImplementedException ();
+ documentReady = false;
+ document = null;
+ WebHost.Navigate (urlString);
}
public void Navigate (Uri url, string targetFrameName, byte[]
postData, string additionalHeaders)
{
- throw new NotImplementedException ();
+ documentReady = false;
+ document = null;
+ WebHost.Navigate (url.ToString ());
}
- public void Print ()
- {
- throw new NotImplementedException ();
- }
-
public override void Refresh ()
{
- WebHost.Reload (Mono.WebBrowser.ReloadOption.Full);
+ documentReady = false;
+ document = null;
+ WebHost.Navigation.Reload
(Mono.WebBrowser.ReloadOption.Full);
}
public void Refresh (WebBrowserRefreshOption opt)
{
+ documentReady = false;
+ document = null;
switch (opt) {
case WebBrowserRefreshOption.Normal:
- WebHost.Reload
(Mono.WebBrowser.ReloadOption.Proxy);
+ WebHost.Navigation.Reload
(Mono.WebBrowser.ReloadOption.Proxy);
break;
case WebBrowserRefreshOption.IfExpired:
- WebHost.Reload
(Mono.WebBrowser.ReloadOption.None);
+ WebHost.Navigation.Reload
(Mono.WebBrowser.ReloadOption.None);
break;
case WebBrowserRefreshOption.Completely:
- WebHost.Reload
(Mono.WebBrowser.ReloadOption.Full);
+ WebHost.Navigation.Reload
(Mono.WebBrowser.ReloadOption.Full);
break;
}
}
- public void ShowPageSetupDialog()
+ public void Stop ()
{
+ WebHost.Navigation.Stop ();
+ }
+
+ public void GoSearch ()
+ {
throw new NotImplementedException ();
}
+ public void Print ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void ShowPageSetupDialog ()
+ {
+ throw new NotImplementedException ();
+ }
+
public void ShowPrintDialog()
{
throw new NotImplementedException ();
@@ -305,11 +329,6 @@
throw new NotImplementedException ();
}
- public void Stop()
- {
- WebHost.Stop ();
- }
-
#endregion
@@ -513,6 +532,14 @@
OnNewWindow (c);
return c.Cancel;
}
+
+ internal override void OnWebHostNavigated (object sender,
EventArgs e)
+ {
+ documentReady = true;
+ WebBrowserNavigatedEventArgs n = new
WebBrowserNavigatedEventArgs (new Uri (WebHost.Document.Url));
+ OnNavigated (n);
+ }
+
#endregion
@@ -529,4 +556,4 @@
}
}
-#endif
\ No newline at end of file
+#endif
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs
2007-11-08 16:29:34 UTC (rev 89207)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs
2007-11-08 16:31:00 UTC (rev 89208)
@@ -38,6 +38,8 @@
[ComVisible(true)]
public abstract class WebBrowserBase : Control
{
+ protected bool documentReady;
+
#region Public Properties
[MonoTODO ("Stub, not implemented")]
[Browsable (false)]
@@ -297,7 +299,8 @@
webHost.MouseClick += new EventHandler
(OnWebHostMouseClick);
webHost.Focus += new EventHandler (OnWebHostFocus);
webHost.CreateNewWindow += new
Mono.WebBrowser.CreateNewWindowEventHandler (OnWebHostCreateNewWindow);
- webHost.Alert += new Mono.WebBrowser.AlertEventHandler
(OnWebHostAlert);
+ webHost.Alert += new Mono.WebBrowser.AlertEventHandler
(OnWebHostAlert);
+ webHost.Navigated += new EventHandler
(OnWebHostNavigated);
}
void OnWebHostAlert (object sender,
Mono.WebBrowser.AlertEventArgs e)
@@ -377,13 +380,15 @@
private void OnWebHostFocus (object sender, EventArgs e)
{
this.Focus ();
- }
+ }
+
#endregion
internal abstract bool OnNewWindowInternal ();
+ internal abstract void OnWebHostNavigated (object sender,
EventArgs e);
#endregion
}
}
-#endif
\ No newline at end of file
+#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches