Did the same for uiEntry.

This commit is contained in:
Pietro Gagliardi 2015-08-21 17:16:52 -04:00
parent ba0cb12c74
commit f698ca4a35
2 changed files with 18 additions and 2 deletions

View File

@ -1,7 +1,21 @@
// 14 august 2015
#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 {
uiDarwinControl c;
@ -126,7 +140,7 @@ uiEntry *uiNewEntry(void)
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
finishNewTextField(e->textfield, YES);

View File

@ -40,6 +40,8 @@ extern void uninitMenus(void);
extern void disableAutocorrect(NSTextView *);
// entry.m
@interface libui_intrinsicWidthNSTextField : NSTextField
@end
extern void finishNewTextField(NSTextField *, BOOL);
// window.m