Browse Source

Merge branch 'master' into devtools-layout-alignment

Dariusz Komosiński 4 years ago
parent
commit
15d4528757

+ 1 - 1
.github/PULL_REQUEST_TEMPLATE.md

@@ -18,7 +18,7 @@
 
 - [ ] Added unit tests (if possible)?
 - [ ] Added XML documentation to any related classes?
-- [ ] Consider submitting a PR to https://github.com/AvaloniaUI/Avaloniaui.net with user documentation
+- [ ] Consider submitting a PR to https://github.com/AvaloniaUI/Documentation with user documentation
 
 ## Breaking changes
 <!--- List any breaking changes here. When the PR is merged please add an entry to https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes -->

+ 1 - 0
native/Avalonia.Native/src/OSX/window.h

@@ -34,6 +34,7 @@ class WindowBaseImpl;
 -(double) getScaling;
 -(double) getExtendedTitleBarHeight;
 -(void) setIsExtended:(bool)value;
+-(void) updateShadow;
 @end
 
 struct INSWindowHolder

+ 18 - 1
native/Avalonia.Native/src/OSX/window.mm

@@ -124,7 +124,11 @@ public:
             [Window setTitle:_lastTitle];
             
             _shown = true;
-        
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [Window updateShadow];
+            });
+            
             return S_OK;
         }
     }
@@ -1838,6 +1842,19 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent
     double _lastScaling;
 }
 
+- (void)updateShadow
+{
+    // Common problem in Cocoa where [invalidateShadow] does work,
+    // This hack forces Cocoa to invalidate the shadow.
+    
+    NSRect frame = [self frame];
+    NSRect updatedFrame = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width + 1.0, frame.size.height + 1.0);
+    [self setFrame:updatedFrame display:YES];
+    [self setFrame:frame display:YES];
+    
+    [self invalidateShadow];
+}
+
 -(void) setIsExtended:(bool)value;
 {
     _isExtended = value;

+ 1 - 1
src/Avalonia.Controls/DateTimePickers/TimePicker.cs

@@ -8,7 +8,7 @@ using System.Globalization;
 namespace Avalonia.Controls
 {
     /// <summary>
-    /// A control to allow the user to select a time
+    /// A control to allow the user to select a time.
     /// </summary>
     [PseudoClasses(":hasnotime")]
     public class TimePicker : TemplatedControl

+ 21 - 0
src/Avalonia.Controls/Expander.cs

@@ -4,14 +4,35 @@ using Avalonia.Controls.Primitives;
 
 namespace Avalonia.Controls
 {
+    /// <summary>
+    /// Direction in which an <see cref="Expander"/> control opens.
+    /// </summary>
     public enum ExpandDirection
     {
+        /// <summary>
+        /// Opens down.
+        /// </summary>
         Down,
+
+        /// <summary>
+        /// Opens up.
+        /// </summary>
         Up,
+
+        /// <summary>
+        /// Opens left.
+        /// </summary>
         Left,
+
+        /// <summary>
+        /// Opens right.
+        /// </summary>
         Right
     }
 
+    /// <summary>
+    /// A control with a header that has a collapsible content section.
+    /// </summary>
     [PseudoClasses(":expanded", ":up", ":down", ":left", ":right")]
     public class Expander : HeaderedContentControl
     {

+ 1 - 1
src/Avalonia.Controls/Grid.cs

@@ -17,7 +17,7 @@ using Avalonia.VisualTree;
 namespace Avalonia.Controls
 {
     /// <summary>
-    /// Grid
+    /// Defines a flexible grid area that consists of columns and rows.
     /// </summary>
     public class Grid : Panel
     {

+ 18 - 0
src/Avalonia.Controls/Primitives/ScrollBarVisibility.cs

@@ -1,10 +1,28 @@
 namespace Avalonia.Controls.Primitives
 {
+    /// <summary>
+    /// Specifies the visibility of a <see cref="ScrollBar"/> for scrollable content.
+    /// </summary>
     public enum ScrollBarVisibility
     {
+        /// <summary>
+        /// No scrollbars and no scrolling in this dimension.
+        /// </summary>
         Disabled,
+
+        /// <summary>
+        /// The scrollbar should be visible only if there is more content than fits in the viewport.
+        /// </summary>
         Auto,
+
+        /// <summary>
+        /// The scrollbar should never be visible.  No space should ever be reserved for the scrollbar.
+        /// </summary>
         Hidden,
+
+        /// <summary>
+        /// The scrollbar should always be visible.  Space should always be reserved for the scrollbar.
+        /// </summary>
         Visible,
     }
 }

+ 3 - 0
src/Avalonia.Controls/RadioButton.cs

@@ -8,6 +8,9 @@ using Avalonia.VisualTree;
 
 namespace Avalonia.Controls
 {
+    /// <summary>
+    /// Represents a button that allows a user to select a single option from a group of options.
+    /// </summary>
     public class RadioButton : ToggleButton
     {
         private class RadioButtonGroupManager

+ 3 - 0
src/Avalonia.Controls/RelativePanel.cs

@@ -8,6 +8,9 @@ using Avalonia.Layout;
 
 namespace Avalonia.Controls
 {
+    /// <summary>
+    /// Defines an area within which you can position and align child objects in relation to each other or the parent panel.
+    /// </summary>
     public partial class RelativePanel : Panel
     {
         private readonly Graph _childGraph;

+ 3 - 0
src/Avalonia.Controls/RepeatButton.cs

@@ -4,6 +4,9 @@ using Avalonia.Threading;
 
 namespace Avalonia.Controls
 {
+    /// <summary>
+    /// Represents a control that raises its <see cref="Button.Click"/> event repeatedly when it is pressed and held.
+    /// </summary>
     public class RepeatButton : Button
     {
         /// <summary>

+ 13 - 2
src/Avalonia.Controls/TextBox.cs

@@ -17,6 +17,9 @@ using Avalonia.Controls.Metadata;
 
 namespace Avalonia.Controls
 {
+    /// <summary>
+    /// Represents a control that can be used to display or edit unformatted text.
+    /// </summary>
     [PseudoClasses(":empty")]
     public class TextBox : TemplatedControl, UndoRedoHelper<TextBox.UndoRedoState>.IUndoRedoHost
     {
@@ -260,7 +263,11 @@ namespace Avalonia.Controls
             set
             {
                 value = CoerceCaretIndex(value);
-                SetAndRaise(SelectionStartProperty, ref _selectionStart, value);
+                var changed = SetAndRaise(SelectionStartProperty, ref _selectionStart, value);
+                if (changed)
+                {
+                    UpdateCommandStates();
+                }
                 if (SelectionStart == SelectionEnd)
                 {
                     CaretIndex = SelectionStart;
@@ -278,7 +285,11 @@ namespace Avalonia.Controls
             set
             {
                 value = CoerceCaretIndex(value);
-                SetAndRaise(SelectionEndProperty, ref _selectionEnd, value);
+                var changed = SetAndRaise(SelectionEndProperty, ref _selectionEnd, value);
+                if (changed)
+                {
+                    UpdateCommandStates();
+                }
                 if (SelectionStart == SelectionEnd)
                 {
                     CaretIndex = SelectionEnd;

+ 1 - 3
src/Avalonia.Native/WindowImplBase.cs

@@ -414,9 +414,7 @@ namespace Avalonia.Native
 
         public Action<RawInputEventArgs> Input { get; set; }
 
-        Action<double> ScalingChanged { get; set; }
-
-        Action<double> ITopLevelImpl.ScalingChanged { get; set; }
+        public Action<double> ScalingChanged { get; set; }
 
         public Action<WindowTransparencyLevel> TransparencyLevelChanged { get; set; }