@@ -22,6 +22,8 @@ internal abstract class BaseRectangleEditorControl<T> : PropertyEditorControl<Pr
22
22
public override NSView FirstKeyView => XEditor ;
23
23
public override NSView LastKeyView => HeightEditor . DecrementButton ;
24
24
25
+ protected override nint BaseHeight => 68 ;
26
+
25
27
protected BaseRectangleEditorControl ( IHostResourceProvider hostResources )
26
28
: base ( hostResources )
27
29
{
@@ -74,44 +76,41 @@ protected BaseRectangleEditorControl (IHostResourceProvider hostResources)
74
76
AddSubview ( HeightLabel ) ;
75
77
AddSubview ( HeightEditor ) ;
76
78
77
- this . AddConstraints ( new [ ] {
78
- NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , 3f ) ,
79
- NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Left , NSLayoutRelation . Equal , this , NSLayoutAttribute . Left , 1f , 0f ) ,
80
- NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , YEditor , NSLayoutAttribute . Left , 1f , - 10f ) ,
81
- NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
82
-
83
- NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , XEditor , NSLayoutAttribute . Bottom , 1f , - 4f ) ,
84
- NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
85
-
86
- NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , 3f ) ,
87
- NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , this , NSLayoutAttribute . Right , 1f , 0 ) ,
88
- NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , XEditor , NSLayoutAttribute . Width , 1f , 0f ) ,
89
- NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
90
-
91
- NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , XLabel , NSLayoutAttribute . Top , 1f , 0f ) ,
92
- NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
79
+ nfloat labelHeight = NSFont . SystemFontSizeForControlSize ( NSControlSize . Small ) ;
80
+ AddConstraints ( new [ ] {
81
+ NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . Bottom , NSLayoutRelation . Equal , this , NSLayoutAttribute . Bottom , 1f , BottomOffset + 1 ) ,
82
+ NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , labelHeight ) ,
93
83
94
- NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , this , NSLayoutAttribute . Top , 1f , 33f ) ,
84
+ NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Bottom , NSLayoutRelation . Equal , WidthLabel , NSLayoutAttribute . Top , 1f , - 1f ) ,
95
85
NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Left , NSLayoutRelation . Equal , this , NSLayoutAttribute . Left , 1f , 0f ) ,
96
86
NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , HeightEditor , NSLayoutAttribute . Left , 1f , - 10f ) ,
97
- NSLayoutConstraint . Create ( WidthEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
98
-
99
- NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Bottom , 1f , - 4f ) ,
100
- NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
101
87
102
- NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Top , 1f , 0f ) ,
88
+ NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Bottom , NSLayoutRelation . Equal , HeightLabel , NSLayoutAttribute . Top , 1f , - 1f ) ,
103
89
NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , this , NSLayoutAttribute . Right , 1f , 0 ) ,
104
90
NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Width , 1f , 0f ) ,
105
- NSLayoutConstraint . Create ( HeightEditor , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
106
91
107
92
NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , WidthLabel , NSLayoutAttribute . Top , 1f , 0f ) ,
108
- NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , 18 ) ,
93
+ NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , labelHeight ) ,
109
94
95
+ NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , WidthEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
96
+ NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , HeightEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
97
+
98
+ NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . Bottom , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Top , 1f , 0f ) ,
99
+ NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , labelHeight ) ,
100
+
101
+ NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Bottom , NSLayoutRelation . Equal , XLabel , NSLayoutAttribute . Top , 1f , - 1f ) ,
102
+ NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Left , NSLayoutRelation . Equal , WidthEditor , NSLayoutAttribute . Left , 1f , 0f ) ,
103
+ NSLayoutConstraint . Create ( XEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , YEditor , NSLayoutAttribute . Left , 1f , - 10f ) ,
104
+
105
+ NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . Top , NSLayoutRelation . Equal , XLabel , NSLayoutAttribute . Top , 1f , 0f ) ,
106
+ NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , 1f , labelHeight ) ,
107
+
108
+ NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Top , NSLayoutRelation . Equal , XEditor , NSLayoutAttribute . Top , 1f , 0f ) ,
109
+ NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Right , NSLayoutRelation . Equal , HeightEditor , NSLayoutAttribute . Right , 1f , 0 ) ,
110
+ NSLayoutConstraint . Create ( YEditor , NSLayoutAttribute . Width , NSLayoutRelation . Equal , XEditor , NSLayoutAttribute . Width , 1f , 0f ) ,
110
111
111
112
NSLayoutConstraint . Create ( XLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , XEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
112
113
NSLayoutConstraint . Create ( YLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , YEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
113
- NSLayoutConstraint . Create ( WidthLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , WidthEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
114
- NSLayoutConstraint . Create ( HeightLabel , NSLayoutAttribute . CenterX , NSLayoutRelation . Equal , HeightEditor . Subviews [ 0 ] , NSLayoutAttribute . CenterX , 1f , 0 ) ,
115
114
} ) ;
116
115
117
116
AppearanceChanged ( ) ;
@@ -124,10 +123,10 @@ protected virtual void OnInputUpdated (object sender, EventArgs e)
124
123
125
124
protected override void SetEnabled ( )
126
125
{
127
- XEditor . Enabled = ViewModel . Property . CanWrite ;
128
- YEditor . Enabled = ViewModel . Property . CanWrite ;
129
- WidthEditor . Enabled = ViewModel . Property . CanWrite ;
130
- HeightEditor . Enabled = ViewModel . Property . CanWrite ;
126
+ XEditor . Enabled =
127
+ YEditor . Enabled =
128
+ WidthEditor . Enabled =
129
+ HeightEditor . Enabled = ViewModel . IsInputEnabled ;
131
130
}
132
131
133
132
protected override void UpdateAccessibilityValues ( )
0 commit comments