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:
authorEric Maupin <ermaup@microsoft.com>2019-06-21 01:22:55 +0300
committerEric Maupin <ermaup@microsoft.com>2019-06-21 01:22:55 +0300
commit889b566e477b6ebc8559cf955a717bd0855d0fad (patch)
tree55be606c2a61f2a73b72955eede385c46619d451
parent230c1d0e80f03b14299052d018399bbeef0a1f05 (diff)
[mac] Flush out more foreground useermau-mac-label-colors
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs2
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs21
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs2
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs2
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/AutocompleteComboBox.cs68
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/CommandMenuItem.cs28
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs25
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs48
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableComboBox.cs40
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/FocusablePopupButton.cs61
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs26
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs9
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/FilePathEditorControl.cs7
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs4
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs2
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs4
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs4
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs2
18 files changed, 256 insertions, 99 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs
index 1212fef..1fbc09d 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BooleanEditorControl.cs
@@ -13,7 +13,7 @@ namespace Xamarin.PropertyEditing.Mac
public BooleanEditorControl (IHostResourceProvider hostResource)
: base (hostResource)
{
- BooleanEditor = new FocusableBooleanButton ();
+ BooleanEditor = new FocusableBooleanButton (hostResource);
// update the value on 'enter'
BooleanEditor.Activated += (sender, e) => {
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
index 19b4750..3626a16 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.ComponentModel;
using AppKit;
using CoreGraphics;
+using Foundation;
using Xamarin.PropertyEditing.Drawing;
using Xamarin.PropertyEditing.ViewModels;
@@ -10,6 +11,11 @@ namespace Xamarin.PropertyEditing.Mac
{
internal class ColorPopUpButton : FocusablePopUpButton
{
+ public ColorPopUpButton (IHostResourceProvider hostResources)
+ : base (hostResources)
+ {
+ }
+
public NSPopover Popover { get; set; }
public override void MouseDown (NSEvent theEvent)
@@ -52,7 +58,7 @@ namespace Xamarin.PropertyEditing.Mac
}
};
- this.popUpButton = new ColorPopUpButton {
+ this.popUpButton = new ColorPopUpButton (hostResources) {
ControlSize = NSControlSize.Small,
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
TranslatesAutoresizingMaskIntoConstraints = false,
@@ -86,7 +92,7 @@ namespace Xamarin.PropertyEditing.Mac
this.popUpButton.Enabled = this.ViewModel?.Property.CanWrite ?? false;
}
- string GetTitle ()
+ NSAttributedString GetTitle ()
{
var title = Properties.Resources.CommonBrushTitleUnknown;
switch (ViewModel.Value) {
@@ -102,7 +108,8 @@ namespace Xamarin.PropertyEditing.Mac
break;
}
- return title;
+ var color = HostResources.GetNamedColor (NamedResources.ForegroundColor);
+ return new NSAttributedString (title, new NSStringAttributes { ForegroundColor = color });
}
protected override void UpdateValue ()
@@ -111,17 +118,13 @@ namespace Xamarin.PropertyEditing.Mac
this.popUpButton.Popover = (ViewModel?.Property.CanWrite ?? false) ? this.popover : null;
if (ViewModel.Solid != null) {
- var title = GetTitle ();
-
if (this.popupButtonList.Count == 0)
this.popupButtonList.AddItem (new NSMenuItem ());
this.previewLayer.Brush = ViewModel.Value;
var item = this.popupButtonList.ItemAt (0);
- if (item.Title != title) {
- item.Title = title;
- item.Image = this.previewLayer.RenderPreview ();
- }
+ item.AttributedTitle = GetTitle();
+ item.Image = this.previewLayer.RenderPreview ();
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs
index 3a8dca9..f541aad 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/CollectionInlineEditorControl.cs
@@ -18,7 +18,7 @@ namespace Xamarin.PropertyEditing.Mac
AddSubview (this.label);
- this.openCollection = new FocusableButton {
+ this.openCollection = new FocusableButton (hostResources) {
Title = Properties.Resources.CollectionEditButton,
BezelStyle = NSBezelStyle.Rounded,
AccessibilityEnabled = true,
diff --git a/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs
index c62c822..b20a8af 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/CombinablePropertyEditor.cs
@@ -61,7 +61,7 @@ namespace Xamarin.PropertyEditing.Mac
NSButton checkbox;
if (i >= this.combinableList.Count) {
- checkbox = new FocusableBooleanButton ();
+ checkbox = new FocusableBooleanButton (HostResources);
checkbox.Activated += SelectionChanged;
AddSubview (checkbox);
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/AutocompleteComboBox.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/AutocompleteComboBox.cs
index a7b819f..e576da3 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/AutocompleteComboBox.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/AutocompleteComboBox.cs
@@ -13,22 +13,6 @@ namespace Xamarin.PropertyEditing.Mac.Controls
{
internal class AutocompleteComboBox : NSComboBox
{
- private readonly PropertyViewModel viewModel;
- private readonly PropertyInfo previewCustomExpressionPropertyInfo;
- public PropertyInfo PreviewCustomExpressionPropertyInfo
- {
- get { return this.PreviewCustomExpressionPropertyInfo; }
- set {
- this.PreviewCustomExpressionPropertyInfo = value;
- }
- }
- private ObservableCollectionEx<string> values;
-
- protected IHostResourceProvider HostResources {
- get;
- private set;
- }
-
public AutocompleteComboBox (IHostResourceProvider hostResources, PropertyViewModel viewModel, ObservableCollectionEx<string> values, PropertyInfo previewCustomExpressionPropertyInfo)
{
if (hostResources == null)
@@ -108,9 +92,57 @@ namespace Xamarin.PropertyEditing.Mac.Controls
UpdatePropertyInfo ();
- ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
+ }
+
+ public string TextColorName
+ {
+ get => this.textColorName;
+ set
+ {
+ if (this.textColorName == value)
+ return;
+
+ this.textColorName = value;
+ AppearanceChanged ();
+ }
+ }
+
+ public PropertyInfo PreviewCustomExpressionPropertyInfo
+ {
+ get { return this.PreviewCustomExpressionPropertyInfo; }
+ set
+ {
+ this.PreviewCustomExpressionPropertyInfo = value;
+ }
+ }
+
+ protected IHostResourceProvider HostResources
+ {
+ get;
+ private set;
}
+ public override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
+ }
+
+ protected virtual void AppearanceChanged ()
+ {
+ if (HostResources == null)
+ return;
+
+ TextColor = HostResources.GetNamedColor (TextColorName);
+ }
+
+ private readonly PropertyViewModel viewModel;
+ private readonly PropertyInfo previewCustomExpressionPropertyInfo;
+
+ private ObservableCollectionEx<string> values;
+ private string textColorName = NamedResources.ForegroundColor;
+
private void Reset ()
{
RemoveAll ();
@@ -124,7 +156,7 @@ namespace Xamarin.PropertyEditing.Mac.Controls
}
}
- public void UpdatePropertyInfo ()
+ private void UpdatePropertyInfo ()
{
this.previewCustomExpressionPropertyInfo.SetValue (this.viewModel, StringValue);
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommandMenuItem.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommandMenuItem.cs
index 1a84424..4d9cbac 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/CommandMenuItem.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/CommandMenuItem.cs
@@ -4,8 +4,24 @@ using AppKit;
namespace Xamarin.PropertyEditing.Mac
{
- public class CommandMenuItem : NSMenuItem
+ internal class CommandMenuItem
+ : ThemedMenuItem
{
+ public CommandMenuItem (IHostResourceProvider hostResources, string title)
+ : base (hostResources, title)
+ {
+ HookUpCommandEvents ();
+ }
+
+ public CommandMenuItem (IHostResourceProvider hostResources, string title, ICommand command)
+ : this (hostResources, title)
+ {
+ if (command == null)
+ throw new ArgumentNullException (nameof (command));
+
+ Command = command;
+ }
+
ICommand command;
public ICommand Command {
@@ -21,16 +37,6 @@ namespace Xamarin.PropertyEditing.Mac
}
}
- public CommandMenuItem (string title) : base (title)
- {
- HookUpCommandEvents ();
- }
-
- public CommandMenuItem (string title, ICommand command) : this (title)
- {
- this.Command = command;
- }
-
private void HookUpCommandEvents ()
{
Activated += (object sender, EventArgs e) => {
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs
index f8ed20d..749b9cd 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs
@@ -1,33 +1,16 @@
-using System;
using AppKit;
namespace Xamarin.PropertyEditing.Mac
{
- internal class FocusableBooleanButton : NSButton
+ internal class FocusableBooleanButton
+ : FocusableButton
{
public override bool CanBecomeKeyView { get { return Enabled; } }
- public FocusableBooleanButton ()
+ public FocusableBooleanButton (IHostResourceProvider hostResources)
+ : base (hostResources)
{
- AllowsExpansionToolTips = true;
- AllowsMixedState = true;
- Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
- Cell.UsesSingleLineMode = true;
- ControlSize = NSControlSize.Small;
- Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small));
- Title = string.Empty;
- TranslatesAutoresizingMaskIntoConstraints = false;
-
SetButtonType (NSButtonType.Switch);
}
-
- public override bool BecomeFirstResponder ()
- {
- var willBecomeFirstResponder = base.BecomeFirstResponder ();
- if (willBecomeFirstResponder) {
- ScrollRectToVisible (Bounds);
- }
- return willBecomeFirstResponder;
- }
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs
index 9e3366d..a789416 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableButton.cs
@@ -1,5 +1,6 @@
using System;
using AppKit;
+using Foundation;
namespace Xamarin.PropertyEditing.Mac
{
@@ -7,8 +8,12 @@ namespace Xamarin.PropertyEditing.Mac
{
public override bool CanBecomeKeyView { get { return Enabled; } }
- public FocusableButton ()
+ public FocusableButton (IHostResourceProvider hostResources)
{
+ if (hostResources == null)
+ throw new ArgumentNullException (nameof (hostResources));
+
+ this.hostResources = hostResources;
AllowsExpansionToolTips = true;
AllowsMixedState = true;
Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
@@ -19,6 +24,29 @@ namespace Xamarin.PropertyEditing.Mac
TranslatesAutoresizingMaskIntoConstraints = false;
}
+ public string TextColorName
+ {
+ get => this.textColorName;
+ set
+ {
+ if (this.textColorName == value)
+ return;
+
+ this.textColorName = value;
+ AppearanceChanged ();
+ }
+ }
+
+ public override string Title
+ {
+ get => base.Title;
+ set
+ {
+ base.Title = value;
+ AppearanceChanged ();
+ }
+ }
+
public override bool BecomeFirstResponder ()
{
var willBecomeFirstResponder = base.BecomeFirstResponder ();
@@ -27,5 +55,23 @@ namespace Xamarin.PropertyEditing.Mac
}
return willBecomeFirstResponder;
}
+
+ public override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
+ }
+
+ protected virtual void AppearanceChanged ()
+ {
+ if (this.hostResources == null)
+ return;
+
+ var attr = new NSStringAttributes { ForegroundColor = this.hostResources.GetNamedColor (TextColorName) };
+ AttributedTitle = new NSAttributedString (Title, attr);
+ }
+
+ private string textColorName = NamedResources.ForegroundColor;
+ private readonly IHostResourceProvider hostResources;
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableComboBox.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableComboBox.cs
index 577ce4b..89d45e5 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableComboBox.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableComboBox.cs
@@ -1,10 +1,33 @@
using Foundation;
using AppKit;
+using System;
namespace Xamarin.PropertyEditing.Mac
{
internal class FocusableComboBox : NSComboBox
{
+ public FocusableComboBox (IHostResourceProvider hostResources)
+ {
+ if (hostResources == null)
+ throw new ArgumentNullException (nameof (hostResources));
+
+ this.hostResources = hostResources;
+ AppearanceChanged ();
+ }
+
+ public string TextColorName
+ {
+ get => this.textColorName;
+ set
+ {
+ if (this.textColorName == value)
+ return;
+
+ this.textColorName = value;
+ AppearanceChanged ();
+ }
+ }
+
public override bool BecomeFirstResponder ()
{
var willBecomeFirstResponder = base.BecomeFirstResponder ();
@@ -25,6 +48,23 @@ namespace Xamarin.PropertyEditing.Mac
base.DidBeginEditing (notification);
}
+ public override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
+ }
+
+ protected virtual void AppearanceChanged()
+ {
+ if (this.hostResources == null)
+ return;
+
+ TextColor = this.hostResources.GetNamedColor (TextColorName);
+ }
+
+ private readonly IHostResourceProvider hostResources;
+ private string textColorName = NamedResources.ForegroundColor;
+
class FocusableComboBoxDelegate : NSTextDelegate
{
public override bool TextShouldEndEditing (NSText textObject)
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusablePopupButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusablePopupButton.cs
index 4c9d392..243e63f 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusablePopupButton.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusablePopupButton.cs
@@ -1,11 +1,46 @@
using System;
using AppKit;
using CoreGraphics;
+using Foundation;
namespace Xamarin.PropertyEditing.Mac
{
internal class FocusablePopUpButton : NSPopUpButton
{
+ public FocusablePopUpButton (IHostResourceProvider hostResources)
+ {
+ if (hostResources == null)
+ throw new ArgumentNullException (nameof (hostResources));
+
+ this.hostResources = hostResources;
+ }
+
+ public string TextColorName
+ {
+ get => this.textColorName;
+ set
+ {
+ if (this.textColorName == value)
+ return;
+
+ this.textColorName = value;
+ AppearanceChanged ();
+ }
+ }
+
+ public override string Title
+ {
+ get => base.Title;
+ set
+ {
+ if (base.Title == value)
+ return;
+
+ base.Title = value;
+ AppearanceChanged ();
+ }
+ }
+
public override bool CanBecomeKeyView { get { return Enabled; } }
public override bool BecomeFirstResponder ()
@@ -16,5 +51,31 @@ namespace Xamarin.PropertyEditing.Mac
}
return willBecomeFirstResponder;
}
+
+ public override void ViewDidChangeEffectiveAppearance ()
+ {
+ base.ViewDidChangeEffectiveAppearance ();
+ AppearanceChanged ();
+ }
+
+ protected virtual void AppearanceChanged ()
+ {
+ if (this.hostResources == null)
+ return;
+
+ var attr = new NSStringAttributes { ForegroundColor = this.hostResources.GetNamedColor (TextColorName) };
+ AttributedTitle = new NSAttributedString (Title, attr);
+
+ NSMenuItem[] items = Menu?.Items;
+ if (items != null) {
+ foreach (NSMenuItem item in items) {
+ if (item is ThemedMenuItem themedItem)
+ themedItem.AppearanceChanged ();
+ }
+ }
+ }
+
+ private string textColorName = NamedResources.ForegroundColor;
+ private readonly IHostResourceProvider hostResources;
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs
index 3e3347a..b7752b1 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs
@@ -78,14 +78,7 @@ namespace Xamarin.PropertyEditing.Mac
this.popUpContextMenu = new NSMenu ();
if (this.viewModel.TargetPlatform.SupportsCustomExpressions) {
- var mi = new NSMenuItem (Properties.Resources.CustomExpressionEllipsis) {
- AttributedTitle = new Foundation.NSAttributedString (
- Properties.Resources.CustomExpressionEllipsis,
- new CoreText.CTStringAttributes {
- Font = new CoreText.CTFont (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize + 1),
- })
- };
-
+ var mi = new ThemedMenuItem (this.hostResources, Properties.Resources.CustomExpressionEllipsis);
mi.Activated += OnCustomExpression;
this.popUpContextMenu.AddItem (mi);
@@ -95,14 +88,7 @@ namespace Xamarin.PropertyEditing.Mac
if (this.viewModel.SupportsResources) {
this.popUpContextMenu.AddItem (NSMenuItem.SeparatorItem);
- var mi2 = new NSMenuItem (Properties.Resources.ResourceEllipsis) {
- AttributedTitle = new Foundation.NSAttributedString (
- Properties.Resources.ResourceEllipsis,
- new CoreText.CTStringAttributes {
- Font = new CoreText.CTFont (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize + 1),
- })
- };
-
+ var mi2 = new ThemedMenuItem (this.hostResources, Properties.Resources.ResourceEllipsis);
mi2.Activated += OnResourceRequested;
this.popUpContextMenu.AddItem (mi2);
}
@@ -110,13 +96,7 @@ namespace Xamarin.PropertyEditing.Mac
this.popUpContextMenu.AddItem (NSMenuItem.SeparatorItem);
// TODO If we add more menu items consider making the Label/Command a dictionary that we can iterate over to populate everything.
- this.popUpContextMenu.AddItem (new CommandMenuItem (Properties.Resources.Reset, viewModel.ClearValueCommand) {
- AttributedTitle = new Foundation.NSAttributedString (
- Properties.Resources.Reset,
- new CoreText.CTStringAttributes {
- Font = new CoreText.CTFont (PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize + 1),
- })
- });
+ this.popUpContextMenu.AddItem (new CommandMenuItem (this.hostResources, Properties.Resources.Reset, viewModel.ClearValueCommand));
}
var menuOrigin = this.Superview.ConvertPointToView (new CGPoint (Frame.Location.X - 1, Frame.Location.Y + Frame.Size.Height + 4), null);
diff --git a/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs
index 36532e2..96f250a 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs
@@ -30,6 +30,8 @@ namespace Xamarin.PropertyEditing.Mac
NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0),
NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1f, -6f),
});
+
+ AppearanceChanged ();
}
private void Editor_Activated (object sender, EventArgs e)
@@ -40,6 +42,13 @@ namespace Xamarin.PropertyEditing.Mac
public override NSView FirstKeyView => this.datePicker;
public override NSView LastKeyView => this.datePicker;
+ protected override void AppearanceChanged ()
+ {
+ base.AppearanceChanged ();
+
+ this.datePicker.TextColor = HostResources.GetNamedColor (NamedResources.ForegroundColor);
+ }
+
protected override void UpdateValue ()
{
this.datePicker.DateValue = ViewModel.Value.ToNSDate ();
diff --git a/Xamarin.PropertyEditing.Mac/Controls/FilePathEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/FilePathEditorControl.cs
index 32c7d7f..cdfcdcc 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/FilePathEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/FilePathEditorControl.cs
@@ -1,17 +1,14 @@
using System;
-using System.Collections.Generic;
-using AppKit;
-using CoreGraphics;
using System.IO;
+using AppKit;
using Xamarin.PropertyEditing.Common;
-using Foundation;
namespace Xamarin.PropertyEditing.Mac
{
internal class FilePathEditorControl : BasePathEditorControl<FilePath>
{
public FilePathEditorControl (IHostResourceProvider hostResource)
- : base (hostResource)
+ : base (hostResource)
{
this.currentTextField.ToolTip = this.currentTextField.PlaceholderString = string.Format (Properties.Resources.ChooseFileOrDirectory, Properties.Resources.File);
this.panel.CanChooseFiles = true;
diff --git a/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs
index a7a67bb..6b85bcc 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/NumericEditorControl.cs
@@ -122,7 +122,7 @@ namespace Xamarin.PropertyEditing.Mac
this.editorRightConstraint.Active = !ViewModel.HasInputModes;
if (ViewModel.HasInputModes) {
if (this.inputModePopup == null) {
- this.inputModePopup = new FocusablePopUpButton {
+ this.inputModePopup = new FocusablePopUpButton (HostResources) {
ControlSize = NSControlSize.Small,
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
Menu = new NSMenu (),
@@ -148,7 +148,7 @@ namespace Xamarin.PropertyEditing.Mac
this.inputModePopup.Menu.RemoveAllItems ();
this.viewModelInputModes = ViewModel.InputModes;
foreach (InputMode item in this.viewModelInputModes) {
- this.inputModePopup.Menu.AddItem (new NSMenuItem (item.Identifier));
+ this.inputModePopup.Menu.AddItem (new ThemedMenuItem (HostResources, item.Identifier));
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs
index cd8a587..c158977 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/ObjectEditorControl.cs
@@ -19,7 +19,7 @@ namespace Xamarin.PropertyEditing.Mac
};
AddSubview (this.typeLabel);
- this.createObject = new FocusableButton {
+ this.createObject = new FocusableButton (hostResources) {
Title = Properties.Resources.New,
BezelStyle = NSBezelStyle.Rounded,
};
diff --git a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs
index d7abd38..6ed6f13 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/PredefinedValuesEditor.cs
@@ -16,7 +16,7 @@ namespace Xamarin.PropertyEditing.Mac
{
base.TranslatesAutoresizingMaskIntoConstraints = false;
- this.comboBox = new FocusableComboBox {
+ this.comboBox = new FocusableComboBox (hostResources) {
AllowsExpansionToolTips = true,
BackgroundColor = NSColor.Clear,
Cell = {
@@ -33,7 +33,7 @@ namespace Xamarin.PropertyEditing.Mac
ViewModel.ValueName = this.comboBox.SelectedValue.ToString ();
};
- this.popUpButton = new FocusablePopUpButton {
+ this.popUpButton = new FocusablePopUpButton (hostResources) {
AllowsExpansionToolTips = true,
Cell = {
LineBreakMode = NSLineBreakMode.TruncatingTail,
diff --git a/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs
index e20e85a..899c042 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/StringEditorControl.cs
@@ -39,7 +39,7 @@ namespace Xamarin.PropertyEditing.Mac
RightEdgeConstraint.Active = !ViewModel.HasInputModes;
if (ViewModel.HasInputModes) {
if (this.inputModePopup == null) {
- this.inputModePopup = new FocusablePopUpButton {
+ this.inputModePopup = new FocusablePopUpButton (HostResources) {
Menu = new NSMenu (),
ControlSize = NSControlSize.Small,
Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
@@ -69,7 +69,7 @@ namespace Xamarin.PropertyEditing.Mac
this.inputModePopup.Menu.RemoveAllItems ();
this.viewModelInputModes = ViewModel.InputModes;
foreach (InputMode item in this.viewModelInputModes) {
- this.inputModePopup.Menu.AddItem (new NSMenuItem (item.Identifier));
+ this.inputModePopup.Menu.AddItem (new ThemedMenuItem (HostResources, item.Identifier));
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs
index 4d96ff6..93a68b4 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/TypeEditorControl.cs
@@ -19,7 +19,7 @@ namespace Xamarin.PropertyEditing.Mac
};
AddSubview (this.typeLabel);
- this.selectType = new FocusableButton {
+ this.selectType = new FocusableButton (hostResources) {
Title = Properties.Resources.Select,
BezelStyle = NSBezelStyle.Rounded
};