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:
authorLarry Ewing <lewing@xamarin.com>2018-04-12 01:56:41 +0300
committerLarry Ewing <lewing@microsoft.com>2018-07-16 22:05:48 +0300
commit6bb4a87cfdfdb1237d2b7749e63650fa976113e8 (patch)
tree2d221d4ffc073ec7c232eb1ffdbf385eb556c9fd /Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
parent314e47ab7198f667185d4ba1598da6259ed6a199 (diff)
Switch preview drawing to use CommonBrushLayer
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs29
1 files changed, 11 insertions, 18 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
index b6b96ae..930bb68 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/BrushEditorControl.cs
@@ -30,12 +30,6 @@ namespace Xamarin.PropertyEditing.Mac
if (Popover != null)
Popover.Show (new CGRect (20, this.Frame.Height/2 - 2.5, 5, 5), this, NSRectEdge.MinYEdge);
}
-
- public override void Layout()
- {
- base.Layout();
-
- }
}
internal class BrushEditorControl : PropertyEditorControl
@@ -45,14 +39,11 @@ namespace Xamarin.PropertyEditing.Mac
base.TranslatesAutoresizingMaskIntoConstraints = false;
RowHeight = 230f;
- //this.colorEditor = new SolidColorBrushEditor (new CGRect (0, 30, 239, 239));
this.colorEditor = new BrushTabViewController ();
-
this.popover = new NSPopover ();
popover.Behavior = NSPopoverBehavior.Transient;
- popover.ContentViewController = new SolidColorBrushEditorViewController ();
- popover.ContentViewController.PreferredContentSize = new CGSize (200, 200);
+ popover.ContentViewController = new BrushTabViewController ();
this.popUpButton = new ColorPopUpButton {
TranslatesAutoresizingMaskIntoConstraints = false,
@@ -64,13 +55,11 @@ namespace Xamarin.PropertyEditing.Mac
popupButtonList = new NSMenu ();
popUpButton.Menu = popupButtonList;
- popUpButton.Activated += (o, e) => {
- //popover.Show (popUpButton.Frame, popUpButton, NSRectEdge.MinYEdge);
- };
-
UpdateTheme ();
}
+
+
internal new BrushPropertyViewModel ViewModel
{
get { return (BrushPropertyViewModel)base.ViewModel; }
@@ -81,6 +70,9 @@ namespace Xamarin.PropertyEditing.Mac
readonly BrushTabViewController colorEditor;
readonly NSPopover popover;
NSMenu popupButtonList;
+ readonly CommonBrushLayer previewLayer = new CommonBrushLayer {
+ Frame = new CGRect (0, 0, 30, 10)
+ };
bool dataPopulated;
@@ -104,7 +96,7 @@ namespace Xamarin.PropertyEditing.Mac
{
}
- public string GetTitle ()
+ string GetTitle ()
{
var title = "Unknown";
switch (ViewModel.Value) {
@@ -126,7 +118,7 @@ namespace Xamarin.PropertyEditing.Mac
protected override void UpdateValue ()
{
this.colorEditor.ViewModel = ViewModel;
- var controller = this.popover.ContentViewController as SolidColorBrushEditorViewController;
+ var controller = this.popover.ContentViewController as BrushTabViewController;
controller.ViewModel = ViewModel;
if (ViewModel.Solid != null) {
@@ -134,11 +126,12 @@ namespace Xamarin.PropertyEditing.Mac
if (popupButtonList.Count == 0)
popupButtonList.AddItem (new NSMenuItem ());
-
+
+ previewLayer.Brush = ViewModel.Value;
var item = popupButtonList.ItemAt (0);
if (item.Title != title) {
item.Title = title;
- item.Image = ViewModel?.Solid?.Color.CreateSwatch (new CGSize (30, 10));
+ item.Image = previewLayer.RenderPreview ();
}
}
}