Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
// 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 <avidigal@novell.com>
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;
}
}
}

View File

@@ -0,0 +1,13 @@
2007-10-30 Andreia Gaita <avidigal@novell.com>
* AlertCheck.cs, ConfirmCheck.cs, Generic.cs, Prompt.cs:
Fix warnings
2007-10-07 Andreia Gaita <avidigal@novell.com>
* 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.

View File

@@ -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 <avidigal@novell.com>
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;
}
}
}

View File

@@ -0,0 +1,191 @@
// 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 <avidigal@novell.com>
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;
}
public new DialogResult Show ()
{
return this.RunDialog ();
}
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;
}
}
}

View File

@@ -0,0 +1,62 @@
// 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 <avidigal@novell.com>
using System;
using System.Collections.Generic;
using System.Text;
namespace System.Windows.Forms.WebBrowserDialogs
{
internal class Prompt : Generic
{
private string text;
public new 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;
}
}
}