summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-05-02 16:19:12 -0600
committerSamantha Houts <samantha@teamredwall.com>2016-05-02 15:19:12 -0700
commit5f8f47ff7ce934f4937ec428b3c1def6286f14da (patch)
tree832d48d28c09eccd8b39838d16b0b9887bff7e55 /Xamarin.Forms.Core
parent70d0e406ec2fcaf8c883d9b7aa2fc287466645ca (diff)
downloadxamarin-forms-5f8f47ff7ce934f4937ec428b3c1def6286f14da.tar.gz
xamarin-forms-5f8f47ff7ce934f4937ec428b3c1def6286f14da.tar.bz2
xamarin-forms-5f8f47ff7ce934f4937ec428b3c1def6286f14da.zip
Prep VisualElement (and descendants) for removal of InternalsVisibleTo (#141)
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/AbsoluteLayout.cs3
-rw-r--r--Xamarin.Forms.Core/Button.cs11
-rw-r--r--Xamarin.Forms.Core/Grid.cs9
-rw-r--r--Xamarin.Forms.Core/IVisualElementController.cs3
-rw-r--r--Xamarin.Forms.Core/Image.cs5
-rw-r--r--Xamarin.Forms.Core/Internals/InvalidationTrigger.cs (renamed from Xamarin.Forms.Core/InvalidationTrigger.cs)4
-rw-r--r--Xamarin.Forms.Core/InvalidationEventArgs.cs1
-rw-r--r--Xamarin.Forms.Core/Label.cs15
-rw-r--r--Xamarin.Forms.Core/Layout.cs7
-rw-r--r--Xamarin.Forms.Core/Page.cs5
-rw-r--r--Xamarin.Forms.Core/StackLayout.cs5
-rw-r--r--Xamarin.Forms.Core/View.cs7
-rw-r--r--Xamarin.Forms.Core/VisualElement.cs22
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj2
14 files changed, 59 insertions, 40 deletions
diff --git a/Xamarin.Forms.Core/AbsoluteLayout.cs b/Xamarin.Forms.Core/AbsoluteLayout.cs
index 51b5ca12..aceec2b3 100644
--- a/Xamarin.Forms.Core/AbsoluteLayout.cs
+++ b/Xamarin.Forms.Core/AbsoluteLayout.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@@ -132,7 +133,7 @@ namespace Xamarin.Forms
{
if (e.PropertyName == LayoutFlagsProperty.PropertyName || e.PropertyName == LayoutBoundsProperty.PropertyName)
{
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
UpdateChildrenLayout();
}
}
diff --git a/Xamarin.Forms.Core/Button.cs b/Xamarin.Forms.Core/Button.cs
index 9c746c9e..72f98814 100644
--- a/Xamarin.Forms.Core/Button.cs
+++ b/Xamarin.Forms.Core/Button.cs
@@ -2,6 +2,7 @@ using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Input;
+using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform;
namespace Xamarin.Forms
@@ -18,7 +19,7 @@ namespace Xamarin.Forms
BindableProperty.Create("ContentLayout", typeof(ButtonContentLayout), typeof(Button), new ButtonContentLayout(ButtonContentLayout.ImagePosition.Left, DefaultSpacing));
public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(Button), null,
- propertyChanged: (bindable, oldVal, newVal) => ((Button)bindable).InvalidateMeasure(InvalidationTrigger.MeasureChanged));
+ propertyChanged: (bindable, oldVal, newVal) => ((Button)bindable).InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged));
public static readonly BindableProperty TextColorProperty = BindableProperty.Create("TextColor", typeof(Color), typeof(Button), Color.Default);
@@ -178,7 +179,7 @@ namespace Xamarin.Forms
if (button._cancelEvents)
return;
- button.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ button.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
button._cancelEvents = true;
@@ -219,7 +220,7 @@ namespace Xamarin.Forms
void OnSourceChanged(object sender, EventArgs eventArgs)
{
OnPropertyChanged(ImageProperty.PropertyName);
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
void OnSourcePropertyChanged(ImageSource oldvalue, ImageSource newvalue)
@@ -229,7 +230,7 @@ namespace Xamarin.Forms
newvalue.SourceChanged += OnSourceChanged;
SetInheritedBindingContext(newvalue, BindingContext);
}
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
void OnSourcePropertyChanging(ImageSource oldvalue, ImageSource newvalue)
@@ -245,7 +246,7 @@ namespace Xamarin.Forms
if (button._cancelEvents)
return;
- button.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ button.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
button._cancelEvents = true;
diff --git a/Xamarin.Forms.Core/Grid.cs b/Xamarin.Forms.Core/Grid.cs
index 442146c2..a0460af5 100644
--- a/Xamarin.Forms.Core/Grid.cs
+++ b/Xamarin.Forms.Core/Grid.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@@ -17,10 +18,10 @@ namespace Xamarin.Forms
public static readonly BindableProperty ColumnSpanProperty = BindableProperty.CreateAttached("ColumnSpan", typeof(int), typeof(Grid), 1, validateValue: (bindable, value) => (int)value >= 1);
public static readonly BindableProperty RowSpacingProperty = BindableProperty.Create("RowSpacing", typeof(double), typeof(Grid), 6d,
- propertyChanged: (bindable, oldValue, newValue) => ((Grid)bindable).InvalidateMeasure(InvalidationTrigger.MeasureChanged));
+ propertyChanged: (bindable, oldValue, newValue) => ((Grid)bindable).InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged));
public static readonly BindableProperty ColumnSpacingProperty = BindableProperty.Create("ColumnSpacing", typeof(double), typeof(Grid), 6d,
- propertyChanged: (bindable, oldValue, newValue) => ((Grid)bindable).InvalidateMeasure(InvalidationTrigger.MeasureChanged));
+ propertyChanged: (bindable, oldValue, newValue) => ((Grid)bindable).InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged));
public static readonly BindableProperty ColumnDefinitionsProperty = BindableProperty.Create("ColumnDefinitions", typeof(ColumnDefinitionCollection), typeof(Grid), null,
validateValue: (bindable, value) => value != null, propertyChanged: (bindable, oldvalue, newvalue) =>
@@ -211,9 +212,9 @@ namespace Xamarin.Forms
view.ComputedConstraint = result;
}
- internal override void InvalidateMeasure(InvalidationTrigger trigger)
+ internal override void InvalidateMeasureInternal(InvalidationTrigger trigger)
{
- base.InvalidateMeasure(trigger);
+ base.InvalidateMeasureInternal(trigger);
_columns = null;
_rows = null;
}
diff --git a/Xamarin.Forms.Core/IVisualElementController.cs b/Xamarin.Forms.Core/IVisualElementController.cs
index 03be293a..672f47de 100644
--- a/Xamarin.Forms.Core/IVisualElementController.cs
+++ b/Xamarin.Forms.Core/IVisualElementController.cs
@@ -1,7 +1,10 @@
+using Xamarin.Forms.Internals;
+
namespace Xamarin.Forms
{
public interface IVisualElementController : IElementController
{
void NativeSizeChanged();
+ void InvalidateMeasure(InvalidationTrigger trigger);
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/Image.cs b/Xamarin.Forms.Core/Image.cs
index 4528f3b9..7d6299ac 100644
--- a/Xamarin.Forms.Core/Image.cs
+++ b/Xamarin.Forms.Core/Image.cs
@@ -1,4 +1,5 @@
using System;
+using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform;
namespace Xamarin.Forms
@@ -110,7 +111,7 @@ namespace Xamarin.Forms
void OnSourceChanged(object sender, EventArgs eventArgs)
{
OnPropertyChanged(SourceProperty.PropertyName);
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
static void OnSourcePropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
@@ -125,7 +126,7 @@ namespace Xamarin.Forms
newvalue.SourceChanged += OnSourceChanged;
SetInheritedBindingContext(newvalue, BindingContext);
}
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
static void OnSourcePropertyChanging(BindableObject bindable, object oldvalue, object newvalue)
diff --git a/Xamarin.Forms.Core/InvalidationTrigger.cs b/Xamarin.Forms.Core/Internals/InvalidationTrigger.cs
index e7db534e..9a4180e4 100644
--- a/Xamarin.Forms.Core/InvalidationTrigger.cs
+++ b/Xamarin.Forms.Core/Internals/InvalidationTrigger.cs
@@ -1,9 +1,9 @@
using System;
-namespace Xamarin.Forms
+namespace Xamarin.Forms.Internals
{
[Flags]
- internal enum InvalidationTrigger
+ public enum InvalidationTrigger
{
Undefined = 0,
MeasureChanged = 1 << 0,
diff --git a/Xamarin.Forms.Core/InvalidationEventArgs.cs b/Xamarin.Forms.Core/InvalidationEventArgs.cs
index d88e2519..1dd5c098 100644
--- a/Xamarin.Forms.Core/InvalidationEventArgs.cs
+++ b/Xamarin.Forms.Core/InvalidationEventArgs.cs
@@ -1,4 +1,5 @@
using System;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
diff --git a/Xamarin.Forms.Core/Label.cs b/Xamarin.Forms.Core/Label.cs
index 1efbd668..1385b763 100644
--- a/Xamarin.Forms.Core/Label.cs
+++ b/Xamarin.Forms.Core/Label.cs
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
+using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform;
namespace Xamarin.Forms
@@ -41,13 +42,13 @@ namespace Xamarin.Forms
{
if (newvalue != null)
((FormattedString)newvalue).PropertyChanged += ((Label)bindable).OnFormattedTextChanged;
- ((Label)bindable).InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ ((Label)bindable).InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
if (newvalue != null)
((Label)bindable).Text = null;
});
public static readonly BindableProperty LineBreakModeProperty = BindableProperty.Create("LineBreakMode", typeof(LineBreakMode), typeof(Label), LineBreakMode.WordWrap,
- propertyChanged: (bindable, oldvalue, newvalue) => ((Label)bindable).InvalidateMeasure(InvalidationTrigger.MeasureChanged));
+ propertyChanged: (bindable, oldvalue, newvalue) => ((Label)bindable).InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged));
bool _cancelEvents;
@@ -158,7 +159,7 @@ namespace Xamarin.Forms
label._cancelEvents = false;
- label.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ label.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
static void OnFontAttributesChanged(BindableObject bindable, object oldValue, object newValue)
@@ -189,7 +190,7 @@ namespace Xamarin.Forms
label._cancelEvents = false;
- label.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ label.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
static void OnFontFamilyChanged(BindableObject bindable, object oldValue, object newValue)
@@ -217,7 +218,7 @@ namespace Xamarin.Forms
}
label._cancelEvents = false;
- label.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ label.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
static void OnFontSizeChanged(BindableObject bindable, object oldValue, object newValue)
@@ -247,7 +248,7 @@ namespace Xamarin.Forms
label._cancelEvents = false;
- label.InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ label.InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
void OnFormattedTextChanged(object sender, PropertyChangedEventArgs e)
@@ -270,7 +271,7 @@ namespace Xamarin.Forms
bool isVerticallyFixed = (label.Constraint & LayoutConstraint.VerticallyFixed) != 0;
bool isSingleLine = !(breakMode == LineBreakMode.CharacterWrap || breakMode == LineBreakMode.WordWrap);
if (!isVerticallyFixed || !isSingleLine)
- ((Label)bindable).InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ ((Label)bindable).InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
if (newvalue != null)
((Label)bindable).FormattedText = null;
}
diff --git a/Xamarin.Forms.Core/Layout.cs b/Xamarin.Forms.Core/Layout.cs
index a7864070..a98e46a1 100644
--- a/Xamarin.Forms.Core/Layout.cs
+++ b/Xamarin.Forms.Core/Layout.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@@ -168,7 +169,7 @@ namespace Xamarin.Forms
protected virtual void InvalidateLayout()
{
_hasDoneLayout = false;
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
if (!_hasDoneLayout)
ForceLayout();
}
@@ -304,11 +305,11 @@ namespace Xamarin.Forms
_allocatedFlag = false;
if (trigger == InvalidationTrigger.RendererReady)
{
- InvalidateMeasure(InvalidationTrigger.RendererReady);
+ InvalidateMeasureInternal(InvalidationTrigger.RendererReady);
}
else
{
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
s_resolutionList.Add(new KeyValuePair<Layout, int>(this, GetElementDepth(this)));
diff --git a/Xamarin.Forms.Core/Page.cs b/Xamarin.Forms.Core/Page.cs
index 903f4b53..2e1caf0f 100644
--- a/Xamarin.Forms.Core/Page.cs
+++ b/Xamarin.Forms.Core/Page.cs
@@ -5,6 +5,7 @@ using System.Collections.Specialized;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform;
namespace Xamarin.Forms
@@ -283,7 +284,7 @@ namespace Xamarin.Forms
}
_allocatedFlag = false;
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
if (!_allocatedFlag && Width >= 0 && Height >= 0)
{
SizeAllocated(Width, Height);
@@ -348,7 +349,7 @@ namespace Xamarin.Forms
view.MeasureInvalidated += OnChildMeasureInvalidated;
OnChildAdded(view);
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
void OnInternalRemoved(VisualElement view)
diff --git a/Xamarin.Forms.Core/StackLayout.cs b/Xamarin.Forms.Core/StackLayout.cs
index 4dc7bfa3..e115a23d 100644
--- a/Xamarin.Forms.Core/StackLayout.cs
+++ b/Xamarin.Forms.Core/StackLayout.cs
@@ -1,4 +1,5 @@
using System;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@@ -73,10 +74,10 @@ namespace Xamarin.Forms
ComputeConstraintForView(view, false);
}
- internal override void InvalidateMeasure(InvalidationTrigger trigger)
+ internal override void InvalidateMeasureInternal(InvalidationTrigger trigger)
{
_layoutInformation = new LayoutInformation();
- base.InvalidateMeasure(trigger);
+ base.InvalidateMeasureInternal(trigger);
}
void AlignOffAxis(LayoutInformation layout, StackOrientation orientation, double widthConstraint, double heightConstraint)
diff --git a/Xamarin.Forms.Core/View.cs b/Xamarin.Forms.Core/View.cs
index d03c74bb..1ff51d9c 100644
--- a/Xamarin.Forms.Core/View.cs
+++ b/Xamarin.Forms.Core/View.cs
@@ -3,16 +3,17 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
public class View : VisualElement, IViewController
{
public static readonly BindableProperty VerticalOptionsProperty = BindableProperty.Create("VerticalOptions", typeof(LayoutOptions), typeof(View), LayoutOptions.Fill,
- propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable).InvalidateMeasure(InvalidationTrigger.VerticalOptionsChanged));
+ propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable).InvalidateMeasureInternal(InvalidationTrigger.VerticalOptionsChanged));
public static readonly BindableProperty HorizontalOptionsProperty = BindableProperty.Create("HorizontalOptions", typeof(LayoutOptions), typeof(View), LayoutOptions.Fill,
- propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable).InvalidateMeasure(InvalidationTrigger.HorizontalOptionsChanged));
+ propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable).InvalidateMeasureInternal(InvalidationTrigger.HorizontalOptionsChanged));
public static readonly BindableProperty MarginProperty = BindableProperty.Create("Margin", typeof(Thickness), typeof(View), default(Thickness), propertyChanged: MarginPropertyChanged);
@@ -100,7 +101,7 @@ namespace Xamarin.Forms
static void MarginPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
- ((View)bindable).InvalidateMeasure(InvalidationTrigger.MarginChanged);
+ ((View)bindable).InvalidateMeasureInternal(InvalidationTrigger.MarginChanged);
}
void ValidateGesture(IGestureRecognizer gesture)
diff --git a/Xamarin.Forms.Core/VisualElement.cs b/Xamarin.Forms.Core/VisualElement.cs
index e93dea6c..da8b8292 100644
--- a/Xamarin.Forms.Core/VisualElement.cs
+++ b/Xamarin.Forms.Core/VisualElement.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Xamarin.Forms.Internals;
namespace Xamarin.Forms
{
@@ -353,7 +354,7 @@ namespace Xamarin.Forms
return;
_isNativeStateConsistent = value;
if (value && IsPlatformEnabled)
- InvalidateMeasure(InvalidationTrigger.RendererReady);
+ InvalidateMeasureInternal(InvalidationTrigger.RendererReady);
}
}
@@ -367,7 +368,7 @@ namespace Xamarin.Forms
_isPlatformEnabled = value;
if (value && IsNativeStateConsistent)
- InvalidateMeasure(InvalidationTrigger.RendererReady);
+ InvalidateMeasureInternal(InvalidationTrigger.RendererReady);
OnIsPlatformEnabledChanged();
}
@@ -428,7 +429,7 @@ namespace Xamarin.Forms
void IVisualElementController.NativeSizeChanged()
{
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
public event EventHandler ChildrenReordered;
@@ -559,9 +560,9 @@ namespace Xamarin.Forms
public event EventHandler<FocusEventArgs> Unfocused;
- protected virtual void InvalidateMeasure()
+ protected virtual void InvalidateMeasureInternal()
{
- InvalidateMeasure(InvalidationTrigger.MeasureChanged);
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
}
protected override void OnChildAdded(Element child)
@@ -647,12 +648,17 @@ namespace Xamarin.Forms
internal event EventHandler<FocusRequestArgs> FocusChangeRequested;
- internal virtual void InvalidateMeasure(InvalidationTrigger trigger)
+ internal virtual void InvalidateMeasureInternal(InvalidationTrigger trigger)
{
_measureCache.Clear();
MeasureInvalidated?.Invoke(this, new InvalidationEventArgs(trigger));
}
+ void IVisualElementController.InvalidateMeasure(InvalidationTrigger trigger)
+ {
+ InvalidateMeasureInternal(trigger);
+ }
+
internal void MockBounds(Rectangle bounds)
{
_mockX = bounds.X;
@@ -672,7 +678,7 @@ namespace Xamarin.Forms
internal virtual void OnIsVisibleChanged(bool oldValue, bool newValue)
{
- InvalidateMeasure(InvalidationTrigger.Undefined);
+ InvalidateMeasureInternal(InvalidationTrigger.Undefined);
}
internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
@@ -746,7 +752,7 @@ namespace Xamarin.Forms
}
element.SelfConstraint = constraint;
- ((VisualElement)bindable).InvalidateMeasure(InvalidationTrigger.SizeRequestChanged);
+ ((VisualElement)bindable).InvalidateMeasureInternal(InvalidationTrigger.SizeRequestChanged);
}
void OnUnfocus()
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 1deca238..24160a53 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -126,7 +126,7 @@
<Compile Include="ImageSourceConverter.cs" />
<Compile Include="INavigation.cs" />
<Compile Include="InvalidationEventArgs.cs" />
- <Compile Include="InvalidationTrigger.cs" />
+ <Compile Include="Internals\InvalidationTrigger.cs" />
<Compile Include="InvalidNavigationException.cs" />
<Compile Include="IOpenGlViewController.cs" />
<Compile Include="IPanGestureController.cs" />