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-01-11 20:12:27 +0300
committerEric Maupin <ermaup@microsoft.com>2019-01-11 23:19:25 +0300
commitf4b968a235c0e6e87592f559a9d52b0f693d0500 (patch)
treef806667cde21e68f629411d6161b6940336487f3 /Xamarin.PropertyEditing.Mac
parent893e7165b1995618264ad33addea5d0c24684b50 (diff)
[mac] Only insert background box when there's a color
This fixes an issue where a transparent background would bleed a popup's background through rather than the view or layers below it. Also tweak sizes to fit everything.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs3
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs4
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs2
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentViewController.cs2
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs72
5 files changed, 54 insertions, 29 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
index 906ddea..6007fdc 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
@@ -61,7 +61,7 @@ namespace Xamarin.PropertyEditing.Mac
this.popover = new NSPopover {
Behavior = NSPopoverBehavior.Transient,
ContentViewController = this.brushTabViewController = new BrushTabViewController (hostResources) {
- PreferredContentSize = new CGSize (430, 263)
+ PreferredContentSize = new CGSize (550, 363)
}
};
@@ -82,7 +82,6 @@ namespace Xamarin.PropertyEditing.Mac
});
}
-
readonly ColorPopUpButton popUpButton;
readonly NSPopover popover;
readonly BrushTabViewController brushTabViewController;
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs
index 50e07e5..dd63955 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs
@@ -19,9 +19,9 @@ namespace Xamarin.PropertyEditing.Mac
TabBorderColor = NamedResources.TabBorderColor;
TabBackgroundColor = NamedResources.PadBackgroundColor;
- PreferredContentSize = new CGSize (430, 280);
+ PreferredContentSize = new CGSize (450, 280);
TransitionOptions = NSViewControllerTransitionOptions.None;
- ContentPadding = new NSEdgeInsets (10, 10, 10, 10);
+ ContentPadding = new NSEdgeInsets (8, 8, 8, 8);
this.filterResource = new NSSearchField {
ControlSize = NSControlSize.Mini,
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs
index 44f36a6..af145a3 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentEditor.cs
@@ -133,7 +133,7 @@ namespace Xamarin.PropertyEditing.Mac
};
}
- public override CGSize IntrinsicContentSize => new CGSize (100, 300);
+ public override CGSize IntrinsicContentSize => new CGSize (100, 400);
void UpdateComponent (object sender, EventArgs args)
{
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentViewController.cs
index 67c5b86..0a8acf7 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentViewController.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/ColorComponentViewController.cs
@@ -15,7 +15,7 @@ namespace Xamarin.PropertyEditing.Mac
throw new ArgumentNullException (nameof (hostResources));
this.hostResources = hostResources;
- PreferredContentSize = new CGSize (100, 400);
+ PreferredContentSize = new CGSize (200, 500);
EditorType = type;
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs
index 350a960..b760e22 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/UnderlinedTabViewController.cs
@@ -16,26 +16,30 @@ namespace Xamarin.PropertyEditing.Mac
throw new ArgumentNullException (nameof (hostResources));
HostResources = hostResources;
-
- this.tabContainer = new DynamicFill (hostResources, null);
- this.border = new DynamicFill (hostResources, null) {
- Frame = new CGRect (0, 0, 1, 1),
- BorderWidth = 0,
- BoxType = NSBoxType.NSBoxCustom,
- AutoresizingMask = NSViewResizingMask.WidthSizable,
- };
}
public string TabBackgroundColor
{
- get => this.tabContainer.FillColorName;
- set => this.tabContainer.FillColorName = value;
+ get => this.tabBackground;
+ set
+ {
+ if (this.tabContainer != null)
+ this.tabContainer.FillColorName = value;
+
+ this.tabBackground = value;
+ }
}
public string TabBorderColor
{
- get => this.border.FillColorName;
- set => this.border.FillColorName = value;
+ get => this.tabBorder;
+ set
+ {
+ if (this.border != null)
+ this.border.FillColorName = value;
+
+ this.tabBorder = value;
+ }
}
public override void InsertTabViewItem (NSTabViewItem tabViewItem, nint index)
@@ -97,19 +101,38 @@ namespace Xamarin.PropertyEditing.Mac
Alignment = NSLayoutAttribute.Left,
Orientation = NSUserInterfaceLayoutOrientation.Vertical,
};
-
- this.tabContainer.ContentView = this.tabStack;
- this.innerStack.AddView (this.tabContainer, NSStackViewGravity.Top);
- this.innerStack.AddView (border, NSStackViewGravity.Top);
+ NSView tabs = this.tabStack;
+ if (TabBackgroundColor != null) {
+ this.tabContainer = new DynamicFill (HostResources, TabBackgroundColor) {
+ ContentView = this.tabStack
+ };
+
+ tabs = this.tabContainer;
+ }
+
+ this.innerStack.AddView (tabs, NSStackViewGravity.Top);
+
+ if (TabBorderColor != null) {
+ this.border = new DynamicFill (HostResources, TabBorderColor) {
+ Frame = new CGRect (0, 0, 1, 1),
+ BorderWidth = 0,
+ BoxType = NSBoxType.NSBoxCustom,
+ AutoresizingMask = NSViewResizingMask.WidthSizable
+ };
+
+ this.innerStack.AddView (this.border, NSStackViewGravity.Top);
+ }
+
this.innerStack.AddView (TabView, NSStackViewGravity.Bottom);
- View = this.innerStack;
+ View = this.innerStack;
+
+ if (TabBackgroundColor != null) {
+ this.innerStack.AddConstraint (NSLayoutConstraint.Create (this.tabContainer, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this.innerStack, NSLayoutAttribute.Width, 1, 0));
+ }
- this.innerStack.AddConstraints (new[] {
- NSLayoutConstraint.Create (this.tabContainer, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this.innerStack, NSLayoutAttribute.Width, 1, 0),
- NSLayoutConstraint.Create (TabView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, this.innerStack, NSLayoutAttribute.CenterX, 1, 0),
- });
+ this.innerStack.AddConstraint (NSLayoutConstraint.Create (TabView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, this.innerStack, NSLayoutAttribute.CenterX, 1, 0));
UpdatePadding ();
}
@@ -120,7 +143,8 @@ namespace Xamarin.PropertyEditing.Mac
}
private NSLayoutConstraint sidePadding, topPadding, bottomPadding;
-
+
+ private string tabBackground, tabBorder;
private IUnderliningTabView selected;
private DynamicFill tabContainer, border;
private NSStackView innerStack;
@@ -183,7 +207,9 @@ namespace Xamarin.PropertyEditing.Mac
this.sidePadding = NSLayoutConstraint.Create (TabView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this.innerStack, NSLayoutAttribute.Width, 1, -(ContentPadding.Left + ContentPadding.Right));
this.bottomPadding = NSLayoutConstraint.Create (TabView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this.innerStack, NSLayoutAttribute.Bottom, 1, -(ContentPadding.Bottom));
- this.topPadding = NSLayoutConstraint.Create (TabView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this.border, NSLayoutAttribute.Bottom, 1, ContentPadding.Top);
+
+ NSView bottomItem = this.border ?? this.tabContainer ?? (NSView)this.tabStack;
+ this.topPadding = NSLayoutConstraint.Create (TabView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, bottomItem, NSLayoutAttribute.Bottom, 1, ContentPadding.Top);
this.innerStack.AddConstraints (new[] { this.sidePadding, this.topPadding, this.bottomPadding });
}