Made the width of TextFields more reasonable on Mac OS X.
This commit is contained in:
parent
f6d7797fd6
commit
910f78c7e5
|
@ -225,9 +225,9 @@ void areaTextFieldOpen(id area, id textfield, intptr_t x, intptr_t y)
|
||||||
goAreaView *a = (goAreaView *) area;
|
goAreaView *a = (goAreaView *) area;
|
||||||
NSTextField *tf = toNSTextField(textfield);
|
NSTextField *tf = toNSTextField(textfield);
|
||||||
|
|
||||||
|
// see TextField.preferredSize() in textfield_darwin.go
|
||||||
[tf sizeToFit];
|
[tf sizeToFit];
|
||||||
// TODO
|
[tf setFrameSize:NSMakeSize(textfieldWidth, [tf frame].size.height)];
|
||||||
[tf setFrameSize:NSMakeSize(150, [tf frame].size.height)];
|
|
||||||
[tf setFrameOrigin:NSMakePoint((CGFloat) x, (CGFloat) y)];
|
[tf setFrameOrigin:NSMakePoint((CGFloat) x, (CGFloat) y)];
|
||||||
[tf setHidden:NO];
|
[tf setHidden:NO];
|
||||||
[[tf window] makeFirstResponder:tf];
|
[[tf window] makeFirstResponder:tf];
|
||||||
|
|
|
@ -58,6 +58,7 @@ extern id windowContentView(id);
|
||||||
extern void windowRedraw(id);
|
extern void windowRedraw(id);
|
||||||
|
|
||||||
/* basicctrls_darwin.m */
|
/* basicctrls_darwin.m */
|
||||||
|
#define textfieldWidth (96) /* according to Interface Builder */
|
||||||
extern id newButton(void);
|
extern id newButton(void);
|
||||||
extern void buttonSetDelegate(id, void *);
|
extern void buttonSetDelegate(id, void *);
|
||||||
extern const char *buttonText(id);
|
extern const char *buttonText(id);
|
||||||
|
|
|
@ -81,7 +81,9 @@ func (t *textfield) allocate(x int, y int, width int, height int, d *sizing) []*
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *textfield) preferredSize(d *sizing) (width, height int) {
|
func (t *textfield) preferredSize(d *sizing) (width, height int) {
|
||||||
return basepreferredSize(t, d)
|
_, height = basepreferredSize(t, d)
|
||||||
|
// the returned width is based on the contents; use this instead
|
||||||
|
return C.textfieldWidth, height
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *textfield) commitResize(a *allocation, d *sizing) {
|
func (t *textfield) commitResize(a *allocation, d *sizing) {
|
||||||
|
|
Loading…
Reference in New Issue