summaryrefslogtreecommitdiff
path: root/sysdata_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-06-22 16:37:17 -0400
committerPietro Gagliardi <[email protected]>2014-06-22 16:37:17 -0400
commit205995278650f0941ca271cadcaad3971872f3b3 (patch)
tree65b75a17346e6f9d6bfe6808d66ceded5e105a0e /sysdata_darwin.m
parente00d2f2eb96f846d0cf0d0a732b7b4f7254b8c03 (diff)
Made LineEdit horizontally scrolling on Mac OS X. I'm not sure how I missed this before o.o
Diffstat (limited to 'sysdata_darwin.m')
-rw-r--r--sysdata_darwin.m18
1 files changed, 15 insertions, 3 deletions
diff --git a/sysdata_darwin.m b/sysdata_darwin.m
index bdcf725..1119255 100644
--- a/sysdata_darwin.m
+++ b/sysdata_darwin.m
@@ -12,6 +12,8 @@
#import <AppKit/NSProgressIndicator.h>
#import <AppKit/NSScrollView.h>
+// general TODO: go through all control constructors and their equivalent controls in Interface Builder to see if there's any qualities I'm missing
+
extern NSRect dummyRect;
#define to(T, x) ((T *) (x))
@@ -123,11 +125,20 @@ id makeCheckbox(void)
id makeLineEdit(BOOL password)
{
+ id c;
+
if (password)
- return [[NSSecureTextField alloc]
+ c = [[NSSecureTextField alloc]
initWithFrame:dummyRect];
- return [[NSTextField alloc]
- initWithFrame:dummyRect];
+ else
+ c = [[NSTextField alloc]
+ initWithFrame:dummyRect];
+ // Interface Builder does this to make the text box behave properly
+ // see makeLabel() for other side effects
+ [[toNSTextField(c) cell] setLineBreakMode:NSLineBreakByClipping];
+ // Interface Builder also sets this to allow horizontal scrolling
+ [[toNSTextField(c) cell] setScrollable:YES];
+ return c;
}
void lineeditSetText(id lineedit, id text)
@@ -151,6 +162,7 @@ id makeLabel(void)
[label setDrawsBackground:NO];
// this disables both word wrap AND ellipsizing in one fell swoop
// we have to send to the control's cell for this
+ // Interface Builder also sets this for its labels, so...
[[label cell] setLineBreakMode:NSLineBreakByClipping];
// for a multiline label, we either use WordWrapping and send setTruncatesLastVisibleLine: to disable ellipsizing OR use one of those ellipsizing styles
return label;