Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -192,7 +192,7 @@ namespace System.Windows.Forms.Theming.Default
defaultFormatting.Alignment = StringAlignment.Near;
defaultFormatting.LineAlignment = StringAlignment.Center;
defaultFormatting.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.NoClip;
defaultFormatting.HotkeyPrefix = HotkeyPrefix.Show;
defaultFormatting.HotkeyPrefix = HotkeyPrefix.None;
borderThickness = new Rectangle (1, 1, 2, 2);
}

View File

@@ -1 +1 @@
d9fff17a8968e5c1dcabf968910a4d3cbfeeee71
c92b7a7aae3d0a8d64af67e50cff065c9d7f8009

View File

@@ -1 +1 @@
b37f046211082c8614dd342c09dcaac727f0e978
c9d782df295927cc7e4f189dacac0849b5b177a2

View File

@@ -356,6 +356,7 @@ namespace System.Windows.Forms
{
DataGridViewRow row = (DataGridViewRow)MemberwiseClone ();
row.DefaultCellStyle = (DataGridViewCellStyle)DefaultCellStyle.Clone ();
row.HeaderCell = (DataGridViewRowHeaderCell)HeaderCell.Clone ();
row.SetIndex (-1);

View File

@@ -26,7 +26,9 @@
// NOT COMPLETE
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Windows.Forms {
public sealed class InputLanguage {
@@ -37,6 +39,15 @@ namespace System.Windows.Forms {
private static InputLanguage current_input;
private static InputLanguage default_input;
#region user32.dll functions
[DllImport("user32", CharSet = CharSet.Auto)]
private static extern IntPtr GetKeyboardLayout(UInt32 idThread);
[DllImport("user32", CharSet = CharSet.Auto)]
private static extern Int32 GetKeyboardLayoutList(Int32 nBuff, IntPtr[] lpList);
#endregion // user32.dll functions
#region Private Constructor
[MonoInternalNote ("Pull Microsofts InputLanguages and enter them here")]
internal InputLanguage()
@@ -75,9 +86,23 @@ namespace System.Windows.Forms {
public static InputLanguageCollection InstalledInputLanguages {
get {
if (all == null)
all = new InputLanguageCollection (new InputLanguage[] { new InputLanguage (IntPtr.Zero, new CultureInfo(string.Empty), "US") });
if (all == null) {
List<InputLanguage> inputLanguageList = new List<InputLanguage>();
if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
var keyboardLayoutCount = GetKeyboardLayoutList (0, null);
var keyboardLayoutIds = new IntPtr[keyboardLayoutCount];
GetKeyboardLayoutList (keyboardLayoutCount, keyboardLayoutIds);
foreach (var keyboardLayoutId in keyboardLayoutIds) {
var languageId = (Int32)keyboardLayoutId & 0xFFFF;
CultureInfo cultureInfo = CultureInfo.GetCultureInfo (languageId);
inputLanguageList.Add (new InputLanguage (IntPtr.Zero, cultureInfo, cultureInfo.Name));
}
}
if (inputLanguageList.Count == 0)
inputLanguageList.Add (new InputLanguage (IntPtr.Zero, new CultureInfo(string.Empty), "US"));
all = new InputLanguageCollection (inputLanguageList.ToArray());
}
return all;
}
}

View File

@@ -1 +1 @@
4478f6741047fea9bc94ba4f52a367717235831f
a8854afd6ef1ce1b4375a4d60e8223087d1330a8

View File

@@ -84,15 +84,23 @@ namespace System.Windows.Forms
header_alignment = (HorizontalAlignment)info.GetInt32("HeaderAlignment");
tag = info.GetValue("Tag", typeof(object));
int count = info.GetInt32("ListViewItemCount");
if (count > 0) {
if(items == null)
items = new ListView.ListViewItemCollection(list_view_owner);
int count = 0;
try {
count = info.GetInt32("ItemsCount");
} catch (SerializationException e) {
// Mono backwards compat
try {
count = info.GetInt32("ListViewItemCount");
} catch (SerializationException e2) {}
}
for (int i = 0; i < count; i++)
{
items.Add((ListViewItem)info.GetValue(string.Format("ListViewItem_{0}", i), typeof(ListViewItem)));
}
if (items == null) {
items = new ListView.ListViewItemCollection(list_view_owner);
}
for (int i = 0; i < count; i++)
{
items.Add((ListViewItem)info.GetValue(string.Format("ListViewItem_{0}", i), typeof(ListViewItem)));
}
}

View File

@@ -531,10 +531,12 @@ namespace System.Windows.Forms
public new string [] Lines {
get {
string text = Text;
if (!is_empty_mask)
text = provider.ToDisplayString ();
if (text == null || text == string.Empty)
return new string [] {};
return Text.Split (new string [] {"\r\n", "\r", "\n"}, StringSplitOptions.None);
return text.Split (new string [] {"\r\n", "\r", "\n"}, StringSplitOptions.None);
}
set {
// Do nothing, not supported by MTB.

View File

@@ -566,11 +566,13 @@ namespace System.Windows.Forms
internal void OnExpandItem (GridEntry item)
{
property_grid_view.ExpandItem (item);
OnExpandedItemChanged (EventArgs.Empty);
}
internal void OnCollapseItem (GridEntry item)
{
property_grid_view.CollapseItem (item);
OnExpandedItemChanged (EventArgs.Empty);
}
internal DialogResult ShowError (string text)
@@ -1081,7 +1083,7 @@ namespace System.Windows.Forms
if (eh != null)
eh (this, e);
}
protected virtual void OnPropertyTabChanged (PropertyTabChangedEventArgs e)
{
PropertyTabChangedEventHandler eh = (PropertyTabChangedEventHandler)(Events [PropertyTabChangedEvent]);
@@ -1119,6 +1121,13 @@ namespace System.Windows.Forms
base.OnVisibleChanged (e);
}
protected void OnExpandedItemChanged (EventArgs e)
{
EventHandler eh = (EventHandler)(Events [ExpandedItemChangedEvent]);
if (eh != null)
eh (this, e);
}
protected override bool ProcessDialogKey (Keys keyData) {
return base.ProcessDialogKey (keyData);
}
@@ -1140,6 +1149,7 @@ namespace System.Windows.Forms
static object PropertyValueChangedEvent = new object ();
static object SelectedGridItemChangedEvent = new object ();
static object SelectedObjectsChangedEvent = new object ();
static object ExpandedItemChangedEvent = new object ();
public event EventHandler PropertySortChanged {
add { Events.AddHandler (PropertySortChangedEvent, value); }
@@ -1165,6 +1175,12 @@ namespace System.Windows.Forms
add { Events.AddHandler (SelectedObjectsChangedEvent, value); }
remove { Events.RemoveHandler (SelectedObjectsChangedEvent, value); }
}
// UIA Framework Note: Used to track changes of expanded state of grid items
internal event EventHandler ExpandedItemChanged {
add { Events.AddHandler (ExpandedItemChangedEvent, value); }
remove { Events.RemoveHandler (ExpandedItemChangedEvent, value); }
}
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]

View File

@@ -443,7 +443,7 @@ namespace System.Windows.Forms
InvalidateDirty ();
// UIA Framework: Generate UIA Event to indicate LargeChange change
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.LargeIncrement, value));
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.LargeIncrement, value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
}
}
@@ -460,7 +460,7 @@ namespace System.Windows.Forms
maximum = value;
// UIA Framework: Generate UIA Event to indicate Maximum change
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.Last, value));
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.Last, value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
if (maximum < minimum)
minimum = maximum;
@@ -534,7 +534,7 @@ namespace System.Windows.Forms
minimum = value;
// UIA Framework: Generate UIA Event to indicate Minimum change
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.First, value));
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.First, value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
if (minimum > maximum)
maximum = minimum;
@@ -561,7 +561,7 @@ namespace System.Windows.Forms
InvalidateDirty ();
// UIA Framework: Generate UIA Event to indicate SmallChange change
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.SmallIncrement, value));
OnUIAValueChanged (new ScrollEventArgs (ScrollEventType.SmallIncrement, value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
}
}
@@ -768,18 +768,18 @@ namespace System.Windows.Forms
ScrollEventArgs event_args;
int pos = Math.Min (MaximumAllowed, position + large_change);
event_args = new ScrollEventArgs (ScrollEventType.LargeIncrement, pos);
event_args = new ScrollEventArgs (ScrollEventType.LargeIncrement, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value);
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
// UIA Framework event invoked when the "LargeIncrement
// Button" is "clicked" either by using the Invoke Pattern
// or the space between the thumb and the bottom/right button
OnUIAScroll (new ScrollEventArgs (ScrollEventType.LargeIncrement, Value));
OnUIAScroll (new ScrollEventArgs (ScrollEventType.LargeIncrement, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
private void LargeDecrement ()
@@ -787,18 +787,18 @@ namespace System.Windows.Forms
ScrollEventArgs event_args;
int pos = Math.Max (Minimum, position - large_change);
event_args = new ScrollEventArgs (ScrollEventType.LargeDecrement, pos);
event_args = new ScrollEventArgs (ScrollEventType.LargeDecrement, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value);
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
// UIA Framework event invoked when the "LargeDecrement
// Button" is "clicked" either by using the Invoke Pattern
// or the space between the thumb and the top/left button
OnUIAScroll (new ScrollEventArgs (ScrollEventType.LargeDecrement, Value));
OnUIAScroll (new ScrollEventArgs (ScrollEventType.LargeDecrement, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
private void OnResizeSB (Object o, EventArgs e)
@@ -1033,7 +1033,7 @@ namespace System.Windows.Forms
MoveThumb (thumb_rect, thumb_pos.Y);
OnScroll (new ScrollEventArgs (ScrollEventType.ThumbTrack, position));
OnScroll (new ScrollEventArgs (ScrollEventType.ThumbTrack, position, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
SendWMScroll(ScrollBarCommands.SB_THUMBTRACK);
} else {
@@ -1051,7 +1051,7 @@ namespace System.Windows.Forms
MoveThumb (thumb_rect, thumb_pos.X);
OnScroll (new ScrollEventArgs (ScrollEventType.ThumbTrack, position));
OnScroll (new ScrollEventArgs (ScrollEventType.ThumbTrack, position, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
SendWMScroll(ScrollBarCommands.SB_THUMBTRACK);
}
@@ -1183,8 +1183,8 @@ namespace System.Windows.Forms
Dirty (second_arrow_area);
secondbutton_pressed = false;
} else if (thumb_pressed == true) {
OnScroll (new ScrollEventArgs (ScrollEventType.ThumbPosition, position));
OnScroll (new ScrollEventArgs (ScrollEventType.EndScroll, position));
OnScroll (new ScrollEventArgs (ScrollEventType.ThumbPosition, position, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
OnScroll (new ScrollEventArgs (ScrollEventType.EndScroll, position, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
SendWMScroll(ScrollBarCommands.SB_THUMBPOSITION);
ThumbPressed = false;
return;
@@ -1254,11 +1254,11 @@ namespace System.Windows.Forms
ScrollEventArgs event_args;
int pos = MaximumAllowed;
event_args = new ScrollEventArgs (ScrollEventType.Last, pos);
event_args = new ScrollEventArgs (ScrollEventType.Last, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
pos = event_args.NewValue;
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
pos = event_args.NewValue;
@@ -1270,11 +1270,11 @@ namespace System.Windows.Forms
ScrollEventArgs event_args;
int pos = Minimum;
event_args = new ScrollEventArgs (ScrollEventType.First, pos);
event_args = new ScrollEventArgs (ScrollEventType.First, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
pos = event_args.NewValue;
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos);
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
pos = event_args.NewValue;
@@ -1286,18 +1286,18 @@ namespace System.Windows.Forms
ScrollEventArgs event_args;
int pos = Math.Min (MaximumAllowed, position + SmallChange);
event_args = new ScrollEventArgs (ScrollEventType.SmallIncrement, pos);
event_args = new ScrollEventArgs (ScrollEventType.SmallIncrement, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value);
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
// UIA Framework event invoked when the "SmallIncrement
// Button" (a.k.a bottom/right button) is "clicked" either
// by using the Invoke Pattern or the button itself
OnUIAScroll (new ScrollEventArgs (ScrollEventType.SmallIncrement, Value));
OnUIAScroll (new ScrollEventArgs (ScrollEventType.SmallIncrement, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
private void SmallDecrement ()
@@ -1305,18 +1305,18 @@ namespace System.Windows.Forms
ScrollEventArgs event_args;
int pos = Math.Max (Minimum, position - SmallChange);
event_args = new ScrollEventArgs (ScrollEventType.SmallDecrement, pos);
event_args = new ScrollEventArgs (ScrollEventType.SmallDecrement, pos, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value);
event_args = new ScrollEventArgs (ScrollEventType.EndScroll, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll));
OnScroll (event_args);
Value = event_args.NewValue;
// UIA Framework event invoked when the "SmallDecrement
// Button" (a.k.a top/left button) is "clicked" either
// by using the Invoke Pattern or the button itself
OnUIAScroll (new ScrollEventArgs (ScrollEventType.SmallDecrement, Value));
OnUIAScroll (new ScrollEventArgs (ScrollEventType.SmallDecrement, Value, (vert ? ScrollOrientation.VerticalScroll : ScrollOrientation.HorizontalScroll)));
}
private void SetHoldButtonClickTimer ()

View File

@@ -837,10 +837,10 @@ namespace System.Windows.Forms {
*/
if (!vscrollbar.Visible) {
vscrollbar.Value = 0;
vscrollbar.Value = vscrollbar.Minimum;
}
if (!hscrollbar.Visible) {
hscrollbar.Value = 0;
hscrollbar.Value = hscrollbar.Minimum;
}
/* Manually setting the size of the thumb should be done before

View File

@@ -1306,13 +1306,13 @@ namespace System.Windows.Forms {
if (widthOnly) {
page.TabBounds = new Rectangle (xpos, 0, width, 0);
page.Row = row_count;
if (xpos + width > row_width && multiline) {
xpos = 0;
row_count++;
} else if (xpos + width > row_width) {
show_slider = true;
}
page.Row = row_count;
if (i == selected_index && show_slider) {
for (int j = i-1; j >= 0; j--) {
if (TabPages [j].TabBounds.Left < xpos + width - row_width) {
@@ -1715,31 +1715,32 @@ namespace System.Windows.Forms {
public override void Remove (Control value)
{
bool change_index = false;
bool invalid_selected_index = false;
TabPage page = value as TabPage;
int next_selected_index = -1;
if (page != null && owner.Controls.Contains (page)) {
int index = owner.IndexForTabPage (page);
if (index < owner.SelectedIndex || owner.SelectedIndex == Count - 1)
change_index = true;
if (owner.SelectedIndex < index || owner.SelectedIndex == 0)
next_selected_index = owner.SelectedIndex;
else
next_selected_index = owner.SelectedIndex - 1;
owner.selected_index = -1; // Invalidate internal selected Index
invalid_selected_index = true;
}
base.Remove (value);
// We don't want to raise SelectedIndexChanged until after we
// have removed from the collection, so TabCount will be
// correct for the user.
if (change_index && Count > 0) {
// Clear the selected index internally, to avoid trying to access the previous
// selected tab when setting the new one - this is what .net seems to do
int prev_selected_index = owner.SelectedIndex;
owner.selected_index = -1;
owner.SelectedIndex = --prev_selected_index;
owner.Invalidate ();
} else if (change_index) {
owner.selected_index = -1;
owner.OnSelectedIndexChanged (EventArgs.Empty);
if (invalid_selected_index) {
if (Count > 0)
owner.SelectedIndex = next_selected_index;
else // Count == 0
owner.OnSelectedIndexChanged (EventArgs.Empty);
owner.Invalidate ();
} else
owner.Redraw ();

View File

@@ -191,7 +191,7 @@ namespace System.Windows.Forms
protected Color defaultWindowBackColor;
protected Color defaultWindowForeColor;
internal SystemResPool ResPool = new SystemResPool ();
private MethodInfo update;
private int[] knownColorTable;
protected Theme ()
{
@@ -199,13 +199,23 @@ namespace System.Windows.Forms
private void SetSystemColors (KnownColor kc, Color value)
{
if (update == null) {
Type known_colors = Type.GetType ("System.Drawing.KnownColors, " + Consts.AssemblySystem_Drawing);
if (known_colors != null)
update = known_colors.GetMethod ("Update", BindingFlags.Static | BindingFlags.Public);
if (knownColorTable == null) {
Type knownColorTableClass = Type.GetType ("System.Drawing.KnownColorTable, " + Consts.AssemblySystem_Drawing);
if (knownColorTableClass != null)
{
MethodInfo ensureMethod = knownColorTableClass.GetMethod ("EnsureColorTable", BindingFlags.Static | BindingFlags.NonPublic);
if (ensureMethod != null) {
ensureMethod.Invoke(null, new object[]{});
FieldInfo colorTableField = knownColorTableClass.GetField ("s_colorTable", BindingFlags.Static | BindingFlags.NonPublic);
if (colorTableField != null) {
knownColorTable = colorTableField.GetValue (null) as int[];
}
}
}
}
if (knownColorTable != null) {
knownColorTable[(int)kc] = value.ToArgb();
}
if (update != null)
update.Invoke (null, new object [2] { (int)kc, value.ToArgb () });
}
/* OS Feature support */