Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Louis <savagesoftware@gmail.com>2019-05-01 17:18:55 +0300
committerGitHub <noreply@github.com>2019-05-01 17:18:55 +0300
commitf74e027bd387a82be39e9458ddea1d9edfefaa0a (patch)
tree106aff18d3abd48bec9026a16e0ed819e28b2551 /Xamarin.PropertyEditing.Mac/Controls
parent40c2ea08e7c2796b73e464bda91353551a477e27 (diff)
parent0cd63e77cd637189dd901bc29cca8286ab9fdf7e (diff)
Merge pull request #590 from xamarin/dominique-Fix587
[Mac] Move appearance setting calls outside ViewDidChangeEffectiveApp…
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs15
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs16
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs22
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs18
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/CollectionEditorControl.cs18
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs17
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/ColorEditorView.cs11
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs21
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs14
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/SpinnerButton.cs11
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/TabButton.cs12
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/GroupEditorControl.cs11
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs11
13 files changed, 132 insertions, 65 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs
index 142e9dd..dde6136 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BasePathEditorControl.cs
@@ -93,13 +93,6 @@ namespace Xamarin.PropertyEditing.Mac
{
this.panel.BeginSheet (this.Window, HandleAction);
}
-
- public override void ViewDidChangeEffectiveAppearance ()
- {
- this.revealPathButton.Image = HostResources.GetNamedImage (PathRevealName);
- this.browsePathButton.Image = HostResources.GetNamedImage (PathBrowseName);
- base.ViewDidChangeEffectiveAppearance ();
- }
protected abstract void OnRevealPathButtonActivated (object sender, EventArgs e);
protected abstract void StoreCurrentValue ();
@@ -128,6 +121,14 @@ namespace Xamarin.PropertyEditing.Mac
this.browsePathButton.Activated -= BrowsePathButton_Activated;
this.revealPathButton.Activated -= OnRevealPathButtonActivated;
base.Dispose (disposing);
+ }
+
+ protected override void AppearanceChanged ()
+ {
+ base.AppearanceChanged ();
+
+ this.revealPathButton.Image = HostResources.GetNamedImage (PathRevealName);
+ this.browsePathButton.Image = HostResources.GetNamedImage (PathBrowseName);
}
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs
index e964340..e60f5f4 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BasePointEditorControl.cs
@@ -68,13 +68,7 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (YLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, YEditor.Subviews[0], NSLayoutAttribute.CenterX, 1f, 0),
});
- ViewDidChangeEffectiveAppearance ();
- }
-
- public override void ViewDidChangeEffectiveAppearance ()
- {
- XLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
- YLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ AppearanceChanged ();
}
protected override void SetEnabled ()
@@ -96,5 +90,13 @@ namespace Xamarin.PropertyEditing.Mac
{
ViewModel.Value = (T)Activator.CreateInstance (typeof (T), XEditor.Value, YEditor.Value);
}
+
+ protected override void AppearanceChanged ()
+ {
+ base.AppearanceChanged ();
+
+ XLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ YLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ }
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs
index d5e038c..005ef89 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BaseRectangleEditorControl.cs
@@ -114,17 +114,7 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (HeightLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, HeightEditor.Subviews[0], NSLayoutAttribute.CenterX, 1f, 0),
});
- ViewDidChangeEffectiveAppearance ();
- }
-
- public override void ViewDidChangeEffectiveAppearance ()
- {
- XLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
- YLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
- WidthLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
- HeightLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
-
- base.ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
protected virtual void OnInputUpdated (object sender, EventArgs e)
@@ -154,5 +144,15 @@ namespace Xamarin.PropertyEditing.Mac
HeightEditor.AccessibilityEnabled = HeightEditor.Enabled;
HeightEditor.AccessibilityTitle = string.Format (Properties.Resources.AccessibilityHeightEditor, ViewModel.Property.Name);
}
+
+ protected override void AppearanceChanged ()
+ {
+ base.AppearanceChanged ();
+
+ XLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ YLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ WidthLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ HeightLabel.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ }
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
index cdae3b1..19b4750 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
@@ -69,15 +69,7 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (this.popUpButton, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0),
});
- ViewDidChangeEffectiveAppearance ();
- }
-
- public override void ViewDidChangeEffectiveAppearance ()
- {
- base.ViewDidChangeEffectiveAppearance ();
-
- this.popover.SetAppearance (HostResources.GetVibrantAppearance (EffectiveAppearance));
- this.popover.ContentViewController.View.Appearance = EffectiveAppearance;
+ AppearanceChanged ();
}
readonly ColorPopUpButton popUpButton;
@@ -132,5 +124,13 @@ namespace Xamarin.PropertyEditing.Mac
}
}
}
+
+ protected override void AppearanceChanged ()
+ {
+ base.AppearanceChanged ();
+
+ this.popover.SetAppearance (HostResources.GetVibrantAppearance (EffectiveAppearance));
+ this.popover.ContentViewController.View.Appearance = EffectiveAppearance;
+ }
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorControl.cs
index e300f08..27297e3 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/CollectionEditorControl.cs
@@ -162,7 +162,7 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (removeBorder, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, 22),
});
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
public override void OnViewModelChanged (CollectionPropertyViewModel oldModel)
@@ -244,9 +244,9 @@ namespace Xamarin.PropertyEditing.Mac
}
}
- public override void ViewDidChangeEffectiveAppearance ()
+ protected override void AppearanceChanged ()
{
- base.ViewDidChangeEffectiveAppearance ();
+ base.AppearanceChanged ();
this.add.Image = this.hostResources.GetNamedImage ("pe-list-add-16");
this.remove.Image = this.hostResources.GetNamedImage ("pe-list-remove-16");
@@ -353,7 +353,7 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (this.label, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0)
});
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
public CollectionPropertyItemViewModel ViewModel
@@ -370,10 +370,16 @@ namespace Xamarin.PropertyEditing.Mac
}
}
- public override void ViewDidChangeEffectiveAppearance ()
+ public sealed override void ViewDidChangeEffectiveAppearance ()
{
- UpdateIcon ();
base.ViewDidChangeEffectiveAppearance ();
+
+ AppearanceChanged ();
+ }
+
+ private void AppearanceChanged ()
+ {
+ UpdateIcon ();
}
private readonly IIconProvider iconProvider;
diff --git a/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs
index bdb7bb4..54056ac 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs
@@ -40,7 +40,7 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (this.openCollection, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, -6)
});
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
public override NSView FirstKeyView => this.openCollection;
@@ -52,12 +52,6 @@ namespace Xamarin.PropertyEditing.Mac
this.openCollection.Enabled = ViewModel?.Property.CanWrite ?? false;
}
- public override void ViewDidChangeEffectiveAppearance ()
- {
- base.ViewDidChangeEffectiveAppearance ();
- this.label.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
- }
-
protected override void UpdateAccessibilityValues ()
{
base.UpdateAccessibilityValues ();
@@ -66,6 +60,13 @@ namespace Xamarin.PropertyEditing.Mac
}
private readonly UnfocusableTextField label;
- private readonly NSButton openCollection;
+ private readonly NSButton openCollection;
+
+ protected override void AppearanceChanged ()
+ {
+ base.AppearanceChanged ();
+
+ this.label.TextColor = HostResources.GetNamedColor (NamedResources.DescriptionLabelColor);
+ }
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorEditorView.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorEditorView.cs
index aac2018..21f4753 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorEditorView.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorEditorView.cs
@@ -43,6 +43,17 @@ namespace Xamarin.PropertyEditing.Mac
public virtual void OnPropertyChanged (object sender, PropertyChangedEventArgs e)
{
}
+
+ protected virtual void AppearanceChanged ()
+ {
+ }
+
+ public sealed override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+
+ AppearanceChanged ();
+ }
}
internal abstract class ColorEditorView : NotifyingView<SolidBrushViewModel>
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs
index a3483a1..7a6aedd 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/DynamicBox.cs
@@ -32,7 +32,7 @@ namespace Xamarin.PropertyEditing.Mac
set
{
this.hostResources = value;
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
}
@@ -45,7 +45,7 @@ namespace Xamarin.PropertyEditing.Mac
if (value == null)
FillColor = NSColor.Clear;
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
}
@@ -58,11 +58,21 @@ namespace Xamarin.PropertyEditing.Mac
if (value == null)
BorderColor = NSColor.Clear;
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
}
- public override void ViewDidChangeEffectiveAppearance ()
+ public sealed override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+
+ AppearanceChanged ();
+ }
+
+ private IHostResourceProvider hostResources;
+ private string fillColor, borderColor;
+
+ private void AppearanceChanged ()
{
if (this.fillColor != null) {
NSColor color = this.hostResources.GetNamedColor (this.fillColor);
@@ -80,8 +90,5 @@ namespace Xamarin.PropertyEditing.Mac
BorderColor = color;
}
}
-
- private IHostResourceProvider hostResources;
- private string fillColor, borderColor;
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs
index e8d908d..b831f5b 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs
@@ -54,11 +54,19 @@ namespace Xamarin.PropertyEditing.Mac
OnMouseLeftDown += (sender, e) => {
PopUpContextMenu ();
};
+
+ AppearanceChanged ();
}
- public override void ViewDidChangeEffectiveAppearance ()
+ public sealed override void ViewDidChangeEffectiveAppearance ()
{
base.ViewDidChangeEffectiveAppearance ();
+
+ AppearanceChanged ();
+ }
+
+ private void AppearanceChanged ()
+ {
ToggleFocusImage ();
}
@@ -120,9 +128,9 @@ namespace Xamarin.PropertyEditing.Mac
private void ToggleFocusImage (bool focused = false)
{
- if (viewModel != null) {
+ if (this.viewModel != null) {
- switch (viewModel.ValueSource) {
+ switch (this.viewModel.ValueSource) {
case ValueSource.Binding:
Image = focused ? this.hostResources.GetNamedImage ("pe-property-button-bound-mac-active-10") : this.hostResources.GetNamedImage ("pe-property-button-bound-mac-10");
break;
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/SpinnerButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/SpinnerButton.cs
index d0d942c..2b82a62 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/SpinnerButton.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/SpinnerButton.cs
@@ -27,7 +27,7 @@ namespace Xamarin.PropertyEditing.Mac
this.hostResources = hostResource;
this.imageBase += (isUp) ? "up" : "down";
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
public override void MouseExited (NSEvent theEvent)
@@ -42,7 +42,14 @@ namespace Xamarin.PropertyEditing.Mac
UpdateImage ();
}
- public override void ViewDidChangeEffectiveAppearance ()
+ public sealed override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+
+ AppearanceChanged ();
+ }
+
+ private void AppearanceChanged ()
{
this.image = this.hostResources.GetNamedImage (this.imageBase);
this.mouseOverImage = this.hostResources.GetNamedImage (this.imageBase + "-focus-blue");
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/TabButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/TabButton.cs
index e185105..ad18e31 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/TabButton.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/TabButton.cs
@@ -24,7 +24,7 @@ namespace Xamarin.PropertyEditing.Mac
this.hostResource = hostResource;
this.imageName = imageName;
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
public event EventHandler Clicked;
@@ -48,10 +48,11 @@ namespace Xamarin.PropertyEditing.Mac
}
}
- public override void ViewDidChangeEffectiveAppearance ()
+ public sealed override void ViewDidChangeEffectiveAppearance ()
{
base.ViewDidChangeEffectiveAppearance ();
- Image = this.hostResource.GetNamedImage (this.imageName);
+
+ AppearanceChanged ();
}
public override void DrawRect (CGRect dirtyRect)
@@ -66,6 +67,11 @@ namespace Xamarin.PropertyEditing.Mac
path.Fill ();
}
+ private void AppearanceChanged ()
+ {
+ Image = this.hostResource.GetNamedImage (this.imageName);
+ }
+
private readonly string imageName;
private readonly IHostResourceProvider hostResource;
private bool selected;
diff --git a/Xamarin.PropertyEditing.Mac/Controls/GroupEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/GroupEditorControl.cs
index 7b6ada3..c528866 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/GroupEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/GroupEditorControl.cs
@@ -45,7 +45,7 @@ namespace Xamarin.PropertyEditing.Mac
AddSubview (this.container);
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
}
NSView INativeContainer.NativeView => this;
@@ -80,7 +80,14 @@ namespace Xamarin.PropertyEditing.Mac
return ((nint)this.table.RowHeight * gvm.Properties.Count) + editorHeight;
}
- public override void ViewDidChangeEffectiveAppearance ()
+ public sealed override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+
+ AppearanceChanged ();
+ }
+
+ private void AppearanceChanged ()
{
this.table.BackgroundColor = this.hostResources.GetNamedColor (NamedResources.PadBackgroundColor);
this.host.FillColor = this.hostResources.GetNamedColor (NamedResources.ValueBlockBackgroundColor);
diff --git a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs
index 429d014..4b1e9b4 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/PropertyEditorControl.cs
@@ -128,6 +128,17 @@ namespace Xamarin.PropertyEditing.Mac
protected virtual void UpdateAccessibilityValues ()
{
}
+
+ protected virtual void AppearanceChanged ()
+ {
+ }
+
+ public sealed override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+
+ AppearanceChanged ();
+ }
}
internal abstract class PropertyEditorControl<TViewModel>