Browse Source
Merge branch 'master' into arc-shape
pull/6133/head
Jumar Macato
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
135 additions and
7 deletions
-
src/Avalonia.Controls.DataGrid/DataGridRows.cs
-
src/Avalonia.Controls/ComboBox.cs
-
src/Avalonia.Controls/GridLength.cs
-
src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
-
src/Avalonia.Controls/RowDefinitions.cs
-
src/Avalonia.Visuals/Media/BoxShadow.cs
-
src/Avalonia.Visuals/Media/BoxShadows.cs
-
tests/Avalonia.Controls.UnitTests/ComboBoxTests.cs
|
|
|
@ -425,7 +425,7 @@ namespace Avalonia.Controls |
|
|
|
UpdateDisplayedRows(DisplayData.FirstScrollingSlot, CellsHeight); |
|
|
|
} |
|
|
|
|
|
|
|
if (DisplayData.FirstScrollingSlot < slot && DisplayData.LastScrollingSlot > slot) |
|
|
|
if (DisplayData.FirstScrollingSlot < slot && (DisplayData.LastScrollingSlot > slot || DisplayData.LastScrollingSlot == -1)) |
|
|
|
{ |
|
|
|
// The row is already displayed in its entirety
|
|
|
|
return true; |
|
|
|
|
|
|
|
@ -205,7 +205,7 @@ namespace Avalonia.Controls |
|
|
|
if (e.Handled) |
|
|
|
return; |
|
|
|
|
|
|
|
if (e.Key == Key.F4 || |
|
|
|
if ((e.Key == Key.F4 && e.KeyModifiers.HasAllFlags(KeyModifiers.Alt) == false) || |
|
|
|
((e.Key == Key.Down || e.Key == Key.Up) && e.KeyModifiers.HasAllFlags(KeyModifiers.Alt))) |
|
|
|
{ |
|
|
|
IsDropDownOpen = !IsDropDownOpen; |
|
|
|
|
|
|
|
@ -77,6 +77,12 @@ namespace Avalonia.Controls |
|
|
|
/// </summary>
|
|
|
|
public static GridLength Auto => new GridLength(0, GridUnitType.Auto); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets an instance of <see cref="GridLength"/> that indicates that a row or column should
|
|
|
|
/// fill its content.
|
|
|
|
/// </summary>
|
|
|
|
public static GridLength Star => new GridLength(1, GridUnitType.Star); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the unit of the <see cref="GridLength"/>.
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
@ -511,8 +511,8 @@ namespace Avalonia.Controls.Presenters |
|
|
|
else if (scrollable.IsLogicalScrollEnabled) |
|
|
|
{ |
|
|
|
Viewport = scrollable.Viewport; |
|
|
|
Extent = scrollable.Extent; |
|
|
|
Offset = scrollable.Offset; |
|
|
|
Extent = scrollable.Extent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1,5 +1,4 @@ |
|
|
|
using System.Linq; |
|
|
|
using Avalonia.Collections; |
|
|
|
|
|
|
|
namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
@ -25,6 +24,11 @@ namespace Avalonia.Controls |
|
|
|
AddRange(GridLength.ParseLengths(s).Select(x => new RowDefinition(x))); |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
return string.Join(",", this.Select(x => x.Height)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Parses a string representation of row definitions collection.
|
|
|
|
/// </summary>
|
|
|
|
@ -32,4 +36,4 @@ namespace Avalonia.Controls |
|
|
|
/// <returns>The <see cref="RowDefinitions"/>.</returns>
|
|
|
|
public static RowDefinitions Parse(string s) => new RowDefinitions(s); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Globalization; |
|
|
|
using System.Text; |
|
|
|
using Avalonia.Animation.Animators; |
|
|
|
using Avalonia.Utilities; |
|
|
|
|
|
|
|
@ -75,6 +76,46 @@ namespace Avalonia.Media |
|
|
|
return rv; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
var sb = new StringBuilder(); |
|
|
|
|
|
|
|
if (IsEmpty) |
|
|
|
{ |
|
|
|
return "none"; |
|
|
|
} |
|
|
|
|
|
|
|
if (IsInset) |
|
|
|
{ |
|
|
|
sb.Append("inset"); |
|
|
|
} |
|
|
|
|
|
|
|
if (OffsetX != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", OffsetX.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (OffsetY != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", OffsetY.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (Blur != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", Blur.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
if (Spread != 0.0) |
|
|
|
{ |
|
|
|
sb.AppendFormat(" {0}", Spread.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
sb.AppendFormat(" {0}", Color.ToString()); |
|
|
|
|
|
|
|
return sb.ToString(); |
|
|
|
} |
|
|
|
|
|
|
|
public static unsafe BoxShadow Parse(string s) |
|
|
|
{ |
|
|
|
if(s == null) |
|
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.ComponentModel; |
|
|
|
using System.Text; |
|
|
|
using Avalonia.Animation.Animators; |
|
|
|
|
|
|
|
namespace Avalonia.Media |
|
|
|
@ -43,6 +43,24 @@ namespace Avalonia.Media |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
var sb = new StringBuilder(); |
|
|
|
|
|
|
|
if (Count == 0) |
|
|
|
{ |
|
|
|
return "none"; |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var boxShadow in this) |
|
|
|
{ |
|
|
|
sb.AppendFormat("{0} ", boxShadow.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
return sb.ToString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)] |
|
|
|
public struct BoxShadowsEnumerator |
|
|
|
{ |
|
|
|
|
|
|
|
@ -201,6 +201,65 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Close_Window_On_Alt_F4_When_ComboBox_Is_Focus() |
|
|
|
{ |
|
|
|
var inputManagerMock = new Moq.Mock<IInputManager>(); |
|
|
|
var services = TestServices.StyledWindow.With(inputManager: inputManagerMock.Object); |
|
|
|
|
|
|
|
using (UnitTestApplication.Start(TestServices.StyledWindow)) |
|
|
|
{ |
|
|
|
var window = new Window(); |
|
|
|
|
|
|
|
window.KeyDown += (s, e) => |
|
|
|
{ |
|
|
|
if (e.Handled == false |
|
|
|
&& e.KeyModifiers.HasAllFlags(KeyModifiers.Alt) == true |
|
|
|
&& e.Key == Key.F4 ) |
|
|
|
{ |
|
|
|
e.Handled = true; |
|
|
|
window.Close(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var count = 0; |
|
|
|
|
|
|
|
var target = new ComboBox |
|
|
|
{ |
|
|
|
Items = new[] { new Canvas() }, |
|
|
|
SelectedIndex = 0, |
|
|
|
Template = GetTemplate(), |
|
|
|
}; |
|
|
|
|
|
|
|
window.Content = target; |
|
|
|
|
|
|
|
|
|
|
|
window.Closing += |
|
|
|
(sender, e) => |
|
|
|
{ |
|
|
|
count++; |
|
|
|
}; |
|
|
|
|
|
|
|
window.Show(); |
|
|
|
|
|
|
|
target.Focus(); |
|
|
|
|
|
|
|
_helper.Down(target); |
|
|
|
_helper.Up(target); |
|
|
|
Assert.True(target.IsDropDownOpen); |
|
|
|
|
|
|
|
target.RaiseEvent(new KeyEventArgs |
|
|
|
{ |
|
|
|
RoutedEvent = InputElement.KeyDownEvent, |
|
|
|
KeyModifiers = KeyModifiers.Alt, |
|
|
|
Key = Key.F4 |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Assert.Equal(1, count); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|