Imported Upstream version 5.14.0.78

Former-commit-id: 3494343bcc9ddb42b36b82dd9ae7b69e85e0229f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-05-10 08:37:03 +00:00
parent 74b74abd9f
commit 19234507ba
1776 changed files with 67755 additions and 31107 deletions

View File

@@ -45,4 +45,5 @@ using System.Diagnostics;
[assembly: InternalsVisibleTo("UIAutomationWinforms, PublicKey=00240000048000009400000006020000002400005253413100040000110000004bb98b1af6c1df0df8c02c380e116b7a7f0c8c827aecfccddc6e29b7c754cd608b49dfcef4df9699ad182e50f66afa4e68dabc7b6aeeec0aa4719a5f8e0aae8c193080a706adc3443a8356b1f254142034995532ac176398e12a30f6a74a119a89ac47672c9ae24d7e90de686557166e3b873cd707884431a0451d9d6f7fe795")]
[assembly: InternalsVisibleTo("Mono.WinformsSupport, PublicKey=00240000048000009400000006020000002400005253413100040000110000004bb98b1af6c1df0df8c02c380e116b7a7f0c8c827aecfccddc6e29b7c754cd608b49dfcef4df9699ad182e50f66afa4e68dabc7b6aeeec0aa4719a5f8e0aae8c193080a706adc3443a8356b1f254142034995532ac176398e12a30f6a74a119a89ac47672c9ae24d7e90de686557166e3b873cd707884431a0451d9d6f7fe795")]
[assembly: InternalsVisibleTo("CocoaDriver, PublicKey=0024000004800000940000000602000000240000525341310004000001000100dfb6f531e52a405fce7bb127fdff8b462a29426618ae319093a6479dbc037c76ce025581c272d47806d3c4c9a65304b7ddacff806e6c7e6483f985a5ac39498190c87b7ddb13d3e9c7107f0ceef392ce3fd01391fd9f61199449fd8702ab0d9c2d32dee637bc557ecc7f75c85b350d0d80d8efdb5bdaa6ecaddae0a23a1eb8db")]

View File

@@ -110,7 +110,7 @@ TEST_MCS_FLAGS = \
DummyAssembly.dll:
$(CSCOMPILE) /target:library /out:$@ Test/DummyAssembly/AnotherSerializable.cs Test/DummyAssembly/Convertable.cs Test/DummyAssembly/Properties/AssemblyInfo.cs \
-r:$(topdir)/class/lib/$(PROFILE)/System.dll
-r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll
test-local: DummyAssembly.dll
@@ -131,8 +131,14 @@ $(PREBUILT): %.prebuilt: %
dist-default: $(PREBUILT)
simple-test.exe: Test/simple/Program.cs $(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll
$(CSCOMPILE) -out:$@ Test/simple/Program.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll
simple-test.exe: Test/simple/Program.cs $(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll $(topdir)/class/lib/$(PROFILE)/mscorlib.dll
$(CSCOMPILE) -out:$@ Test/simple/Program.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
test-simple: simple-test.exe
$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) simple-test.exe
notepad.exe: samples/notepad.cs $(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll $(topdir)/class/lib/$(PROFILE)/System.Drawing.dll $(topdir)/class/lib/$(PROFILE)/System.dll $(topdir)/class/lib/$(PROFILE)/mscorlib.dll
$(CSCOMPILE) -out:$@ samples/notepad.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Drawing.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
test-notepad: notepad.exe
$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) notepad.exe

View File

@@ -29,31 +29,47 @@
using System;
using System.Drawing;
using System.Collections;
namespace System.Windows.Forms.Layout
{
class DefaultLayout : LayoutEngine
{
void LayoutDockedChildren (Control parent, Control[] controls)
internal static readonly DefaultLayout Instance = new DefaultLayout();
private DefaultLayout ()
{
}
public override void InitLayout (object child, BoundsSpecified specified)
{
IArrangedElement control = (IArrangedElement)child;
IArrangedElement parent = control.Parent;
if (parent != null) {
Rectangle bounds = control.Bounds;
if ((specified & (BoundsSpecified.Width | BoundsSpecified.X)) != BoundsSpecified.None)
control.DistanceRight = parent.DisplayRectangle.Right - bounds.X - bounds.Width;
if ((specified & (BoundsSpecified.Height | BoundsSpecified.Y)) != BoundsSpecified.None)
control.DistanceBottom = parent.DisplayRectangle.Bottom - bounds.Y - bounds.Height;
}
}
static void LayoutDockedChildren (IArrangedElement parent, IList controls)
{
Rectangle space = parent.DisplayRectangle;
MdiClient mdi = null;
IArrangedElement mdi = null;
// Deal with docking; go through in reverse, MS docs say that lowest Z-order is closest to edge
for (int i = controls.Length - 1; i >= 0; i--) {
Control child = controls[i];
Size child_size = child.Size;
for (int i = controls.Count - 1; i >= 0; i--) {
IArrangedElement child = (IArrangedElement)controls[i];
Size child_size = child.Bounds.Size;
if (child.AutoSize)
child_size = GetPreferredControlSize (child);
if (!child.VisibleInternal
|| child.ControlLayoutType == Control.LayoutType.Anchor)
if (!child.Visible || child.Dock == DockStyle.None)
continue;
// MdiClient never fills the whole area like other controls, have to do it later
if (child is MdiClient) {
mdi = (MdiClient)child;
mdi = child;
continue;
}
@@ -63,193 +79,139 @@ namespace System.Windows.Forms.Layout
break;
case DockStyle.Left:
child.SetBoundsInternal (space.Left, space.Y, child_size.Width, space.Height, BoundsSpecified.None);
space.X += child.Width;
space.Width -= child.Width;
if (child.AutoSize)
child_size = child.GetPreferredSize(new Size(0, space.Height));
child.SetBounds (space.Left, space.Y, child_size.Width, space.Height, BoundsSpecified.None);
space.X += child_size.Width;
space.Width -= child_size.Width;
break;
case DockStyle.Top:
child.SetBoundsInternal (space.Left, space.Y, space.Width, child_size.Height, BoundsSpecified.None);
space.Y += child.Height;
space.Height -= child.Height;
if (child.AutoSize)
child_size = child.GetPreferredSize(new Size(space.Width, 0));
child.SetBounds (space.Left, space.Y, space.Width, child_size.Height, BoundsSpecified.None);
space.Y += child_size.Height;
space.Height -= child_size.Height;
break;
case DockStyle.Right:
child.SetBoundsInternal (space.Right - child_size.Width, space.Y, child_size.Width, space.Height, BoundsSpecified.None);
space.Width -= child.Width;
if (child.AutoSize)
child_size = child.GetPreferredSize(new Size(0, space.Height));
child.SetBounds (space.Right - child_size.Width, space.Y, child_size.Width, space.Height, BoundsSpecified.None);
space.Width -= child_size.Width;
break;
case DockStyle.Bottom:
child.SetBoundsInternal (space.Left, space.Bottom - child_size.Height, space.Width, child_size.Height, BoundsSpecified.None);
space.Height -= child.Height;
if (child.AutoSize)
child_size = child.GetPreferredSize(new Size(space.Width, 0));
child.SetBounds (space.Left, space.Bottom - child_size.Height, space.Width, child_size.Height, BoundsSpecified.None);
space.Height -= child_size.Height;
break;
case DockStyle.Fill:
child.SetBoundsInternal (space.Left, space.Top, space.Width, space.Height, BoundsSpecified.None);
child.SetBounds (space.Left, space.Top, space.Width, space.Height, BoundsSpecified.None);
break;
}
}
// MdiClient gets whatever space is left
if (mdi != null)
mdi.SetBoundsInternal (space.Left, space.Top, space.Width, space.Height, BoundsSpecified.None);
mdi.SetBounds (space.Left, space.Top, space.Width, space.Height, BoundsSpecified.None);
}
void LayoutAnchoredChildren (Control parent, Control[] controls)
static void LayoutAnchoredChildren (IArrangedElement parent, IList controls)
{
Rectangle space = parent.ClientRectangle;
Rectangle space = parent.DisplayRectangle;
for (int i = 0; i < controls.Length; i++) {
int left;
int top;
int width;
int height;
Control child = controls[i];
if (!child.VisibleInternal
|| child.ControlLayoutType == Control.LayoutType.Dock)
foreach (IArrangedElement child in controls) {
if (!child.Visible || child.Dock != DockStyle.None)
continue;
AnchorStyles anchor = child.Anchor;
left = child.Left;
top = child.Top;
width = child.Width;
height = child.Height;
Rectangle bounds = child.Bounds;
int left = bounds.Left;
int top = bounds.Top;
int width = bounds.Width;
int height = bounds.Height;
if ((anchor & AnchorStyles.Right) != 0) {
if ((anchor & AnchorStyles.Left) != 0)
width = space.Width - child.dist_right - left;
width = space.Right - child.DistanceRight - left;
else
left = space.Width - child.dist_right - width;
left = space.Right - child.DistanceRight - width;
}
else if ((anchor & AnchorStyles.Left) == 0) {
// left+=diff_width/2 will introduce rounding errors (diff_width removed from svn after r51780)
// This calculates from scratch every time:
left = left + (space.Width - (left + width + child.dist_right)) / 2;
child.dist_right = space.Width - (left + width);
left += (space.Width - (left + width + child.DistanceRight)) / 2;
child.DistanceRight = space.Width - (left + width);
}
if ((anchor & AnchorStyles.Bottom) != 0) {
if ((anchor & AnchorStyles.Top) != 0)
height = space.Height - child.dist_bottom - top;
height = space.Bottom - child.DistanceBottom - top;
else
top = space.Height - child.dist_bottom - height;
top = space.Bottom - child.DistanceBottom - height;
}
else if ((anchor & AnchorStyles.Top) == 0) {
// top += diff_height/2 will introduce rounding errors (diff_height removed from after r51780)
// This calculates from scratch every time:
top = top + (space.Height - (top + height + child.dist_bottom)) / 2;
child.dist_bottom = space.Height - (top + height);
top += (space.Height - (top + height + child.DistanceBottom)) / 2;
child.DistanceBottom = space.Height - (top + height);
}
// Sanity
if (width < 0)
width = 0;
if (height < 0)
height = 0;
child.SetBoundsInternal (left, top, width, height, BoundsSpecified.None);
if (child.AutoSize) {
Size proposed_size = Size.Empty;
if ((anchor & (AnchorStyles.Left | AnchorStyles.Right)) == (AnchorStyles.Left | AnchorStyles.Right))
proposed_size.Width = width;
if ((anchor & (AnchorStyles.Top | AnchorStyles.Bottom)) == (AnchorStyles.Top | AnchorStyles.Bottom))
proposed_size.Height = height;
Size preferred_size = GetPreferredControlSize (child, proposed_size);
if ((anchor & (AnchorStyles.Left | AnchorStyles.Right)) != AnchorStyles.Right)
child.DistanceRight += width - preferred_size.Width;
else
left += width - preferred_size.Width;
if ((anchor & (AnchorStyles.Top | AnchorStyles.Bottom)) != AnchorStyles.Bottom)
child.DistanceBottom += height - preferred_size.Height;
else
top += height - preferred_size.Height;
child.SetBounds (left, top, preferred_size.Width, preferred_size.Height, BoundsSpecified.None);
} else {
child.SetBounds (left, top, width, height, BoundsSpecified.None);
}
}
}
void LayoutAutoSizedChildren (Control parent, Control[] controls)
{
for (int i = 0; i < controls.Length; i++) {
int left;
int top;
Control child = controls[i];
if (!child.VisibleInternal
|| child.ControlLayoutType == Control.LayoutType.Dock
|| !child.AutoSize)
continue;
AnchorStyles anchor = child.Anchor;
left = child.Left;
top = child.Top;
Size preferredsize = GetPreferredControlSize (child);
if (((anchor & AnchorStyles.Left) != 0) || ((anchor & AnchorStyles.Right) == 0))
child.dist_right += child.Width - preferredsize.Width;
if (((anchor & AnchorStyles.Top) != 0) || ((anchor & AnchorStyles.Bottom) == 0))
child.dist_bottom += child.Height - preferredsize.Height;
child.SetBoundsInternal (left, top, preferredsize.Width, preferredsize.Height, BoundsSpecified.None);
}
}
void LayoutAutoSizeContainer (Control container)
{
int left;
int top;
int width;
int height;
if (!container.VisibleInternal || container.ControlLayoutType == Control.LayoutType.Dock || !container.AutoSize)
return;
left = container.Left;
top = container.Top;
Size preferredsize = container.PreferredSize;
if (container.GetAutoSizeMode () == AutoSizeMode.GrowAndShrink) {
width = preferredsize.Width;
height = preferredsize.Height;
} else {
width = container.ExplicitBounds.Width;
height = container.ExplicitBounds.Height;
if (preferredsize.Width > width)
width = preferredsize.Width;
if (preferredsize.Height > height)
height = preferredsize.Height;
}
// Sanity
if (width < container.MinimumSize.Width)
width = container.MinimumSize.Width;
if (height < container.MinimumSize.Height)
height = container.MinimumSize.Height;
if (container.MaximumSize.Width != 0 && width > container.MaximumSize.Width)
width = container.MaximumSize.Width;
if (container.MaximumSize.Height != 0 && height > container.MaximumSize.Height)
height = container.MaximumSize.Height;
container.SetBoundsInternal (left, top, width, height, BoundsSpecified.None);
}
public override bool Layout (object container, LayoutEventArgs args)
{
Control parent = container as Control;
IArrangedContainer parent = (IArrangedContainer)container;
Control[] controls = parent.Controls.GetAllControls ();
LayoutDockedChildren (parent, parent.Controls);
LayoutAnchoredChildren (parent, parent.Controls);
LayoutDockedChildren (parent, controls);
LayoutAnchoredChildren (parent, controls);
LayoutAutoSizedChildren (parent, controls);
if (parent is Form) LayoutAutoSizeContainer (parent);
return false;
return parent.AutoSize;
}
private Size GetPreferredControlSize (Control child)
static private Size GetPreferredControlSize (IArrangedElement child, Size proposed)
{
int width;
int height;
Size preferredsize = child.PreferredSize;
if (child.GetAutoSizeMode () == AutoSizeMode.GrowAndShrink || (child.Dock != DockStyle.None && !(child is Button) && !(child is FlowLayoutPanel))) {
var preferredsize = child.GetPreferredSize (proposed);
int width, height;
if (child.GetAutoSizeMode () == AutoSizeMode.GrowAndShrink)
{
width = preferredsize.Width;
height = preferredsize.Height;
} else {
}
else
{
width = child.ExplicitBounds.Width;
height = child.ExplicitBounds.Height;
if (preferredsize.Width > width)
@@ -257,34 +219,64 @@ namespace System.Windows.Forms.Layout
if (preferredsize.Height > height)
height = preferredsize.Height;
}
if (child.AutoSize && child is FlowLayoutPanel && child.Dock != DockStyle.None) {
switch (child.Dock) {
case DockStyle.Left:
case DockStyle.Right:
if (preferredsize.Width < child.ExplicitBounds.Width && preferredsize.Height < child.Parent.PaddingClientRectangle.Height)
width = preferredsize.Width;
break;
case DockStyle.Top:
case DockStyle.Bottom:
if (preferredsize.Height < child.ExplicitBounds.Height && preferredsize.Width < child.Parent.PaddingClientRectangle.Width)
height = preferredsize.Height;
break;
return new Size(width, height);
}
internal override Size GetPreferredSize (object container, Size proposedConstraints)
{
IArrangedContainer parent = (IArrangedContainer)container;
IList controls = parent.Controls;
Size retsize = Size.Empty;
// Add up the requested sizes for Docked controls
for (int i = controls.Count - 1; i >= 0; i--) {
IArrangedElement child = (IArrangedElement)controls[i];
if (!child.Visible || child.Dock == DockStyle.None)
continue;
if (child.Dock == DockStyle.Left || child.Dock == DockStyle.Right) {
Size sz = child.AutoSize ? child.GetPreferredSize (new Size(0, proposedConstraints.Height)) : child.Bounds.Size;
retsize.Width += sz.Width;
} else if (child.Dock == DockStyle.Top || child.Dock == DockStyle.Bottom) {
Size sz = child.AutoSize ? child.GetPreferredSize (new Size(proposedConstraints.Width, 0)) : child.Bounds.Size;
retsize.Height += sz.Height;
} else if (child.Dock == DockStyle.Fill && child.AutoSize) {
Size sz = child.GetPreferredSize (proposedConstraints);
retsize += sz;
}
}
// Sanity
if (width < child.MinimumSize.Width)
width = child.MinimumSize.Width;
if (height < child.MinimumSize.Height)
height = child.MinimumSize.Height;
// See if any non-Docked control is positioned lower or more right than our size
foreach (IArrangedElement child in parent.Controls) {
if (!child.Visible || child.Dock != DockStyle.None)
continue;
// If its anchored to the bottom or right, that doesn't really count
if ((child.Anchor & (AnchorStyles.Bottom | AnchorStyles.Top)) == AnchorStyles.Bottom ||
(child.Anchor & (AnchorStyles.Right | AnchorStyles.Left)) == AnchorStyles.Right)
continue;
if (child.MaximumSize.Width != 0 && width > child.MaximumSize.Width)
width = child.MaximumSize.Width;
Rectangle child_bounds = child.Bounds;
if (child.AutoSize) {
Size proposed_child_size = Size.Empty;
if ((child.Anchor & (AnchorStyles.Left | AnchorStyles.Right)) == (AnchorStyles.Left | AnchorStyles.Right)) {
proposed_child_size.Width = proposedConstraints.Width - child.DistanceRight - (child_bounds.Left - parent.DisplayRectangle.Left);
}
if ((child.Anchor & (AnchorStyles.Top | AnchorStyles.Bottom)) == (AnchorStyles.Top | AnchorStyles.Bottom)) {
proposed_child_size.Height = proposedConstraints.Height - child.DistanceBottom - (child_bounds.Top - parent.DisplayRectangle.Top);
}
Size preferred_size = GetPreferredControlSize (child, proposed_child_size);
child_bounds = new Rectangle (child_bounds.Location, preferred_size);
}
if (child.MaximumSize.Height != 0 && height > child.MaximumSize.Height)
height = child.MaximumSize.Height;
return new Size (width, height);
}
// This is the non-sense Microsoft uses (Padding vs DisplayRectangle)
retsize.Width = Math.Max (retsize.Width, child_bounds.Right - parent.Padding.Left + child.Margin.Right);
retsize.Height = Math.Max (retsize.Height, child_bounds.Bottom - parent.Padding.Top + child.Margin.Bottom);
//retsize.Width = Math.Max (retsize.Width, child_bounds.Right - parent.DisplayRectangle.Left + child.Margin.Right);
//retsize.Height = Math.Max (retsize.Height, child_bounds.Bottom - parent.DisplayRectangle.Top + child.Margin.Bottom);
}
return retsize;
}
}
}

View File

@@ -1,5 +1,5 @@
//
// IBounds.cs
//
// IArrangedElement.cs
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -20,21 +20,17 @@
// 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) 2008 Novell, Inc.
//
// Authors:
// Jonathan Pobst (monkey@jpobst.com)
// Copyright (c) 2018 Filip Navara
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Drawing;
namespace System.Windows.Forms
namespace System.Windows.Forms.Layout
{
interface IBounds
interface IArrangedContainer : IArrangedElement
{
Rectangle Bounds { get; }
ArrangedElementCollection Controls { get; }
void PerformLayout (IArrangedElement affectedElement, string affectedProperty);
}
}

View File

@@ -0,0 +1,52 @@
//
// IArrangedElement.cs
//
// 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) 2018 Filip Navara
//
using System.Collections;
using System.Drawing;
using System.ComponentModel;
namespace System.Windows.Forms.Layout
{
interface IArrangedElement : IComponent
{
bool Visible { get; }
bool AutoSize { get; }
AutoSizeMode GetAutoSizeMode();
Rectangle Bounds { get; }
Rectangle ExplicitBounds { get; }
Padding Padding { get; }
Padding Margin { get; }
Size MinimumSize { get; }
AnchorStyles Anchor { get; }
DockStyle Dock { get; }
Rectangle DisplayRectangle { get; }
IArrangedContainer Parent { get; }
string Name { get; }
void SetBounds(int x, int y, int width, int height, BoundsSpecified specified);
Size GetPreferredSize(Size proposedSize);
int DistanceRight { get; set; }
int DistanceBottom { get; set; }
}
}

View File

@@ -26,6 +26,7 @@
using System;
using System.ComponentModel;
using System.Drawing;
namespace System.Windows.Forms.Layout {
@@ -39,5 +40,10 @@ namespace System.Windows.Forms.Layout {
{
return false;
}
internal virtual Size GetPreferredSize (object container, Size proposedSize)
{
return Size.Empty;
}
}
}

View File

@@ -38,36 +38,10 @@ namespace System.Windows.Forms.Theming
static ThemeElements ()
{
string theme_var;
theme_var = Environment.GetEnvironmentVariable ("MONO_THEME");
if (theme_var == null)
theme_var = "win32";
if (Application.VisualStylesEnabled)
theme = new ThemeElementsVisualStyles ();
else
theme_var = theme_var.ToLower ();
theme = LoadTheme (theme_var);
}
private static ThemeElementsDefault LoadTheme (string themeName)
{
if (themeName == "visualstyles")
if (Application.VisualStylesEnabled)
return new ThemeElementsVisualStyles ();
else
return new ThemeElementsDefault ();
Assembly ass = Assembly.GetExecutingAssembly ();
string iname = typeof(ThemeElements).FullName;
string assemblyname = iname + themeName;
Type type = ass.GetType (assemblyname, false, true);
if (type != null) {
object o = ass.CreateInstance (type.FullName);
if (o != null)
return (ThemeElementsDefault) o;
}
return new ThemeElementsDefault ();
theme = new ThemeElementsDefault ();
}
#region Buttons

View File

@@ -382,7 +382,6 @@ System.Windows.Forms/HtmlWindowCollection.cs
System.Windows.Forms/Hwnd.cs
System.Windows.Forms/IButtonControl.cs
System.Windows.Forms/IBindableComponent.cs
System.Windows.Forms/IBounds.cs
System.Windows.Forms/ICommandExecutor.cs
System.Windows.Forms/IComponentEditorPageSite.cs
System.Windows.Forms/IContainerControl.cs
@@ -821,6 +820,8 @@ System.Windows.Forms/XplatUIX11.cs
System.Windows.Forms.Layout/ArrangedElementCollection.cs
System.Windows.Forms.Layout/DefaultLayout.cs
System.Windows.Forms.Layout/FlowLayout.cs
System.Windows.Forms.Layout/IArrangedContainer.cs
System.Windows.Forms.Layout/IArrangedElement.cs
System.Windows.Forms.Layout/TableLayout.cs
System.Windows.Forms.Layout/TableLayoutSettingsTypeConverter.cs
System.Windows.Forms.Layout/LayoutEngine.cs

View File

@@ -125,17 +125,17 @@ namespace System.Windows.Forms {
public virtual AccessibleStates State {
get {
#if not
if (owner!=null) {
if (owner.Focused) {
state |= AccessibleStates.Focused;
}
if (owner.CanFocus) {
state |= AccessibleStates.Focusable;
}
if (!owner.Visible) {
state |= AccessibleStates.Invisible;
}
}
#endif
return state;
}
}

View File

@@ -878,28 +878,26 @@ namespace System.Windows.Forms
if (keyboard_capture != null) {
Control c2 = Control.FromHandle (msg.hwnd);
// the target is not a winforms control (an embedded control, perhaps), so
// The target is not a winforms control (an embedded control, perhaps), so
// release everything
if (c2 == null) {
ToolStripManager.FireAppClicked ();
goto default;
}
// If we clicked a ToolStrip, we have to make sure it isn't
// the one we are on, or any of its parents or children
// If we clicked off the dropped down menu, release everything
if (c2 is ToolStrip) {
if ((c2 as ToolStrip).GetTopLevelToolStrip () != keyboard_capture.GetTopLevelToolStrip ())
ToolStripManager.FireAppClicked ();
} else {
if (c2.Parent != null)
if (c2.Parent is ToolStripDropDownMenu)
if ((c2.Parent as ToolStripDropDownMenu).GetTopLevelToolStrip () == keyboard_capture.GetTopLevelToolStrip ())
goto default;
if (c2.TopLevelControl == null)
goto default;
ToolStripManager.FireAppClicked ();
// Skip clicks on owner windows, eg. expanded ComboBox
if (Control.IsChild (keyboard_capture.Handle, msg.hwnd)) {
goto default;
}
// Close any active toolstrips drop-downs if we click outside of them,
// but also don't close them all if we click outside of the top-most
// one, but into its owner.
Point c2_point = c2.PointToScreen (new Point (
(int)(short)(m.LParam.ToInt32() & 0xffff),
(int)(short)(m.LParam.ToInt32() >> 16)));
while (keyboard_capture != null && !keyboard_capture.ClientRectangle.Contains (keyboard_capture.PointToClient (c2_point))) {
keyboard_capture.Dismiss ();
}
}

View File

@@ -45,12 +45,12 @@ namespace System.Windows.Forms
}
public BindingCompleteEventArgs(Binding binding, BindingCompleteState state, BindingCompleteContext context, string errorText)
: this (binding, state, context, errorText, null, false)
: this (binding, state, context, errorText, null, true)
{
}
public BindingCompleteEventArgs(Binding binding, BindingCompleteState state, BindingCompleteContext context, string errorText, Exception exception)
: this (binding, state, context, errorText, exception, false)
: this (binding, state, context, errorText, exception, true)
{
}

View File

@@ -188,10 +188,18 @@ namespace System.Windows.Forms {
internal override Size GetPreferredSizeCore (Size proposedSize)
{
Size size;
if (this.AutoSize)
return ThemeEngine.Current.CalculateButtonAutoSize (this);
return base.GetPreferredSizeCore (proposedSize);
size = ThemeEngine.Current.CalculateButtonAutoSize (this);
else
size = base.GetPreferredSizeCore (proposedSize);
// Button has a special legacy behavior and implements AutoSizeMode itself
if (AutoSizeMode == AutoSizeMode.GrowOnly)
size = new Size (Math.Max (size.Width, Width), Math.Max (size.Height, Height));
return size;
}
#endregion // Internal methods
}

View File

@@ -93,6 +93,8 @@ namespace System.Windows.Forms {
ControlStyles.CacheText |
ControlStyles.OptimizedDoubleBuffer, true);
SetStyle (ControlStyles.StandardClick, false);
can_cache_preferred_size = true;
}
#endregion // Public Constructors

View File

@@ -111,6 +111,7 @@ namespace System.Windows.Forms {
TextAlign = ContentAlignment.MiddleLeft;
SetStyle(ControlStyles.StandardDoubleClick, false);
SetAutoSizeMode (AutoSizeMode.GrowAndShrink);
can_cache_preferred_size = true;
}
#endregion // Public Constructors

View File

@@ -423,7 +423,19 @@ namespace System.Windows.Forms
owner.UpdateCollections ();
return idx;
}
}
public override void Clear ()
{
owner.check_states.Clear ();
base.Clear ();
}
internal override void UpdateSelection (int removed_index)
{
owner.check_states.Remove (this[removed_index]);
base.UpdateSelection (removed_index);
}
}
public class CheckedIndexCollection : IList, ICollection, IEnumerable
{

View File

@@ -165,7 +165,7 @@ namespace System.Windows.Forms {
greenLabel.TextAlign = ContentAlignment.MiddleRight;
// colorBaseLabel
colorBaseLabel.Location = new Point (228, 247);
colorBaseLabel.Size = new Size (60, 25);
colorBaseLabel.Size = new Size (60, 16);
colorBaseLabel.TabIndex = 28;
colorBaseLabel.Text = Locale.GetText ("Color");
colorBaseLabel.TextAlign = ContentAlignment.MiddleCenter;
@@ -384,11 +384,11 @@ namespace System.Windows.Forms {
if (fullOpen && allowFullOpen) {
defineColoursButton.Enabled = false;
colorMatrixControl.ColorToShow = baseColorControl.ColorToShow;
form.Size = GetFormSize (true);
form.ClientSize = GetFormClientSize (true);
} else {
if (allowFullOpen)
defineColoursButton.Enabled = true;
form.Size = GetFormSize (false);
form.ClientSize = GetFormClientSize (false);
}
}
}
@@ -483,7 +483,7 @@ namespace System.Windows.Forms {
defineColoursButton.Enabled = (AllowFullOpen && !FullOpen);
defineColoursButton.Refresh ();
form.Size = GetFormSize (FullOpen && AllowFullOpen);
form.ClientSize = GetFormClientSize (FullOpen && AllowFullOpen);
// currently needed, otherwise there are a lot of drawing artefacts/transparent controls if the same dialog gets opened again
form.Refresh ();
@@ -493,12 +493,12 @@ namespace System.Windows.Forms {
#region Private Methods
Size GetFormSize (bool fullOpen)
Size GetFormClientSize (bool fullOpen)
{
if (fullOpen)
return new Size (448, 332);
return new Size (446, 300);
else
return new Size (221, 332); // 300
return new Size (219, 300);
}
void OnClickCancelButton (object sender, EventArgs e)
@@ -521,7 +521,7 @@ namespace System.Windows.Forms {
if (allowFullOpen) {
defineColoursButton.Enabled = false;
colorMatrixControl.ColorToShow = baseColorControl.ColorToShow;
form.Size = GetFormSize (true);
form.ClientSize = GetFormClientSize (true);
}
}

View File

@@ -60,8 +60,8 @@ namespace System.Windows.Forms
if (width != value) {
width = value;
if (base.Owner != null)
base.Owner.PerformLayout ();
if (Owner != null)
Owner.PerformLayout (Owner, "Style");
}
}
}

View File

@@ -98,7 +98,8 @@ namespace System.Windows.Forms
items = new ObjectCollection (this);
DropDownStyle = ComboBoxStyle.DropDown;
item_height = FontHeight + 2;
background_color = ThemeEngine.Current.ColorControl;
background_color = ThemeEngine.Current.ColorWindow;
foreground_color = ThemeEngine.Current.ColorWindowText;
border_style = BorderStyle.None;
drop_down_height = default_drop_down_height;
@@ -111,7 +112,9 @@ namespace System.Windows.Forms
MouseWheel += new MouseEventHandler (OnMouseWheelCB);
MouseEnter += new EventHandler (OnMouseEnter);
MouseLeave += new EventHandler (OnMouseLeave);
KeyDown +=new KeyEventHandler(OnKeyDownCB);
KeyDown += new KeyEventHandler (OnKeyDownCB);
can_cache_preferred_size = true;
}
#region events
@@ -1111,7 +1114,7 @@ namespace System.Windows.Forms
{
base.OnHandleCreated (e);
SetBoundsInternal (Left, Top, Width, PreferredHeight, BoundsSpecified.None);
SetBoundsCore (Left, Top, Width, PreferredHeight, BoundsSpecified.None);
if (textbox_ctrl != null)
Controls.AddImplicit (textbox_ctrl);
@@ -2419,6 +2422,7 @@ namespace System.Windows.Forms
SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
SetTopLevel (true);
this.is_visible = false;
@@ -2534,9 +2538,8 @@ namespace System.Windows.Forms
}
}
var borderWidth = Hwnd.GetBorderWidth (CreateParams);
var borderAdjustment = dropdown_style == ComboBoxStyle.Simple ? new Size (0, 0) :
new Size (borderWidth.top + borderWidth.bottom, borderWidth.left + borderWidth.right);
SizeFromClientSize(Size.Empty);
Size = new Size (width, height + borderAdjustment.Height);
textarea_drawable = new Rectangle (ClientRectangle.Location,
new Size (width - borderAdjustment.Width, height));
@@ -2773,6 +2776,7 @@ namespace System.Windows.Forms
if (this.Location.Y + this.Height >= scrn_rect.Bottom)
this.Location = new Point (this.Location.X, this.Location.Y - (this.Height + owner.TextArea.Height));
Show ();
XplatUI.SetOwner (Handle, owner.Handle);
Refresh ();
owner.OnDropDown (EventArgs.Empty);

Some files were not shown because too many files have changed in this diff Show More