Permalink
Browse files

Added CanGo(Back|Forward) properties to WebKitBrowser

Added xml comments to all public classes, members etc..
  • Loading branch information...
1 parent 9662654 commit 9a1c1298b2b35af0f8f020e1b9263c606533344a peterdn committed Sep 7, 2009
View
@@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
LICENSE.txt = LICENSE.txt
README.txt = README.txt
+ WebKitBrowserDoc.shfbproj = WebKitBrowserDoc.shfbproj
EndProjectSection
EndProject
Global
@@ -24,13 +24,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-/// TODO:
-/// possible race conditions?
-/// either find out if we can remove the need for this stuff altogether -
-/// embedding the manifest into a client application seems to work but is
-/// not an ideal solution - or work out how to load it from a resource -
-/// I've tried this already by getting CreateActCtx to load this assembly,
-/// but it can't seem to find the manifest resource.
+// TODO:
+// possible race conditions?
+// either find out if we can remove the need for this stuff altogether -
+// embedding the manifest into a client application seems to work but is
+// not an ideal solution - or work out how to load it from a resource -
+// I've tried this already by getting CreateActCtx to load this assembly,
+// but it can't seem to find the manifest resource.
using System;
using System.Collections.Generic;
@@ -58,5 +58,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.2.2.1")]
-[assembly: AssemblyFileVersion("0.2.2.1")]
+[assembly: AssemblyVersion("0.2.3.0")]
+[assembly: AssemblyFileVersion("0.2.3.0")]
@@ -41,18 +41,18 @@
namespace WebKit
{
- delegate void DecideDestinationWithSuggestedFilenameEvent(WebDownload download, string fileName);
- delegate void DidBeginEvent(WebDownload download);
- delegate void DidCancelAuthenticationChallengeEvent(WebDownload download, IWebURLAuthenticationChallenge challenge);
- delegate void DidCreateDestinationEvent(WebDownload download, string destination);
- delegate void DidFailWithErrorEvent(WebDownload download, WebError error);
- delegate void DidFinishEvent(WebDownload download);
- delegate void DidReceiveAuthenticationChallengeEvent(WebDownload download, IWebURLAuthenticationChallenge challenge);
- delegate void DidReceiveDataOfLengthEvent(WebDownload download, uint length);
- delegate void DidReceiveResponseEvent(WebDownload download, WebURLResponse response);
- delegate int ShouldDecodeSourceDataOfMIMETypeEvent(WebDownload download, string encodingType);
- delegate void WillResumeWithResponseEvent(WebDownload download, WebURLResponse response, long fromByte);
- delegate void WillSendRequestEvent(WebDownload download, WebMutableURLRequest request, WebURLResponse redirectResponse, out WebMutableURLRequest finalRequest);
+ internal delegate void DecideDestinationWithSuggestedFilenameEvent(WebDownload download, string fileName);
+ internal delegate void DidBeginEvent(WebDownload download);
+ internal delegate void DidCancelAuthenticationChallengeEvent(WebDownload download, IWebURLAuthenticationChallenge challenge);
+ internal delegate void DidCreateDestinationEvent(WebDownload download, string destination);
+ internal delegate void DidFailWithErrorEvent(WebDownload download, WebError error);
+ internal delegate void DidFinishEvent(WebDownload download);
+ internal delegate void DidReceiveAuthenticationChallengeEvent(WebDownload download, IWebURLAuthenticationChallenge challenge);
+ internal delegate void DidReceiveDataOfLengthEvent(WebDownload download, uint length);
+ internal delegate void DidReceiveResponseEvent(WebDownload download, WebURLResponse response);
+ internal delegate int ShouldDecodeSourceDataOfMIMETypeEvent(WebDownload download, string encodingType);
+ internal delegate void WillResumeWithResponseEvent(WebDownload download, WebURLResponse response, long fromByte);
+ internal delegate void WillSendRequestEvent(WebDownload download, WebMutableURLRequest request, WebURLResponse redirectResponse, out WebMutableURLRequest finalRequest);
internal class WebDownloadDelegate : IWebDownloadDelegate
{
@@ -37,21 +37,20 @@
namespace WebKit
{
// Delegate definitions WebFrameLoadDelegate events
- delegate void DidCancelClientRedirectForFrameEvent(WebView WebView, IWebFrame frame);
- delegate void DidChangeLocationWithinPageForFrameEvent(WebView WebView, IWebFrame frame);
- delegate void DidCommitLoadForFrameEvent(WebView WebView, IWebFrame frame);
- delegate void DidFailLoadWithErrorEvent(WebView WebView, IWebError error, IWebFrame frame);
- delegate void DidFailProvisionalLoadWithErrorEvent(WebView WebView, IWebError error, IWebFrame frame);
- delegate void DidFinishLoadForFrameEvent(WebView WebView, IWebFrame frame);
- delegate void DidRecieveIconEvent(WebView WebView, int hBitMap, IWebFrame frame);
- delegate void DidRecieveServerRedirectForProvisionalLoadForFrameEvent(WebView WebView, IWebFrame frame);
- delegate void DidRecieveTitleEvent(WebView WebView, string title, IWebFrame frame);
- delegate void DidStartProvisionalLoadForFrameEvent(WebView WebView, IWebFrame frame);
- delegate void WillCloseFrameEvent(WebView WebView, IWebFrame frame);
- delegate void WillPerformClientRedirectToURLEvent(WebView WebView, string url, double delaySeconds, DateTime fireDate, IWebFrame frame);
- delegate void WindowScriptObjectAvailableEvent(WebView WebView, IntPtr context, IntPtr windowScriptObject);
- delegate void DidClearWindowObjectEvent(WebView WebView, IntPtr context, IntPtr windowScriptObject, IWebFrame frame);
-
+ internal delegate void DidCancelClientRedirectForFrameEvent(WebView WebView, IWebFrame frame);
+ internal delegate void DidChangeLocationWithinPageForFrameEvent(WebView WebView, IWebFrame frame);
+ internal delegate void DidCommitLoadForFrameEvent(WebView WebView, IWebFrame frame);
+ internal delegate void DidFailLoadWithErrorEvent(WebView WebView, IWebError error, IWebFrame frame);
+ internal delegate void DidFailProvisionalLoadWithErrorEvent(WebView WebView, IWebError error, IWebFrame frame);
+ internal delegate void DidFinishLoadForFrameEvent(WebView WebView, IWebFrame frame);
+ internal delegate void DidRecieveIconEvent(WebView WebView, int hBitMap, IWebFrame frame);
+ internal delegate void DidRecieveServerRedirectForProvisionalLoadForFrameEvent(WebView WebView, IWebFrame frame);
+ internal delegate void DidRecieveTitleEvent(WebView WebView, string title, IWebFrame frame);
+ internal delegate void DidStartProvisionalLoadForFrameEvent(WebView WebView, IWebFrame frame);
+ internal delegate void WillCloseFrameEvent(WebView WebView, IWebFrame frame);
+ internal delegate void WillPerformClientRedirectToURLEvent(WebView WebView, string url, double delaySeconds, DateTime fireDate, IWebFrame frame);
+ internal delegate void WindowScriptObjectAvailableEvent(WebView WebView, IntPtr context, IntPtr windowScriptObject);
+ internal delegate void DidClearWindowObjectEvent(WebView WebView, IntPtr context, IntPtr windowScriptObject, IWebFrame frame);
internal class WebFrameLoadDelegate : IWebFrameLoadDelegate
{
@@ -38,10 +38,8 @@
using WebKit;
using WebKit.Interop;
using System.Diagnostics;
+using System.Reflection;
-/// <summary>
-/// Contains classes for creating instances of and communication with the WebKit COM component.
-/// </summary>
namespace WebKit
{
/// <summary>
@@ -67,8 +65,15 @@ public partial class WebKitBrowser : UserControl
private WebPolicyDelegate policyDelegate;
private WebUIDelegate uiDelegate;
- // redirects relevant key strokes to the webkit control
- // bit more work is needed here perhaps
+
+ #region Overridden methods
+
+ /// <summary>
+ /// Processes a command key. Overridden in WebKitBrowser to forward key events to the WebKit window.
+ /// </summary>
+ /// <param name="msg">The window message to process.</param>
+ /// <param name="keyData">The key to process.</param>
+ /// <returns>Success value.</returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
Keys key = (Keys)msg.WParam.ToInt32();
@@ -82,6 +87,7 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
return base.ProcessCmdKey(ref msg, keyData);
}
+ #endregion
#region WebKitBrowser events
@@ -114,7 +120,7 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
public event WebKitBrowserErrorEventHandler Error = delegate { };
/// <summary>
- /// Occurs when the WebKitBrowser control starts to download a file.
+ /// Occurs when the WebKitBrowser control begins a file download, before any data has been transferred.
/// </summary>
public event FileDownloadBeginEventHandler DownloadBegin = delegate { };
@@ -209,7 +215,7 @@ public string DocumentText
}
/// <summary>
- /// Returns the currently selected text.
+ /// Gets the currently selected text.
/// </summary>
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string SelectedText
@@ -245,7 +251,7 @@ public string ApplicationName
}
/// <summary>
- /// Gets or sets the user agent.
+ /// Gets or sets the user agent string.
/// </summary>
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string UserAgent
@@ -265,7 +271,7 @@ public string UserAgent
}
/// <summary>
- /// Text size multiplier (1.0 is normal size).
+ /// Gets or sets the text size multiplier (1.0 is normal size).
/// </summary>
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public float TextSize
@@ -298,17 +304,47 @@ public float TextSize
public bool AllowDownloads { get; set; }
/// <summary>
- /// Gets or sets whether to allow new windows.
+ /// Gets or sets whether to allow links to be opened in a new window.
/// </summary>
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool AllowNewWindows { get; set; }
- public readonly string Version = "0.2.2";
+ /// <summary>
+ /// Gets a value indicating whether a previous page in the navigation history is available.
+ /// </summary>
+ [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool CanGoBack
+ {
+ get
+ {
+ return webView.backForwardList().backListCount() > 0;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether a subsequent page in the navigation history is available
+ /// </summary>
+ [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public bool CanGoForward
+ {
+ get
+ {
+ return webView.backForwardList().forwardListCount() > 0;
+ }
+ }
+
+ /// <summary>
+ /// Gets the current version.
+ /// </summary>
+ public readonly Version Version = Assembly.GetExecutingAssembly().GetName().Version;
#endregion
#region Constructors / initialization functions
+ /// <summary>
+ /// Initializes a new instance of the WebKitBrowser control.
+ /// </summary>
public WebKitBrowser()
{
InitializeComponent();
@@ -93,8 +93,10 @@
</Target>
-->
<PropertyGroup>
- <PostBuildEvent>xcopy /E /Y "$(SolutionDir)webkit\*" "$(SolutionDir)bin\$(ConfigurationName)"</PostBuildEvent>
+ <PostBuildEvent>echo WebKitBrowser &gt; temp_exclude_files.txt
+xcopy /E /Y "$(SolutionDir)webkit\*" "$(SolutionDir)bin\$(ConfigurationName)"
+del temp_exclude_files.txt</PostBuildEvent>
<PreBuildEvent>call "$(DevEnvDir)..\..\VC\vcvarsall.bat" x86
-tlbimp "$(SolutionDir)webkit\webkit.dll" /namespace:WebKit.Interop /out:"$(SolutionDir)webkit\WebKit.Interop.dll"</PreBuildEvent>
+tlbimp "$(SolutionDir)webkit\webkit.dll" /silent /namespace:WebKit.Interop /out:"$(SolutionDir)webkit\WebKit.Interop.dll"</PreBuildEvent>
</PropertyGroup>
</Project>
@@ -32,52 +32,131 @@
namespace WebKit
{
+ #region Event handler delegates
+
+ /// <summary>
+ /// Represents the method that will handle the WebKitBrowser.Error event.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="args">A WebKitBrowserErrorEventArgs that contains the event data.</param>
public delegate void WebKitBrowserErrorEventHandler (object sender, WebKitBrowserErrorEventArgs args);
+
+ /// <summary>
+ /// Represents the method that will handle the WebKitBrowser.FileDownloadBegin event.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="args">A FileDownloadBeginEventArgs that contains the event data.</param>
public delegate void FileDownloadBeginEventHandler (object sender, FileDownloadBeginEventArgs args);
+
+ /// <summary>
+ /// Represents the method that will handle the WebKitBrowser.NewWindowRequest event.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="args">A NewWindowRequestEventArgs that contains the event data.</param>
public delegate void NewWindowRequestEventHandler (object sender, NewWindowRequestEventArgs args);
+
+ /// <summary>
+ /// Represents the method that will handle the WebKitBrowser.NewWindowCreated event.
+ /// </summary>
+ /// <param name="sender">The source of the event.</param>
+ /// <param name="args">A NewWindowCreatedEventArgs that contains the event data.</param>
public delegate void NewWindowCreatedEventHandler (object sender, NewWindowCreatedEventArgs args);
+ #endregion
+
+ #region EventArgs classes
+
+ /// <summary>
+ /// Provides data for the WebKitBrowser.Error event.
+ /// </summary>
public class WebKitBrowserErrorEventArgs : EventArgs
{
+ /// <summary>
+ /// Gets a description of the error that occurred.
+ /// </summary>
public string Description { get; private set; }
+ /// <summary>
+ /// Initializes a new instance of the WebKitBrowserErrorEventArgs class.
+ /// </summary>
+ /// <param name="Description">A description of the error that occurred.</param>
public WebKitBrowserErrorEventArgs(string Description)
{
this.Description = Description;
}
}
+ /// <summary>
+ /// Provides data for the WebKitBrowser.FileDownloadBegin event.
+ /// </summary>
public class FileDownloadBeginEventArgs : EventArgs
{
+ /// <summary>
+ /// Gets the WebKitDownload representing the download.
+ /// </summary>
public WebKitDownload Download { get; private set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the download should be cancelled.
+ /// </summary>
public bool Cancel { get; set; }
+ /// <summary>
+ /// Initializes a new instance of the FileDownloadBeginEventArgs class.
+ /// </summary>
+ /// <param name="Download">A WebKitDownload representing the download.</param>
public FileDownloadBeginEventArgs(WebKitDownload Download)
{
this.Download = Download;
this.Cancel = false;
}
}
+ /// <summary>
+ /// Provides data for the WebKitBrowser.NewWindowRequest event.
+ /// </summary>
public class NewWindowRequestEventArgs : EventArgs
{
+ /// <summary>
+ /// Gets or sets a value indicating whether opening the new window should be cancelled.
+ /// </summary>
public bool Cancel { get; set; }
+
+ /// <summary>
+ /// Gets the Url that the new window will attempt to navigate to.
+ /// </summary>
public string Url { get; private set; }
+ /// <summary>
+ /// Initializes a new instance of the NewWindowRequestEventArgs class.
+ /// </summary>
+ /// <param name="Url">The Url that the new window will attempt to navigate to.</param>
public NewWindowRequestEventArgs(string Url)
{
this.Cancel = false;
this.Url = Url;
}
}
+ /// <summary>
+ /// Provides data for the WebKitBrowser.NewWindowCreated event.
+ /// </summary>
public class NewWindowCreatedEventArgs : EventArgs
{
+ /// <summary>
+ /// Gets the WebKitBrowser showing the contents of the new window.
+ /// </summary>
public WebKitBrowser WebKitBrowser { get; private set; }
+ /// <summary>
+ /// Initializes a new instance of the NewWindowCreatedEventArgs class.
+ /// </summary>
+ /// <param name="browser">The WebKitBrowser showing the contents of the new window.</param>
public NewWindowCreatedEventArgs(WebKitBrowser browser)
{
WebKitBrowser = browser;
}
}
+
+ #endregion
}
Oops, something went wrong.

0 comments on commit 9a1c129

Please sign in to comment.