@@ -20,22 +20,21 @@ public TypeEditorControl (IHostResourceProvider hostResources)
20
20
AddSubview ( this . typeLabel ) ;
21
21
22
22
this . selectType = new FocusableButton {
23
+ BezelStyle = NSBezelStyle . Rounded ,
23
24
Title = Properties . Resources . Select ,
24
- BezelStyle = NSBezelStyle . Rounded
25
25
} ;
26
26
this . selectType . Activated += OnSelectPressed ;
27
27
AddSubview ( this . selectType ) ;
28
28
29
- this . buttonConstraint = NSLayoutConstraint . Create ( this . selectType , NSLayoutAttribute . Leading , NSLayoutRelation . Equal , this . typeLabel , NSLayoutAttribute . Trailing , 1f , 12 ) ;
30
-
31
29
AddConstraints ( new [ ] {
32
- NSLayoutConstraint . Create ( this . typeLabel , NSLayoutAttribute . Leading , NSLayoutRelation . Equal , this , NSLayoutAttribute . Leading , 1f , 0f ) ,
30
+ NSLayoutConstraint . Create ( this . typeLabel , NSLayoutAttribute . Left , NSLayoutRelation . Equal , this , NSLayoutAttribute . Left , 1f , 0f ) ,
33
31
NSLayoutConstraint . Create ( this . typeLabel , NSLayoutAttribute . CenterY , NSLayoutRelation . Equal , this , NSLayoutAttribute . CenterY , 1f , 0f ) ,
34
32
NSLayoutConstraint . Create ( this . typeLabel , NSLayoutAttribute . Height , NSLayoutRelation . Equal , this , NSLayoutAttribute . Height , 1 , 0 ) ,
35
- this . buttonConstraint ,
36
- NSLayoutConstraint . Create ( this . selectType , NSLayoutAttribute . Leading , NSLayoutRelation . Equal , this , NSLayoutAttribute . Leading , 1 , 0 ) . WithPriority ( NSLayoutPriority . DefaultLow ) ,
33
+ NSLayoutConstraint . Create ( this . typeLabel , NSLayoutAttribute . Right , NSLayoutRelation . Equal , this . selectType , NSLayoutAttribute . Left , 1 , - 4 ) ,
34
+
35
+ NSLayoutConstraint . Create ( this . selectType , NSLayoutAttribute . Right , NSLayoutRelation . Equal , this , NSLayoutAttribute . Right , 1f , 0 ) ,
37
36
NSLayoutConstraint . Create ( this . selectType , NSLayoutAttribute . CenterY , NSLayoutRelation . Equal , this , NSLayoutAttribute . CenterY , 1f , 0f ) ,
38
- NSLayoutConstraint . Create ( this . selectType , NSLayoutAttribute . Width , NSLayoutRelation . GreaterThanOrEqual , 1f , 70f ) ,
37
+ NSLayoutConstraint . Create ( this . selectType , NSLayoutAttribute . Width , NSLayoutRelation . Equal , 1f , DefaultButtonWidth ) ,
39
38
} ) ;
40
39
}
41
40
@@ -91,7 +90,6 @@ protected override void OnPropertyChanged (object sender, PropertyChangedEventAr
91
90
92
91
private readonly UnfocusableTextField typeLabel ;
93
92
private readonly NSButton selectType ;
94
- private readonly NSLayoutConstraint buttonConstraint ;
95
93
96
94
private void OnTypeRequested ( object sender , TypeRequestedEventArgs e )
97
95
{
@@ -101,11 +99,9 @@ private void OnTypeRequested (object sender, TypeRequestedEventArgs e)
101
99
private void UpdateTypeLabel ( )
102
100
{
103
101
if ( ViewModel . Value == null ) {
104
- this . typeLabel . StringValue = String . Empty ;
105
- this . buttonConstraint . Active = false ;
102
+ this . typeLabel . StringValue = $ "({ Properties . Resources . ObjectTypeLabelNone } )";
106
103
} else {
107
104
this . typeLabel . StringValue = $ "({ ViewModel . Value . Name } )";
108
- this . buttonConstraint . Active = true ;
109
105
}
110
106
}
111
107
0 commit comments