Did the same for uiEntry.
This commit is contained in:
parent
ba0cb12c74
commit
f698ca4a35
|
@ -1,7 +1,21 @@
|
||||||
// 14 august 2015
|
// 14 august 2015
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
// TODO set a text field minimum width
|
// Text fields for entering text have no intrinsic width; we'll use the default Interface Builder width for them.
|
||||||
|
#define textfieldWidth 96
|
||||||
|
|
||||||
|
@implementation libui_intrinsicWidthNSTextField
|
||||||
|
|
||||||
|
- (NSSize)intrinsicContentSize
|
||||||
|
{
|
||||||
|
NSSize s;
|
||||||
|
|
||||||
|
s = [super intrinsicContentSize];
|
||||||
|
s.width = textfieldWidth;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
struct uiEntry {
|
struct uiEntry {
|
||||||
uiDarwinControl c;
|
uiDarwinControl c;
|
||||||
|
@ -126,7 +140,7 @@ uiEntry *uiNewEntry(void)
|
||||||
|
|
||||||
e = (uiEntry *) uiNewControl(uiEntryType());
|
e = (uiEntry *) uiNewControl(uiEntryType());
|
||||||
|
|
||||||
e->textfield = [[NSTextField alloc] initWithFrame:NSZeroRect];
|
e->textfield = [[libui_intrinsicWidthNSTextField alloc] initWithFrame:NSZeroRect];
|
||||||
[e->textfield setSelectable:YES]; // otherwise the setting is masked by the editable default of YES
|
[e->textfield setSelectable:YES]; // otherwise the setting is masked by the editable default of YES
|
||||||
finishNewTextField(e->textfield, YES);
|
finishNewTextField(e->textfield, YES);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ extern void uninitMenus(void);
|
||||||
extern void disableAutocorrect(NSTextView *);
|
extern void disableAutocorrect(NSTextView *);
|
||||||
|
|
||||||
// entry.m
|
// entry.m
|
||||||
|
@interface libui_intrinsicWidthNSTextField : NSTextField
|
||||||
|
@end
|
||||||
extern void finishNewTextField(NSTextField *, BOOL);
|
extern void finishNewTextField(NSTextField *, BOOL);
|
||||||
|
|
||||||
// window.m
|
// window.m
|
||||||
|
|
Loading…
Reference in New Issue