Author: andreia
Date: 2007-09-23 19:07:38 -0400 (Sun, 23 Sep 2007)
New Revision: 86249
Modified:
trunk/mcs/class/Mono.Mozilla/ChangeLog
trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Base.cs
trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Callback.cs
trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/ICallback.cs
trunk/mcs/class/Mono.Mozilla/Mono.Mozilla2K5.csproj
trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/IWebBrowser.cs
trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/WebBrowser.cs
Log:
2007-09-23 Andreia Gaita <[EMAIL PROTECTED]>
* Added implementation of dialog popups - alert,
alertcheck, confirm, confirmcheck, confirmex, prompt,
promptusernameandpassword, promptpassword, select.
Cleaned up some.
Modified: trunk/mcs/class/Mono.Mozilla/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Mozilla/ChangeLog 2007-09-23 19:39:34 UTC (rev
86248)
+++ trunk/mcs/class/Mono.Mozilla/ChangeLog 2007-09-23 23:07:38 UTC (rev
86249)
@@ -1,3 +1,10 @@
+2007-09-23 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * Added implementation of dialog popups - alert,
+ alertcheck, confirm, confirmcheck, confirmex, prompt,
+ promptusernameandpassword, promptpassword, select.
+ Cleaned up some.
+
2007-09-19 Andreia Gaita <[EMAIL PROTECTED]>
* Forgot to commit an update on the xulbrowser check :/
Modified: trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Base.cs
===================================================================
--- trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Base.cs 2007-09-23 19:39:34 UTC
(rev 86248)
+++ trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Base.cs 2007-09-23 23:07:38 UTC
(rev 86249)
@@ -43,6 +43,21 @@
public IntPtr xulbrowser;
}
+ private static bool isInitialized ()
+ {
+ if (!xulbrowserInstalled)
+ return false;
+ return true;
+ }
+
+ private static BindingInfo getBinding (IWebBrowser control)
+ {
+ if (!boundControls.ContainsKey (control))
+ return null;
+ BindingInfo info = boundControls[control] as
BindingInfo;
+ return info;
+ }
+
static Base ()
{
boundControls = new Hashtable ();
@@ -78,163 +93,124 @@
DebugStartup ();
}
- public static void Shutdown (Mono.WebBrowser.WebBrowser control)
+ public static void Shutdown (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_shutdown (info.xulbrowser);
}
public static void Bind (IWebBrowser control, IntPtr handle,
int width, int height)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_createBrowserWindow (info.xulbrowser,
handle, width, height);
}
// layout
public static void Focus (IWebBrowser control, FocusOption
focus)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_focus (info.xulbrowser, focus);
}
public static void Blur (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_deactivate (info.xulbrowser);
}
public static void Activate (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_activate (info.xulbrowser);
}
public static void Deactivate (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_deactivate (info.xulbrowser);
}
public static void Resize (IWebBrowser control, int width, int
height)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_resize (info.xulbrowser, width, height);
}
// navigation
public static void Navigate (IWebBrowser control, string uri)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_navigate (info.xulbrowser, uri);
}
public static bool Forward (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return false;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
return xulbrowser_forward (info.xulbrowser);
}
public static bool Back (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return false;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
return xulbrowser_back (info.xulbrowser);
}
public static void Home (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_home (info.xulbrowser);
}
public static void Stop (IWebBrowser control)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_stop (info.xulbrowser);
}
public static void Reload (IWebBrowser control, ReloadOption
option)
{
- if (!xulbrowserInstalled)
+ if (!isInitialized ())
return;
+ BindingInfo info = getBinding (control);
- if (!boundControls.ContainsKey (control))
- throw new ArgumentException ();
- BindingInfo info = boundControls[control] as
BindingInfo;
-
xulbrowser_reload (info.xulbrowser, option);
}
Modified: trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Callback.cs
===================================================================
--- trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Callback.cs 2007-09-23
19:39:34 UTC (rev 86248)
+++ trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/Callback.cs 2007-09-23
23:07:38 UTC (rev 86249)
@@ -30,137 +30,159 @@
namespace Mono.Mozilla {
- public delegate void CallbackDelegate();
- public delegate void GetControlSizeCallbackDelegate (ref
SizeInfo sz);
- public delegate void ResizeToCallbackDelegate (Int32
width, Int32 height);
- public delegate void ShowTooltipCallbackDelegate (Int32
x, Int32 y, string tiptext);
- public delegate void StateSpecialCallbackDelegate (UInt32
flags, Int32 status);
- public delegate void StateChangeCallbackDelegate (string
URI, UInt32 flags, Int32 status);
- public delegate void ProgressCallbackDelegate (Int32
currentTotalProgess, Int32 maxTotalProgress);
- public delegate void ProgressAllCallbackDelegate (string
URI, Int32 currentTotalProgess, Int32 maxTotalProgress);
- public delegate void StatusChangeCallbackDelegate (Int32
status, string message);
- public delegate void SecurityChangeCallbackDelegate (UInt32
state);
- public delegate void VisibilityCallbackDelegate (bool
val);
+ public delegate void CallbackDelegate ();
+
+ public delegate void CallbackDelegateStringString (string arg1,
string arg2);
+ public delegate void CallbackDelegateStringInt (string arg1,
Int32 arg2);
+ public delegate void CallbackDelegateStringIntInt (string arg1,
Int32 arg2, Int32 arg3);
+ public delegate void CallbackDelegateStringIntUint (string arg1,
Int32 arg2, UInt32 arg3);
+
+
+ public delegate void CallbackDelegateIntInt (Int32
arg1, Int32 arg2);
+
+ public delegate void CallbackDelegateUint (UInt32
arg1);
+ public delegate void CallbackDelegateUintInt (UInt32 arg1,
Int32 arg2);
+
+ public delegate void CallbackDelegatePtrPtr (IntPtr
arg1, IntPtr arg2);
+
+ //Don't have to worry about marshelling bool, PRBool seems very
constant and uses 4 bit int underneath
+ public delegate void CallbackDelegateBool (bool
val);
- //Don't have to worry about marshelling bool, PRBool seems very
constant and uses 4 bit int underneath
- public delegate bool DomKeyCallbackDelegate
(KeyInfo keyInfo, ModifierKeys modifiers);
- public delegate bool MouseCallbackDelegate
(MouseInfo mouseInfo, ModifierKeys modifiers);
- public delegate bool FocusCallbackDelegate
(Int32 detail);
- public delegate bool BeforeUriOpenCallbackDelegate (string
URI);
- public delegate bool CreateNewWindowCallbackDelegate ();
+ public delegate bool DomKeyCallbackDelegate
(KeyInfo keyInfo, ModifierKeys modifiers);
+ public delegate bool MouseCallbackDelegate
(MouseInfo mouseInfo, ModifierKeys modifiers);
- public delegate void GenericCallbackDelegate (IntPtr type);
+ public delegate void GetControlSizeCallbackDelegate (ref SizeInfo sz);
+
+ public delegate void GenericCallbackDelegate (IntPtr type);
+
+ public delegate bool CallbackDelegate2 ();
+ public delegate bool CallbackDelegate2String (string arg1);
+
+
+ public delegate bool CallbackDelegate2OnAlertCheck (IntPtr title,
IntPtr text, IntPtr chkMsg, ref bool chkState);
+ public delegate bool CallbackDelegate2OnConfirm (IntPtr title,
IntPtr text);
+ public delegate bool CallbackDelegate2OnConfirmCheck(IntPtr title,
IntPtr text, IntPtr chkMsg, ref bool chkState);
+ public delegate bool CallbackDelegate2OnConfirmEx (IntPtr title,
IntPtr text, Mono.WebBrowser.DialogButtonFlags flags,
+
IntPtr title0, IntPtr title1, IntPtr title2,
+
IntPtr chkMsg, ref bool chkState, out Int32
retVal);
+ public delegate bool CallbackDelegate2OnPrompt (IntPtr title,
IntPtr text,
+
IntPtr chkMsg, ref bool chkState,
StringBuilder retVal);
+ public delegate bool CallbackDelegate2OnPromptUsernameAndPassword
+
(IntPtr title, IntPtr text,
+
IntPtr chkMsg, ref bool chkState,
+
out IntPtr username, out IntPtr password);
+ public delegate bool CallbackDelegate2OnPromptPassword
+
(IntPtr title, IntPtr text,
+
IntPtr chkMsg, ref bool chkState,
+
out IntPtr password);
+ public delegate bool CallbackDelegate2OnSelect (IntPtr title,
IntPtr text,
+
UInt32 count, IntPtr list,
+
out Int32 retVal);
+
-
[StructLayout (LayoutKind.Sequential)]
public struct CallbackBinder {
- public CallbackDelegate
EventOnWidgetLoaded;
- public CallbackDelegate
EventJSStatus;
- public CallbackDelegate
EventLinkStatus;
- public CallbackDelegate
EventDestoryBrowser;
- public ResizeToCallbackDelegate EventSizeTo;
- public CallbackDelegate
EventFocusNext;
- public CallbackDelegate
EventFocusPrev;
- public CallbackDelegate
EventTitleChanged;
- public ShowTooltipCallbackDelegate
EventShowTooltipWindow;
- public CallbackDelegate
EventHideTooltipWindow;
- public CallbackDelegate
EventStateNetStart;
- public CallbackDelegate
EventStateNetStop;
- public StateSpecialCallbackDelegate
EventStateSpecial;
- public StateChangeCallbackDelegate
EventStateChange;
- public ProgressCallbackDelegate EventProgress;
- public ProgressAllCallbackDelegate
EventProgressAll;
- public CallbackDelegate
EventLocationChanged;
- public StatusChangeCallbackDelegate
EventStatusChange;
- public SecurityChangeCallbackDelegate EventSecurityChange;
- public VisibilityCallbackDelegate EventVisibility;
+ public CallbackDelegate
OnWidgetLoaded;
+ public CallbackDelegate
OnJSStatus;
+ public CallbackDelegate
OnLinkStatus;
+ public CallbackDelegate
OnDestroyBrowser;
+ public CallbackDelegateIntInt OnSizeTo;
+ public CallbackDelegate
OnFocusNext;
+ public CallbackDelegate
OnFocusPrev;
+ public CallbackDelegate
OnTitleChanged;
+ public CallbackDelegateStringIntInt
OnShowTooltipWindow;
+ public CallbackDelegate
OnHideTooltipWindow;
+ public CallbackDelegate
OnStateNetStart;
+ public CallbackDelegate
OnStateNetStop;
+ public CallbackDelegateUintInt OnStateSpecial;
+ public CallbackDelegateStringIntUint OnStateChange;
+ public CallbackDelegateIntInt OnProgress;
+ public CallbackDelegateStringIntInt OnProgressAll;
+ public CallbackDelegate
OnLocationChanged;
+ public CallbackDelegateStringInt OnStatusChange;
+ public CallbackDelegateUint
OnSecurityChange;
+ public CallbackDelegateBool
OnVisibility;
public GetControlSizeCallbackDelegate GetControlSize;
- public DomKeyCallbackDelegate EventDomKeyDown;
- public DomKeyCallbackDelegate EventDomKeyUp;
- public DomKeyCallbackDelegate
EventDomKeyPress;
- public MouseCallbackDelegate EventMouseDown;
- public MouseCallbackDelegate EventMouseUp;
- public MouseCallbackDelegate EventMouseClick;
- public MouseCallbackDelegate
EventMouseDoubleClick;
- public MouseCallbackDelegate EventMouseOver;
- public MouseCallbackDelegate EventMouseOut;
- public FocusCallbackDelegate EventActivate;
- public FocusCallbackDelegate EventFocusIn;
- public FocusCallbackDelegate EventFocusOut;
- public BeforeUriOpenCallbackDelegate EventBeforeURIOpen;
- public CallbackDelegate
EventFocus;
- public CreateNewWindowCallbackDelegate EventCreateNewWindow;
-
- public GenericCallbackDelegate EventGeneric;
+ public DomKeyCallbackDelegate OnDomKeyDown;
+ public DomKeyCallbackDelegate OnDomKeyUp;
+ public DomKeyCallbackDelegate OnDomKeyPress;
+ public MouseCallbackDelegate OnMouseDown;
+ public MouseCallbackDelegate OnMouseUp;
+ public MouseCallbackDelegate OnMouseClick;
+ public MouseCallbackDelegate
OnMouseDoubleClick;
+ public MouseCallbackDelegate OnMouseOver;
+ public MouseCallbackDelegate OnMouseOut;
+ public CallbackDelegate2
OnActivate;
+ public CallbackDelegate2
OnFocusIn;
+ public CallbackDelegate2
OnFocusOut;
+ public CallbackDelegate2String OnBeforeURIOpen;
+ public CallbackDelegate OnFocus;
+ public CallbackDelegate2
OnCreateNewWindow;
+ public CallbackDelegatePtrPtr OnAlert;
+
+ public CallbackDelegate2OnAlertCheck OnAlertCheck;
+ public CallbackDelegate2OnConfirm OnConfirm;
+ public CallbackDelegate2OnConfirmCheck OnConfirmCheck;
+ public CallbackDelegate2OnConfirmEx OnConfirmEx;
+ public CallbackDelegate2OnPrompt OnPrompt;
+ public CallbackDelegate2OnPromptUsernameAndPassword
OnPromptUsernameAndPassword;
+ public CallbackDelegate2OnPromptPassword OnPromptPassword;
+ public CallbackDelegate2OnSelect OnSelect;
+
+ public GenericCallbackDelegate OnGeneric;
internal CallbackBinder (ICallback callback) {
- this.EventOnWidgetLoaded = new CallbackDelegate
(callback.OnWidgetLoaded);
- this.GetControlSize = new
GetControlSizeCallbackDelegate(callback.GetControlSize);
- this.EventJSStatus = new
CallbackDelegate(callback.OnJSStatus);
- this.EventLinkStatus = new
CallbackDelegate(callback.OnLinkStatus);
- this.EventDestoryBrowser = new
CallbackDelegate(callback.OnDestroyBrowser);
- this.EventSizeTo = new
ResizeToCallbackDelegate(callback.OnClientSizeTo);
- this.EventFocusNext = new
CallbackDelegate(callback.OnFocusNext);
- this.EventFocusPrev = new
CallbackDelegate(callback.OnFocusPrev);
- this.EventTitleChanged = new
CallbackDelegate(callback.OnTitleChanged);
- this.EventShowTooltipWindow = new
ShowTooltipCallbackDelegate(callback.OnShowTooltipWindow);
- this.EventHideTooltipWindow = new
CallbackDelegate(callback.OnHideTooltipWindow);
- this.EventStateNetStart = new
CallbackDelegate(callback.OnStateNetStart);
- this.EventStateNetStop = new
CallbackDelegate(callback.OnStateNetStop);
- this.EventStateSpecial = new
StateSpecialCallbackDelegate(callback.OnStateSpecial);
- this.EventStateChange = new
StateChangeCallbackDelegate(callback.OnStateChange);
- this.EventProgress = new
ProgressCallbackDelegate(callback.OnProgress);
- this.EventProgressAll = new
ProgressAllCallbackDelegate(callback.OnProgressAll);
- this.EventLocationChanged = new
CallbackDelegate(callback.OnLocationChanged);
- this.EventStatusChange = new
StatusChangeCallbackDelegate(callback.OnStatusChange);
- this.EventSecurityChange = new
SecurityChangeCallbackDelegate(callback.OnSecurityChange);
- this.EventVisibility = new
VisibilityCallbackDelegate(callback.OnVisibility);
- this.EventDomKeyDown = new
DomKeyCallbackDelegate(callback.OnClientDomKeyDown);
- this.EventDomKeyUp = new
DomKeyCallbackDelegate(callback.OnClientDomKeyUp);
- this.EventDomKeyPress = new
DomKeyCallbackDelegate(callback.OnClientDomKeyPress);
- this.EventMouseDown = new
MouseCallbackDelegate(callback.OnClientMouseDown);
- this.EventMouseUp = new
MouseCallbackDelegate(callback.OnClientMouseUp);
- this.EventMouseClick = new
MouseCallbackDelegate(callback.OnClientMouseClick);
- this.EventMouseDoubleClick = new
MouseCallbackDelegate(callback.OnClientMouseDoubleClick);
- this.EventMouseOver = new
MouseCallbackDelegate(callback.OnClientMouseOver);
- this.EventMouseOut = new
MouseCallbackDelegate(callback.OnClientMouseOut);
- this.EventActivate = new
FocusCallbackDelegate(callback.OnClientActivate);
- this.EventFocusIn = new
FocusCallbackDelegate(callback.OnClientFocusIn);
- this.EventFocusOut = new
FocusCallbackDelegate(callback.OnClientFocusOut);
- this.EventBeforeURIOpen = new
BeforeUriOpenCallbackDelegate(callback.OnBeforeURIOpen);
- this.EventFocus= new CallbackDelegate
(callback.OnFocus);
- this.EventCreateNewWindow = new
CreateNewWindowCallbackDelegate (callback.OnCreateNewWindow);
- this.EventGeneric = new GenericCallbackDelegate
(callback.OnGeneric);
+ this.OnWidgetLoaded = new
CallbackDelegate (callback.OnWidgetLoaded);
+ this.GetControlSize = new
GetControlSizeCallbackDelegate (callback.GetControlSize);
+ this.OnJSStatus = new
CallbackDelegate (callback.OnJSStatus);
+ this.OnLinkStatus = new
CallbackDelegate (callback.OnLinkStatus);
+ this.OnDestroyBrowser = new CallbackDelegate
(callback.OnDestroyBrowser);
+ this.OnSizeTo = new
CallbackDelegateIntInt (callback.OnClientSizeTo);
+ this.OnFocusNext = new
CallbackDelegate (callback.OnFocusNext);
+ this.OnFocusPrev = new
CallbackDelegate (callback.OnFocusPrev);
+ this.OnTitleChanged = new
CallbackDelegate (callback.OnTitleChanged);
+ this.OnShowTooltipWindow = new
CallbackDelegateStringIntInt (callback.OnShowTooltipWindow);
+ this.OnHideTooltipWindow = new CallbackDelegate
(callback.OnHideTooltipWindow);
+ this.OnStateNetStart = new CallbackDelegate
(callback.OnStateNetStart);
+ this.OnStateNetStop = new
CallbackDelegate (callback.OnStateNetStop);
+ this.OnStateSpecial = new
CallbackDelegateUintInt (callback.OnStateSpecial);
+ this.OnStateChange = new
CallbackDelegateStringIntUint (callback.OnStateChange);
+ this.OnProgress = new
CallbackDelegateIntInt (callback.OnProgress);
+ this.OnProgressAll = new
CallbackDelegateStringIntInt (callback.OnProgressAll);
+ this.OnLocationChanged = new CallbackDelegate
(callback.OnLocationChanged);
+ this.OnStatusChange = new
CallbackDelegateStringInt (callback.OnStatusChange);
+ this.OnSecurityChange = new
CallbackDelegateUint (callback.OnSecurityChange);
+ this.OnVisibility = new
CallbackDelegateBool (callback.OnVisibility);
+ this.OnDomKeyDown = new
DomKeyCallbackDelegate (callback.OnClientDomKeyDown);
+ this.OnDomKeyUp = new
DomKeyCallbackDelegate (callback.OnClientDomKeyUp);
+ this.OnDomKeyPress = new
DomKeyCallbackDelegate (callback.OnClientDomKeyPress);
+ this.OnMouseDown = new
MouseCallbackDelegate (callback.OnClientMouseDown);
+ this.OnMouseUp = new
MouseCallbackDelegate (callback.OnClientMouseUp);
+ this.OnMouseClick = new
MouseCallbackDelegate (callback.OnClientMouseClick);
+ this.OnMouseDoubleClick = new
MouseCallbackDelegate (callback.OnClientMouseDoubleClick);
+ this.OnMouseOver = new
MouseCallbackDelegate (callback.OnClientMouseOver);
+ this.OnMouseOut = new
MouseCallbackDelegate (callback.OnClientMouseOut);
+ this.OnActivate = new
CallbackDelegate2 (callback.OnClientActivate);
+ this.OnFocusIn = new
CallbackDelegate2 (callback.OnClientFocusIn);
+ this.OnFocusOut = new
CallbackDelegate2 (callback.OnClientFocusOut);
+ this.OnBeforeURIOpen = new
CallbackDelegate2String (callback.OnBeforeURIOpen);
+ this.OnFocus = new
CallbackDelegate (callback.OnFocus);
+ this.OnCreateNewWindow = new CallbackDelegate2
(callback.OnCreateNewWindow);
+ this.OnAlert = new
CallbackDelegatePtrPtr (callback.OnAlert);
+
+ this.OnAlertCheck= new CallbackDelegate2OnAlertCheck
(callback.OnAlertCheck);
+ this.OnConfirm = new CallbackDelegate2OnConfirm
(callback.OnConfirm);
+ this.OnConfirmCheck = new
CallbackDelegate2OnConfirmCheck (callback.OnConfirmCheck);
+ this.OnConfirmEx = new CallbackDelegate2OnConfirmEx
(callback.OnConfirmEx);
+ this.OnPrompt = new CallbackDelegate2OnPrompt
(callback.OnPrompt);
+ this.OnPromptUsernameAndPassword = new
CallbackDelegate2OnPromptUsernameAndPassword
(callback.OnPromptUsernameAndPassword);
+ this.OnPromptPassword = new
CallbackDelegate2OnPromptPassword (callback.OnPromptPassword);
+ this.OnSelect = new CallbackDelegate2OnSelect
(callback.OnSelect);
+
+
+ this.OnGeneric = new
GenericCallbackDelegate (callback.OnGeneric);
}
}
- [StructLayout (LayoutKind.Sequential)]
- public struct SizeInfo {
- public UInt32 width;
- public UInt32 height;
- }
-
- [StructLayout (LayoutKind.Sequential)]
- public struct ModifierKeys {
- public Int32 altKey;
- public Int32 ctrlKey;
- public Int32 metaKey;
- public Int32 shiftKey;
- }
-
- [StructLayout (LayoutKind.Sequential)]
- public struct MouseInfo {
- public UInt16 button;
- public Int32 clientX;
- public Int32 clientY;
- public Int32 screenX;
- public Int32 screenY;
- }
-
- [StructLayout (LayoutKind.Sequential)]
- public struct KeyInfo {
- public UInt32 charCode;
- public UInt32 keyCode;
- }
}
Modified: trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/ICallback.cs
===================================================================
--- trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/ICallback.cs 2007-09-23
19:39:34 UTC (rev 86248)
+++ trunk/mcs/class/Mono.Mozilla/Mono.Mozilla/ICallback.cs 2007-09-23
23:07:38 UTC (rev 86249)
@@ -24,57 +24,123 @@
//
using System;
+using System.Text;
+using System.Runtime.InteropServices;
namespace Mono.Mozilla
{
internal interface ICallback
{
- void OnWidgetLoaded ();
+ void OnWidgetLoaded ();
- void GetControlSize (ref SizeInfo sz);
- void OnJSStatus ();
- void OnLinkStatus ();
- void OnDestroyBrowser ();
- void OnClientSizeTo (Int32 width, Int32 height);
- void OnFocusNext ();
- void OnFocusPrev ();
- void OnTitleChanged ();
- void OnShowTooltipWindow (Int32 x, Int32 y, string tiptext);
- void OnHideTooltipWindow ();
- void OnStateNetStart ();
- void OnStateNetStop ();
- void OnStateSpecial (UInt32 stateFlags, Int32 status);
- void OnStateChange (string URI, UInt32 stateFlags, Int32
status);
- void OnProgress (Int32 currentTotalProgress, Int32
maxTotalProgress);
- void OnProgressAll (string URI, Int32 currentTotalProgress,
Int32 maxTotalProgress);
- void OnLocationChanged ();
- void OnStatusChange (Int32 status, string message);
- void OnSecurityChange (UInt32 state);
- void OnVisibility (bool val);
+ void GetControlSize (ref SizeInfo
sz);
+ void OnJSStatus ();
+ void OnLinkStatus ();
+ void OnDestroyBrowser ();
+ void OnClientSizeTo (Int32 width,
Int32 height);
+ void OnFocusNext ();
+ void OnFocusPrev ();
+ void OnTitleChanged ();
+ void OnShowTooltipWindow (string tiptext, Int32
x, Int32 y);
+ void OnHideTooltipWindow ();
+ void OnStateNetStart ();
+ void OnStateNetStop ();
+ void OnStateSpecial (UInt32
stateFlags, Int32 status);
+ void OnStateChange (string URI,
Int32 status, UInt32 stateFlags);
+ void OnProgress (Int32
currentTotalProgress, Int32 maxTotalProgress);
+ void OnProgressAll (string URI,
Int32 currentTotalProgress, Int32 maxTotalProgress);
+ void OnLocationChanged ();
+ void OnStatusChange (string
message, Int32 status);
+ void OnSecurityChange (UInt32 state);
+ void OnVisibility (bool val);
- //Don't have to worry about marshelling bool, PRBool seems very
constant and uses 4 bit int underneath
- bool OnClientDomKeyDown (KeyInfo keyInfo, ModifierKeys modKey);
- bool OnClientDomKeyUp (KeyInfo keyInfo, ModifierKeys modKey);
- bool OnClientDomKeyPress (KeyInfo keyInfo, ModifierKeys modKey);
+ //Don't have to worry about marshelling bool, bool seems very
constant and uses 4 bit int underneath
+ bool OnClientDomKeyDown (KeyInfo keyInfo,
ModifierKeys modKey);
+ bool OnClientDomKeyUp (KeyInfo keyInfo,
ModifierKeys modKey);
+ bool OnClientDomKeyPress (KeyInfo keyInfo,
ModifierKeys modKey);
- bool OnClientMouseDown (MouseInfo mouseInfo, ModifierKeys
modifiers);
- bool OnClientMouseUp (MouseInfo mouseInfo, ModifierKeys
modifiers);
- bool OnClientMouseClick (MouseInfo mouseInfo, ModifierKeys
modifiers);
- bool OnClientMouseDoubleClick (MouseInfo mouseInfo,
ModifierKeys modifiers);
- bool OnClientMouseOver (MouseInfo mouseInfo, ModifierKeys
modifiers);
- bool OnClientMouseOut (MouseInfo mouseInfo, ModifierKeys
modifiers);
+ bool OnClientMouseDown (MouseInfo mouseInfo,
ModifierKeys modifiers);
+ bool OnClientMouseUp (MouseInfo mouseInfo,
ModifierKeys modifiers);
+ bool OnClientMouseClick (MouseInfo mouseInfo,
ModifierKeys modifiers);
+ bool OnClientMouseDoubleClick (MouseInfo mouseInfo,
ModifierKeys modifiers);
+ bool OnClientMouseOver (MouseInfo mouseInfo,
ModifierKeys modifiers);
+ bool OnClientMouseOut (MouseInfo mouseInfo,
ModifierKeys modifiers);
- bool OnClientActivate (Int32 detail);
- bool OnClientFocusIn (Int32 detail);
- bool OnClientFocusOut (Int32 detail);
+ bool OnClientActivate ();
+ bool OnClientFocusIn ();
+ bool OnClientFocusOut ();
- bool OnBeforeURIOpen (string URL);
+ bool OnBeforeURIOpen (string URL);
+ void OnFocus ();
+ bool OnCreateNewWindow ();
+
+ /*
+ * Popup dialogs
+ */
- void OnFocus ();
+ void OnAlert (IntPtr title,
IntPtr text);
+ bool OnAlertCheck (IntPtr title,
IntPtr text, IntPtr chkMsg, ref bool chkState);
+ bool OnConfirm (IntPtr title,
IntPtr text);
+ bool OnConfirmCheck (IntPtr title,
IntPtr text, IntPtr chkMsg, ref bool chkState);
- bool OnCreateNewWindow ();
+ bool OnConfirmEx (IntPtr title,
IntPtr text, Mono.WebBrowser.DialogButtonFlags flags,
+
IntPtr title0, IntPtr title1, IntPtr title2,
+
IntPtr chkMsg, ref bool chkState, out Int32 retVal);
- void OnGeneric (IntPtr type);
+ bool OnPrompt (IntPtr title,
IntPtr text,
+
IntPtr chkMsg, ref bool chkState, StringBuilder retVal);
+ bool OnPromptUsernameAndPassword (IntPtr title, IntPtr text,
+
IntPtr chkMsg, ref bool chkState,
+
out IntPtr username, out IntPtr password);
+
+ bool OnPromptPassword (IntPtr title, IntPtr
text,
+
IntPtr chkMsg, ref bool chkState,
+
out IntPtr password);
+
+ bool OnSelect (IntPtr title,
IntPtr text,
+
UInt32 count, IntPtr list,
+
out Int32 retVal);
+
+
+ /*
+ * Generic logging event
+ */
+ void OnGeneric (IntPtr type);
+
}
+
+ [StructLayout (LayoutKind.Sequential)]
+ public struct SizeInfo
+ {
+ public UInt32 width;
+ public UInt32 height;
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ public struct ModifierKeys
+ {
+ public Int32 altKey;
+ public Int32 ctrlKey;
+ public Int32 metaKey;
+ public Int32 shiftKey;
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ public struct MouseInfo
+ {
+ public UInt16 button;
+ public Int32 clientX;
+ public Int32 clientY;
+ public Int32 screenX;
+ public Int32 screenY;
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ public struct KeyInfo
+ {
+ public UInt32 charCode;
+ public UInt32 keyCode;
+ }
+
}
Modified: trunk/mcs/class/Mono.Mozilla/Mono.Mozilla2K5.csproj
===================================================================
--- trunk/mcs/class/Mono.Mozilla/Mono.Mozilla2K5.csproj 2007-09-23 19:39:34 UTC
(rev 86248)
+++ trunk/mcs/class/Mono.Mozilla/Mono.Mozilla2K5.csproj 2007-09-23 23:07:38 UTC
(rev 86249)
@@ -79,7 +79,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="Assembly\AssemblyInfo.cs" />
<Compile Include="Mono.Mozilla\Callback.cs" />
<Compile Include="Mono.Mozilla\ICallback.cs" />
<Compile Include="Mono.WebBrowser\IWebBrowser.cs" />
@@ -89,6 +88,9 @@
<SubType>Component</SubType>
</Compile>
</ItemGroup>
+ <ItemGroup>
+ <None Include="ChangeLog" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
Modified: trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/IWebBrowser.cs
===================================================================
--- trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/IWebBrowser.cs 2007-09-23
19:39:34 UTC (rev 86248)
+++ trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/IWebBrowser.cs 2007-09-23
23:07:38 UTC (rev 86249)
@@ -26,6 +26,8 @@
using System;
using System.Text;
using System.Runtime.InteropServices;
+using System.Collections;
+using System.Collections.Specialized;
namespace Mono.WebBrowser
{
@@ -59,7 +61,7 @@
event EventHandler MouseUp;
event EventHandler Focus;
event CreateNewWindowEventHandler CreateNewWindow;
-
+ event AlertEventHandler Alert;
}
public enum ReloadOption
@@ -76,6 +78,40 @@
FocusLastElement = 2
}
+ [Flags]
+ public enum DialogButtonFlags
+ {
+ BUTTON_POS_0 = 1,
+ BUTTON_POS_1 = 256,
+ BUTTON_POS_2 = 65536,
+ BUTTON_TITLE_OK = 1,
+ BUTTON_TITLE_CANCEL = 2,
+ BUTTON_TITLE_YES = 3,
+ BUTTON_TITLE_NO = 4,
+ BUTTON_TITLE_SAVE = 5,
+ BUTTON_TITLE_DONT_SAVE = 6,
+ BUTTON_TITLE_REVERT = 7,
+ BUTTON_TITLE_IS_STRING = 127,
+ BUTTON_POS_0_DEFAULT = 0,
+ BUTTON_POS_1_DEFAULT = 16777216,
+ BUTTON_POS_2_DEFAULT = 33554432,
+ BUTTON_DELAY_ENABLE = 67108864,
+ STD_OK_CANCEL_BUTTONS = 513
+ }
+
+ public enum DialogType
+ {
+ Alert = 1,
+ AlertCheck = 2,
+ Confirm = 3,
+ ConfirmEx = 4,
+ ConfirmCheck = 5,
+ Prompt = 6,
+ PromptUsernamePassword = 7,
+ PromptPassword = 8,
+ Select = 9
+ }
+
public delegate bool CreateNewWindowEventHandler (object sender,
CreateNewWindowEventArgs e);
public class CreateNewWindowEventArgs : EventArgs
{
@@ -97,5 +133,109 @@
#endregion // Public Instance Properties
}
+
+ public delegate void AlertEventHandler (object sender, AlertEventArgs
e);
+ public class AlertEventArgs : EventArgs
+ {
+ private DialogType type;
+ private string title;
+ private string text;
+
+ private string username;
+ private string password;
+ private string checkMsg;
+ private bool checkState;
+ private DialogButtonFlags dialogButtons;
+
+ private StringCollection buttons;
+ private StringCollection options;
+
+ private object returnValue;
+
+ #region Public Constructors
+ /// <summary>
+ /// void (STDCALL *OnAlert) (const PRUnichar * title, const
PRUnichar * text);
+ /// </summary>
+ /// <param name="title"></param>
+ /// <param name="text"></param>
+ public AlertEventArgs ()
+ : base ()
+ {
+ }
+
+
+#endregion // Public Constructors
+
+ #region Public Instance Properties
+ public string Title {
+ get { return this.title; }
+ set { this.title = value; }
+ }
+ public string Text {
+ get { return this.text; }
+ set { this.text = value; }
+ }
+ public string CheckMessage {
+ get { return this.checkMsg; }
+ set { this.checkMsg = value; }
+ }
+ public bool CheckState {
+ get { return this.checkState; }
+ set { this.checkState = value; }
+ }
+ public DialogButtonFlags DialogButtons {
+ get { return this.dialogButtons; }
+ set { this.dialogButtons = value; }
+ }
+ public StringCollection Buttons {
+ get { return buttons; }
+ set { buttons = value; }
+ }
+ public StringCollection Options {
+ get { return options; }
+ set { options = value; }
+ }
+
+ public string Username {
+ get { return username; }
+ set { username = value; }
+ }
+
+ public string Password {
+ get { return password; }
+ set { password = value; }
+ }
+
+ public bool BoolReturn {
+ get {
+ if (returnValue is bool)
+ return (bool) returnValue;
+ return false;
+ }
+ set { returnValue = value; }
+ }
+
+ public int IntReturn
+ {
+ get {
+ if (returnValue is int)
+ return (int) returnValue;
+ return -1;
+ }
+ set { returnValue = value; }
+ }
+
+ public string StringReturn
+ {
+ get {
+ if (returnValue is string)
+ return (string) returnValue;
+ return String.Empty;
+ }
+ set { returnValue = value; }
+ }
+
+ #endregion // Public Instance Properties
+ }
}
Modified: trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/WebBrowser.cs
===================================================================
--- trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/WebBrowser.cs 2007-09-23
19:39:34 UTC (rev 86248)
+++ trunk/mcs/class/Mono.Mozilla/Mono.WebBrowser/WebBrowser.cs 2007-09-23
23:07:38 UTC (rev 86249)
@@ -211,6 +211,13 @@
add { Events.AddHandler (CreateNewWindowEvent, value); }
remove { Events.RemoveHandler (CreateNewWindowEvent,
value); }
}
+
+ static object AlertEvent = new object ();
+ public event AlertEventHandler Alert
+ {
+ add { Events.AddHandler (AlertEvent, value); }
+ remove { Events.RemoveHandler (AlertEvent, value); }
+ }
#endregion
@@ -262,7 +269,7 @@
// TODO: Add WebBrowser.OnTitleChanged implementation
}
- public void OnShowTooltipWindow (Int32 x, Int32 y, string
tiptext)
+ public void OnShowTooltipWindow (string tiptext, Int32 x, Int32
y)
{
// TODO: Add WebBrowser.OnShowTooltipWindow
implementation
}
@@ -287,7 +294,7 @@
// TODO: Add WebBrowser.OnStateSpecial implementation
}
- public void OnStateChange (string URI, UInt32 stateFlags, Int32
status)
+ public void OnStateChange (string URI, Int32 status, UInt32
stateFlags)
{
// TODO: Add WebBrowser.OnStateChange implementation
}
@@ -307,7 +314,7 @@
// TODO: Add WebBrowser.OnLocationChanged
implementation
}
- public void OnStatusChange (Int32 status, string message)
+ public void OnStatusChange (string message, Int32 status)
{
// TODO: Add WebBrowser.OnStatusChange implementation
}
@@ -421,19 +428,19 @@
return false;
}
- public bool OnClientActivate (Int32 detail)
+ public bool OnClientActivate ()
{
// TODO: Add WebBrowser.OnClientActivate implementation
return false;
}
- public bool OnClientFocusIn (Int32 detail)
+ public bool OnClientFocusIn ()
{
// TODO: Add WebBrowser.OnClientFocusIn implementation
return false;
}
- public bool OnClientFocusOut (Int32 detail)
+ public bool OnClientFocusOut ()
{
// TODO: Add WebBrowser.OnClientFocusOut implementation
return false;
@@ -465,6 +472,168 @@
return ret;
}
+ public void OnAlert (IntPtr title, IntPtr text)
+ {
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ eh (this, e);
+ }
+ }
+
+ public bool OnAlertCheck (IntPtr title, IntPtr text, IntPtr
chkMsg, ref bool chkState)
+ {
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ if (chkMsg != IntPtr.Zero)
+ e.CheckMessage = Marshal.PtrToStringUni
(chkMsg);
+ e.CheckState = chkState;
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+ public bool OnConfirm (IntPtr title, IntPtr text)
+ {
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+ public bool OnConfirmCheck (IntPtr title, IntPtr text, IntPtr
chkMsg, ref bool chkState)
+ {
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ if (chkMsg != IntPtr.Zero)
+ e.CheckMessage = Marshal.PtrToStringUni
(chkMsg);
+ e.CheckState = chkState;
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+ public bool OnConfirmEx (IntPtr title, IntPtr text,
DialogButtonFlags flags,
+ IntPtr title0,
IntPtr title1, IntPtr title2,
+ IntPtr chkMsg,
ref bool chkState, out Int32 retVal)
+ {
+ retVal = -1;
+
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ if (chkMsg != IntPtr.Zero)
+ e.CheckMessage = Marshal.PtrToStringUni
(chkMsg);
+ e.CheckState = chkState;
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+ public bool OnPrompt (IntPtr title, IntPtr text, IntPtr chkMsg,
ref bool chkState, StringBuilder retVal)
+ {
+ retVal = new StringBuilder();
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ if (chkMsg != IntPtr.Zero)
+ e.CheckMessage = Marshal.PtrToStringUni
(chkMsg);
+ e.CheckState = chkState;
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+ public bool OnPromptUsernameAndPassword (IntPtr title, IntPtr
text, IntPtr chkMsg, ref bool chkState, out IntPtr username, out IntPtr
password)
+ {
+ username = IntPtr.Zero;
+ password = IntPtr.Zero;
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ if (chkMsg != IntPtr.Zero)
+ e.CheckMessage = Marshal.PtrToStringUni
(chkMsg);
+ e.CheckState = chkState;
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+ public bool OnPromptPassword (IntPtr title, IntPtr text, IntPtr
chkMsg, ref bool chkState, out IntPtr password)
+ {
+ password = IntPtr.Zero;
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ if (chkMsg != IntPtr.Zero)
+ e.CheckMessage = Marshal.PtrToStringUni
(chkMsg);
+ e.CheckState = chkState;
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+ public bool OnSelect (IntPtr title, IntPtr text, uint count,
IntPtr list, out int retVal)
+ {
+ retVal = 0;
+ AlertEventHandler eh = (AlertEventHandler)
(Events[AlertEvent]);
+ if (eh != null) {
+ AlertEventArgs e = new AlertEventArgs ();
+ if (title != IntPtr.Zero)
+ e.Title = Marshal.PtrToStringUni
(title);
+ if (text != IntPtr.Zero)
+ e.Text = Marshal.PtrToStringUni (text);
+ eh (this, e);
+ return e.BoolReturn;
+ }
+ return false;
+ }
+
+
+
public void OnGeneric (IntPtr type)
{
string t = Marshal.PtrToStringUni (type);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches