diff options
author | Dominique Louis <savagesoftware@gmail.com> | 2018-09-12 23:21:11 +0300 |
---|---|---|
committer | Dominique Louis <dominique@Dominiques-MacBook-Pro-2.local> | 2018-10-08 18:16:41 +0300 |
commit | ab19a31358ad0873675b4bb1d31e779bd15942d4 (patch) | |
tree | 7447260557bcf5cb513a61a603a6d7c3048ec4be /Xamarin.PropertyEditing.Mac/Controls | |
parent | 252f289bd0865b4aa3fd8361c7125ee064bbff13 (diff) |
[Mac] Initial TypeName implementation.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/PanelHeaderEditorControl.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/PanelHeaderEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/PanelHeaderEditorControl.cs index aaa4ce3..5e86e10 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/PanelHeaderEditorControl.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/PanelHeaderEditorControl.cs @@ -21,11 +21,23 @@ namespace Xamarin.PropertyEditing.Mac }; AddSubview (propertyObjectNameLabel); + var propertyTypeNameLabel = new UnfocusableTextField { + Alignment = NSTextAlignment.Right, + StringValue = Properties.Resources.Type + ":", + TranslatesAutoresizingMaskIntoConstraints = false, + }; + AddSubview (propertyTypeNameLabel); + this.DoConstraints (new NSLayoutConstraint[] { propertyObjectNameLabel.ConstraintTo(this, (ol, c) => ol.Top == c.Top), propertyObjectNameLabel.ConstraintTo(this, (ol, c) => ol.Left == c.Left + 182), propertyObjectNameLabel.ConstraintTo(this, (ol, c) => ol.Width == 40), propertyObjectNameLabel.ConstraintTo(this, (ol, c) => ol.Height == PropertyEditorControl.DefaultControlHeight), + + propertyTypeNameLabel.ConstraintTo(this, (tl, c) => tl.Top == c.Top + 22), + propertyTypeNameLabel.ConstraintTo(this, (tl, c) => tl.Left == c.Left + 182), + propertyTypeNameLabel.ConstraintTo(this, (tl, c) => tl.Width == 40), + propertyTypeNameLabel.ConstraintTo(this, (tl, c) => tl.Height == PropertyEditorControl.DefaultControlHeight), }); } } @@ -57,11 +69,22 @@ namespace Xamarin.PropertyEditing.Mac AddSubview (this.propertyObjectName); + var propertyTypeName = new UnfocusableTextField { + StringValue = viewModel.TypeName, + TranslatesAutoresizingMaskIntoConstraints = false, + }; + AddSubview (propertyTypeName); + this.DoConstraints (new NSLayoutConstraint[] { this.propertyObjectName.ConstraintTo(this, (on, c) => on.Top == c.Top + 2), this.propertyObjectName.ConstraintTo(this, (on, c) => on.Left == c.Left + 4), this.propertyObjectName.ConstraintTo(this, (on, c) => on.Width == c.Width - 34), this.propertyObjectName.ConstraintTo(this, (on, c) => on.Height == DefaultControlHeight - 3), + + propertyTypeName.ConstraintTo(this, (tn, c) => tn.Top == c.Top + 22), + propertyTypeName.ConstraintTo(this, (tn, c) => tn.Left == c.Left + 4), + propertyTypeName.ConstraintTo(this, (tn, c) => tn.Width == c.Width - 34), + propertyTypeName.ConstraintTo(this, (tn, c) => tn.Height == DefaultControlHeight), }); // We won't enable or show the PropertyButton for the header @@ -115,9 +138,14 @@ namespace Xamarin.PropertyEditing.Mac void ViewModel_PropertyChanged (object sender, PropertyChangedEventArgs e) { - if ( e.PropertyName == nameof (PanelViewModel.ObjectName)) { + if (e.PropertyName == nameof (PanelViewModel.ObjectName)) { UpdateValue (); } } + + public override nint GetHeight (PropertyViewModel vm) + { + return 44; + } } } |