Author: andreia
Date: 2007-10-06 20:23:13 -0400 (Sat, 06 Oct 2007)
New Revision: 87040
Added:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/AlertCheck.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ConfirmCheck.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Generic.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Prompt.cs
Modified:
trunk/mcs/class/Managed.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/SWF2k5.csproj
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs
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
trunk/mcs/class/Managed.Windows.Forms/build-csproj2k5
Log:
2007-10-07 Andreia Gaita <[EMAIL PROTECTED]>
* System.Windows.Forms.dll.sources: Added WebBrowserDialogs
* build-csproj2k5: added reference to mono.mozilla
* SWF2K5.csproj: Updated project files
* HtmlDocument.cs, HtmlElement.cs, WebBrowser.cs: Added dom support
* WebBrowserBase.cs: Added dialog support, calling the
WebBrowserDialogs classes for each specific dialog type.
System.Windows.Forms.WebBrowserDialogs:
* Added webbrowser dialog implementations.
Generic is a generic form with a table layout and
methods for adding buttons, labels, checkboxes and
textboxes. The other classes inherit from Generic,
and call up to add the needed fields for each specific
dialog.
Modified: trunk/mcs/class/Managed.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/ChangeLog 2007-10-06 23:53:08 UTC
(rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/ChangeLog 2007-10-07 00:23:13 UTC
(rev 87040)
@@ -1,3 +1,9 @@
+2007-10-07 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * System.Windows.Forms.dll.sources: Added WebBrowserDialogs
+ * build-csproj2k5: added reference to mono.mozilla
+ * SWF2K5.csproj: Updated project files
+
2007-10-04 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* System.Windows.Forms_test.dll.sources: Added TreeViewEventsTest.cs.
Modified: trunk/mcs/class/Managed.Windows.Forms/SWF2k5.csproj
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/SWF2k5.csproj 2007-10-06 23:53:08 UTC
(rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/SWF2k5.csproj 2007-10-07 00:23:13 UTC
(rev 87040)
@@ -192,6 +192,10 @@
<Compile Include="System.Windows.Forms.RTF\TextMap.cs" />
<Compile Include="System.Windows.Forms.RTF\TokenClass.cs" />
<Compile
Include="System.Windows.Forms.Theming\Default\RadioButtonPainter.cs" />
+ <Compile Include="System.Windows.Forms.WebBrowserDialogs\AlertCheck.cs" />
+ <Compile Include="System.Windows.Forms.WebBrowserDialogs\ConfirmCheck.cs"
/>
+ <Compile Include="System.Windows.Forms.WebBrowserDialogs\Prompt.cs" />
+ <Compile Include="System.Windows.Forms.WebBrowserDialogs\Generic.cs" />
<Compile Include="System.Windows.Forms\AccessibleEvents.cs" />
<Compile Include="System.Windows.Forms\AccessibleNavigation.cs" />
<Compile Include="System.Windows.Forms\AccessibleObject.cs" />
@@ -508,9 +512,14 @@
<Compile Include="System.Windows.Forms\HtmlDocument.cs" />
<Compile Include="System.Windows.Forms\HtmlElement.cs" />
<Compile Include="System.Windows.Forms\HtmlElementCollection.cs" />
+ <Compile Include="System.Windows.Forms\HtmlElementErrorEventArgs.cs" />
+ <Compile Include="System.Windows.Forms\HtmlElementErrorEventHandler.cs" />
<Compile Include="System.Windows.Forms\HtmlElementEventArgs.cs" />
<Compile Include="System.Windows.Forms\HtmlElementEventHandler.cs" />
<Compile Include="System.Windows.Forms\HtmlElementInsertionOrientation.cs"
/>
+ <Compile Include="System.Windows.Forms\HtmlHistory.cs" />
+ <Compile Include="System.Windows.Forms\HtmlWindow.cs" />
+ <Compile Include="System.Windows.Forms\HtmlWindowCollection.cs" />
<Compile Include="System.Windows.Forms\Hwnd.cs" />
<Compile Include="System.Windows.Forms\IButtonControl.cs" />
<Compile Include="System.Windows.Forms\IBindableComponent.cs" />
@@ -585,6 +594,7 @@
<Compile
Include="System.Windows.Forms\LinkLabelLinkClickedEventHandler.cs" />
<Compile Include="System.Windows.Forms\LinkState.cs" />
<Compile Include="System.Windows.Forms\ListBindingConverter.cs" />
+ <Compile Include="System.Windows.Forms\ListBindingHelper.cs" />
<Compile Include="System.Windows.Forms\ListBox.cs" />
<Compile Include="System.Windows.Forms\ListControl.cs" />
<Compile Include="System.Windows.Forms\ListControlConvertEventArgs.cs" />
@@ -603,6 +613,7 @@
<Compile
Include="System.Windows.Forms\ListViewItemSelectionChangedEventArgs.cs" />
<Compile
Include="System.Windows.Forms\ListViewItemSelectionChangedEventHandler.cs" />
<Compile Include="System.Windows.Forms\ListViewItemStates.cs" />
+ <Compile Include="System.Windows.Forms\ListViewVirtualItems.cs" />
<Compile
Include="System.Windows.Forms\ListViewVirtualItemsSelectionRangeChangedEventArgs.cs"
/>
<Compile
Include="System.Windows.Forms\ListViewVirtualItemsSelectionRangeChangedEventHandler.cs"
/>
<Compile Include="System.Windows.Forms\MWFCategoryAttribute.cs" />
@@ -934,6 +945,8 @@
<Compile Include="System.Windows.Forms\WebBrowserRefreshOption.cs" />
<Compile Include="System.Windows.Forms\WebBrowserSiteBase.cs" />
<Compile Include="System.Windows.Forms\Win32DnD.cs" />
+ <Compile Include="System.Windows.Forms\WindowsFormsSection.cs" />
+ <Compile
Include="System.Windows.Forms\WindowsFormsSynchronizationContext.cs" />
<Compile Include="System.Windows.Forms\X11DesktopColors.cs" />
<Compile Include="System.Windows.Forms\X11Dnd.cs" />
<Compile Include="System.Windows.Forms\X11Keyboard.cs" />
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-10-06 23:53:08 UTC (rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-10-07 00:23:13 UTC (rev 87040)
@@ -1,3 +1,9 @@
+2007-10-07 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * HtmlDocument.cs, HtmlElement.cs, WebBrowser.cs: Added dom support
+ * WebBrowserBase.cs: Added dialog support, calling the
+ WebBrowserDialogs classes for each specific dialog type.
+
2007-10-06 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* ListView.cs: When the last item is focused and is removed,
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs
2007-10-06 23:53:08 UTC (rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlDocument.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -25,25 +25,166 @@
#if NET_2_0
using System;
+using System.Drawing;
namespace System.Windows.Forms
{
[MonoTODO ("Needs Implementation")]
public sealed class HtmlDocument
{
+ Mono.WebBrowser.IWebBrowser webHost;
+ internal HtmlDocument (Mono.WebBrowser.IWebBrowser webHost)
+ {
+ this.webHost = webHost;
+ }
+
#region Methods
+
+
+ public void AttachEventHandler (string eventName, EventHandler
eventHandler)
+ { }
+
+ public HtmlElement CreateElement (string elementTag)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void DetachEventHandler (string eventName, EventHandler
eventHandler)
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public void ExecCommand (string command, bool showUI, Object
value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Focus ()
+ {
+ throw new NotImplementedException ();
+ }
+
public HtmlElement GetElementById (string id)
{
- return new HtmlElement ();
+ return new HtmlElement (webHost.Document.getElementById
(id));
}
+
+ public HtmlElement GetElementFromPoint (Point point)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public HtmlElementCollection GetElementsByTagName (string
tagName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public Object InvokeScript (string scriptName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Object InvokeScript (string scriptName, Object[] args)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public HtmlDocument OpenNew (bool replaceInHistory)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Write (string text)
+ {
+ throw new NotImplementedException ();
+ }
+
#endregion
#region Properties
[MonoTODO ("Needs Implementation")]
+
+ public HtmlElement ActiveElement
+ {
+ get { throw new NotImplementedException (); }
+ }
+ public Color ActiveLinkColor {
+ get { throw new NotImplementedException ();}
+ set { throw new NotImplementedException (); }
+ }
+
public HtmlElementCollection All
{
get { throw new NotImplementedException (); }
}
+
+ public Color BackColor
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public HtmlElement Body {
+ get {
+ return new HtmlElement (webHost.Document.Body);
+ }
+ set { throw new NotImplementedException (); }
+ }
+ public string Cookie
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public string DefaultEncoding { get { throw new
NotImplementedException (); } }
+ public string Domain
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public Object DomDocument { get { throw new
NotImplementedException (); } }
+ public string Encoding
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public bool Focused { get { throw new NotImplementedException
(); } }
+ public Color ForeColor
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public HtmlElementCollection Forms { get { throw new
NotImplementedException (); } }
+ public HtmlElementCollection Images { get { throw new
NotImplementedException (); } }
+ public Color LinkColor
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public HtmlElementCollection Links { get { throw new
NotImplementedException (); } }
+ public bool RightToLeft
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public string Title
+ {
+ get { return webHost.Document.Title; }
+ set { webHost.Document.Title = value; }
+ }
+ public Uri Url { get { throw new NotImplementedException (); } }
+ public Color VisitedLinkColor
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ public HtmlWindow Window { get { throw new
NotImplementedException (); } }
+
+
#endregion
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlElement.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlElement.cs
2007-10-06 23:53:08 UTC (rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/HtmlElement.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -25,14 +25,17 @@
#if NET_2_0
using System;
+using Mono.WebBrowser.DOM;
namespace System.Windows.Forms
{
[MonoTODO ("Needs Implementation")]
public sealed class HtmlElement
{
- internal HtmlElement ()
+ private IDOMHTMLElement element;
+ internal HtmlElement (IDOMHTMLElement element)
{
+ this.element = element;
}
#region Properties
@@ -52,7 +55,7 @@
[MonoTODO ("Needs Implementation")]
public string InnerText
{
- get { return String.Empty; }
+ get { return this.element.InnerText; }
set { throw new NotImplementedException (); }
}
#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-10-06 23:53:08 UTC (rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowser.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -50,6 +50,8 @@
private string statusText;
private bool webBrowserShortcutsEnabled;
+ private HtmlDocument document;
+
#region Public Properties
[MonoTODO ("Stub, not implemented")]
@@ -80,7 +82,11 @@
[MonoTODO ("Stub, not implemented")]
public HtmlDocument Document {
- get { throw new NotImplementedException (); }
+ get {
+ if (document == null)
+ document = new HtmlDocument
(this.WebHost);
+ return document;
+ }
}
[MonoTODO ("Stub, not implemented")]
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs
2007-10-06 23:53:08 UTC (rev 87039)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/WebBrowserBase.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -276,12 +276,8 @@
private State state;
private Mono.WebBrowser.IWebBrowser webHost;
- internal Mono.WebBrowser.IWebBrowser WebHost
- {
- get
- {
- return webHost;
- }
+ internal Mono.WebBrowser.IWebBrowser WebHost {
+ get { return webHost; }
}
protected override void SetBoundsCore (int x, int y, int width,
int height, BoundsSpecified specified)
@@ -301,10 +297,55 @@
webHost.MouseClick += new EventHandler
(OnWebHostMouseClick);
webHost.Focus += new EventHandler (OnWebHostFocus);
webHost.CreateNewWindow += new
Mono.WebBrowser.CreateNewWindowEventHandler (OnWebHostCreateNewWindow);
+ webHost.Alert += new Mono.WebBrowser.AlertEventHandler
(OnWebHostAlert);
}
+ void OnWebHostAlert (object sender,
Mono.WebBrowser.AlertEventArgs e)
+ {
+ switch (e.Type) {
+ case Mono.WebBrowser.DialogType.Alert:
+ MessageBox.Show (e.Text, e.Title);
+ break;
+ case Mono.WebBrowser.DialogType.AlertCheck:
+ WebBrowserDialogs.AlertCheck form1 =
new WebBrowserDialogs.AlertCheck (e.Title, e.Text, e.CheckMessage,
e.CheckState);
+ form1.Show ();
+ e.CheckState = form1.Checked;
+ e.BoolReturn = true;
+ break;
+ case Mono.WebBrowser.DialogType.Confirm:
+ DialogResult r1 = MessageBox.Show
(e.Text, e.Title, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
+ e.BoolReturn = (r1 == DialogResult.OK);
+ break;
+ case Mono.WebBrowser.DialogType.ConfirmCheck:
+ WebBrowserDialogs.ConfirmCheck form2 =
new WebBrowserDialogs.ConfirmCheck (e.Title, e.Text, e.CheckMessage,
e.CheckState);
+ DialogResult r2 = form2.Show ();
+ e.CheckState = form2.Checked;
+ e.BoolReturn = (r2 == DialogResult.OK);
+ break;
+ case Mono.WebBrowser.DialogType.ConfirmEx:
+ MessageBox.Show (e.Text, e.Title);
+ break;
+ case Mono.WebBrowser.DialogType.Prompt:
+ WebBrowserDialogs.Prompt form4 = new
WebBrowserDialogs.Prompt (e.Title, e.Text, e.Text2);
+ DialogResult r4 = form4.Show ();
+ e.StringReturn = form4.Text;
+ e.BoolReturn = (r4 == DialogResult.OK);
+ break;
+ case Mono.WebBrowser.DialogType.PromptPassword:
+ MessageBox.Show (e.Text, e.Title);
+ break;
+ case
Mono.WebBrowser.DialogType.PromptUsernamePassword:
+ MessageBox.Show (e.Text, e.Title);
+ break;
+ case Mono.WebBrowser.DialogType.Select:
+ MessageBox.Show (e.Text, e.Title);
+ break;
+ }
+
+ }
+
#region Events raised by the embedded web browser
bool OnWebHostCreateNewWindow (object sender,
Mono.WebBrowser.CreateNewWindowEventArgs e)
{
Added:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/AlertCheck.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/AlertCheck.cs
2007-10-06 23:53:08 UTC (rev 87039)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/AlertCheck.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -0,0 +1,69 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc.
+//
+// Authors:
+// Andreia Gaita <[EMAIL PROTECTED]>
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace System.Windows.Forms.WebBrowserDialogs
+{
+ internal class AlertCheck : Generic
+ {
+ private bool check;
+ public bool Checked {
+ get { return check; }
+ }
+
+ public AlertCheck (string title, string text, string
checkMessage, bool checkState)
+ : base (title)
+ {
+ InitTable (3, 1);
+
+ AddLabel (0, 0, 0, text, -1, -1);
+ AddCheck (1, 0, 0, checkMessage, checkState, -1, -1,
new EventHandler (CheckedChanged));
+ AddButton (2, 0, 0, "OK", -1, -1, true, false, new
EventHandler (OkClick));
+ }
+
+ private void OkClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close ();
+ }
+
+ private void CheckedChanged (object sender, EventArgs e)
+ {
+ CheckBox c = sender as CheckBox;
+ check = c.Checked;
+ }
+
+ public DialogResult Show ()
+ {
+ return this.RunDialog ();
+
+ }
+ }
+}
+#endif
\ No newline at end of file
Added:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ChangeLog
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ChangeLog
2007-10-06 23:53:08 UTC (rev 87039)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ChangeLog
2007-10-07 00:23:13 UTC (rev 87040)
@@ -0,0 +1,8 @@
+2007-10-07 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * Added webbrowser dialog implementations.
+ Generic is a generic form with a table layout and
+ methods for adding buttons, labels, checkboxes and
+ textboxes. The other classes inherit from Generic,
+ and call up to add the needed fields for each specific
+ dialog.
\ No newline at end of file
Added:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ConfirmCheck.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ConfirmCheck.cs
2007-10-06 23:53:08 UTC (rev 87039)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/ConfirmCheck.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -0,0 +1,77 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc.
+//
+// Authors:
+// Andreia Gaita <[EMAIL PROTECTED]>
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace System.Windows.Forms.WebBrowserDialogs
+{
+ internal class ConfirmCheck : Generic
+ {
+ private bool check;
+ public bool Checked
+ {
+ get { return check; }
+ }
+
+ public ConfirmCheck (string title, string text, string
checkMessage, bool checkState)
+ : base (title)
+ {
+ InitTable (3, 2);
+
+ AddLabel (0, 0, 2, text, -1, -1);
+ AddCheck (1, 0, 2, checkMessage, checkState, -1, -1,
new EventHandler (CheckedChanged));
+ AddButton (2, 0, 0, Locale.GetText ("OK"), -1, -1,
true, false, new EventHandler (OkClick));
+ AddButton (2, 1, 0, Locale.GetText ("Cancel"), -1, -1,
false, true, new EventHandler (CancelClick));
+ }
+
+ private void OkClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close ();
+ }
+
+ private void CancelClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close ();
+ }
+
+ private void CheckedChanged (object sender, EventArgs e)
+ {
+ CheckBox c = sender as CheckBox;
+ check = c.Checked;
+ }
+
+ public DialogResult Show ()
+ {
+ return this.RunDialog ();
+
+ }
+ }
+}
+#endif
\ No newline at end of file
Added:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Generic.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Generic.cs
2007-10-06 23:53:08 UTC (rev 87039)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Generic.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -0,0 +1,188 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc.
+//
+// Authors:
+// Andreia Gaita <[EMAIL PROTECTED]>
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace System.Windows.Forms.WebBrowserDialogs
+{
+ internal class Generic : Form
+ {
+ TableLayoutPanel table;
+
+ public Generic (string title)
+ {
+ this.SuspendLayout ();
+ this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSize = true;
+ this.ControlBox = true;
+ this.MinimizeBox = false;
+ this.MaximizeBox = false;
+ this.ShowInTaskbar = (Owner == null);
+ this.FormBorderStyle = FormBorderStyle.FixedDialog;
+
+ table = new TableLayoutPanel ();
+ table.SuspendLayout ();
+ table.AutoSize = true;
+ this.Controls.Add (table);
+
+ this.Text = title;
+ }
+
+ private void InitSize ()
+ {
+ }
+
+ protected void InitTable (int rows, int cols)
+ {
+ table.ColumnCount = cols;
+ for (int i = 0; i < cols; i++)
+ table.ColumnStyles.Add (new ColumnStyle ());
+ table.RowCount = rows;
+ for (int i = 0; i < rows; i++)
+ table.RowStyles.Add (new RowStyle ());
+ }
+
+ protected void AddLabel (int row, int col, int colspan, string
text, int width, int height)
+ {
+ Label ctl = new Label ();
+ ctl.Text = text;
+ if (width == -1 && height == -1)
+ ctl.AutoSize = true;
+ else {
+ ctl.Width = width;
+ ctl.Height = height;
+ }
+ table.Controls.Add (ctl, col, row);
+ if (colspan > 1)
+ table.SetColumnSpan (ctl, colspan);
+ }
+
+ protected void AddButton (int row, int col, int colspan, string
text, int width, int height, bool isAccept, bool isCancel, EventHandler onClick)
+ {
+ Button ctl = new Button ();
+ ctl.Text = text;
+ if (width == -1 && height == -1) {
+ //SizeF s = TextRenderer.MeasureString (text,
ctl.Font);
+ //ctl.Width = (int) ((float) s.Width / 62f);
+ //ctl.Height = (int)s.Height;
+ } else {
+ ctl.Width = width;
+ ctl.Height = height;
+ }
+
+ if (onClick != null)
+ ctl.Click += onClick;
+ if (isAccept)
+ AcceptButton = ctl;
+ if (isCancel)
+ CancelButton = ctl;
+ table.Controls.Add (ctl, col, row);
+ if (colspan > 1)
+ table.SetColumnSpan (ctl, colspan);
+ }
+
+ protected void AddCheck (int row, int col, int colspan, string
text, bool check, int width, int height, EventHandler onCheck)
+ {
+ CheckBox ctl = new CheckBox ();
+ ctl.Text = text;
+ ctl.Checked = check;
+
+ if (width == -1 && height == -1) {
+ SizeF s = TextRenderer.MeasureString (text,
ctl.Font);
+ ctl.Width += (int) ((float) s.Width / 62f);
+ if (s.Height > ctl.Height)
+ ctl.Height = (int) s.Height;
+ } else {
+ ctl.Width = width;
+ ctl.Height = height;
+ }
+
+ if (onCheck != null)
+ ctl.CheckedChanged += onCheck;
+
+ table.Controls.Add (ctl, col, row);
+ if (colspan > 1)
+ table.SetColumnSpan (ctl, colspan);
+ }
+
+ protected void AddText (int row, int col, int colspan, string
text, int width, int height, EventHandler onText)
+ {
+ TextBox ctl = new TextBox ();
+ ctl.Text = text;
+
+ if (width > -1)
+ ctl.Width = width;
+ if (height > -1)
+ ctl.Height = height;
+
+ if (onText != null)
+ ctl.TextChanged += onText;
+
+ table.Controls.Add (ctl, col, row);
+ if (colspan > 1)
+ table.SetColumnSpan (ctl, colspan);
+ }
+
+ protected void AddPassword (int row, int col, int colspan,
string text, int width, int height, EventHandler onText)
+ {
+ TextBox ctl = new TextBox ();
+ ctl.PasswordChar = '*';
+ ctl.Text = text;
+
+ if (width > -1)
+ ctl.Width = width;
+ if (height > -1)
+ ctl.Height = height;
+
+ if (onText != null)
+ ctl.TextChanged += onText;
+
+ table.Controls.Add (ctl, col, row);
+ if (colspan > 1)
+ table.SetColumnSpan (ctl, colspan);
+ }
+
+ protected DialogResult RunDialog ()
+ {
+ this.StartPosition = FormStartPosition.CenterScreen;
+
+ InitSize ();
+
+ table.ResumeLayout (false);
+ table.PerformLayout ();
+ this.ResumeLayout (false);
+ this.PerformLayout ();
+
+ this.ShowDialog ();
+
+ return this.DialogResult;
+ }
+ }
+}
+#endif
\ No newline at end of file
Added:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Prompt.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Prompt.cs
2007-10-06 23:53:08 UTC (rev 87039)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.WebBrowserDialogs/Prompt.cs
2007-10-07 00:23:13 UTC (rev 87040)
@@ -0,0 +1,70 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Novell, Inc.
+//
+// Authors:
+// Andreia Gaita <[EMAIL PROTECTED]>
+
+#if NET_2_0
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace System.Windows.Forms.WebBrowserDialogs
+{
+ internal class Prompt : Generic
+ {
+ private string text;
+ public string Text
+ {
+ get { return text; }
+ }
+
+ public Prompt (string title, string message, string text)
+ : base (title)
+ {
+ InitTable (3, 1);
+
+ AddLabel (0, 0, 0, message, -1, -1);
+ AddText (1, 0, 0, text, -1, -1, new EventHandler
(onText));
+ AddButton (2, 0, 0, Locale.GetText ("OK"), -1, -1,
true, false, new EventHandler (OkClick));
+ }
+
+ private void OkClick (object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close ();
+ }
+
+ private void onText (object sender, EventArgs e)
+ {
+ TextBox c = sender as TextBox;
+ text = c.Text;
+ }
+
+ public DialogResult Show ()
+ {
+ return this.RunDialog ();
+
+ }
+ }
+}
+#endif
\ No newline at end of file
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
2007-10-06 23:53:08 UTC (rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
2007-10-07 00:23:13 UTC (rev 87040)
@@ -870,6 +870,10 @@
System.Windows.Forms.VisualStyles/VisualStyleInformation.cs
System.Windows.Forms.VisualStyles/VisualStyleRenderer.cs
System.Windows.Forms.VisualStyles/VisualStyleState.cs
+System.Windows.Forms.WebBrowserDialogs/AlertCheck.cs
+System.Windows.Forms.WebBrowserDialogs/ConfirmCheck.cs
+System.Windows.Forms.WebBrowserDialogs/Generic.cs
+System.Windows.Forms.WebBrowserDialogs/Prompt.cs
System.Windows.Forms.X11Internal/X11Atoms.cs
System.Windows.Forms.X11Internal/X11Display.cs
System.Windows.Forms.X11Internal/X11Exception.cs
Modified: trunk/mcs/class/Managed.Windows.Forms/build-csproj2k5
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/build-csproj2k5 2007-10-06
23:53:08 UTC (rev 87039)
+++ trunk/mcs/class/Managed.Windows.Forms/build-csproj2k5 2007-10-07
00:23:13 UTC (rev 87040)
@@ -149,6 +149,9 @@
<Reference Include="System.Xml">
<Name>System.Xml</Name>
</Reference>
+ <Reference Include="Mono.Mozilla2K5">
+ <Name>Mono.Mozilla2K5</Name>
+ </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mono.Mozilla\Mono.Mozilla2K5.csproj">
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches