diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-09-09 02:30:51 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-09-09 02:30:51 +0200 |
commit | 70e4841d311d68689724768157cc9cbfbde7a9fc (patch) | |
tree | ba9499f77d1258530a7e60aa6e1732c41d98161c /src/libui_sdl/libui/darwin/label.m | |
parent | 81747d6c34eb159481a6ca3f283d065fa3568617 (diff) |
another UI attempt, I guess.
sorry.
Diffstat (limited to 'src/libui_sdl/libui/darwin/label.m')
-rw-r--r-- | src/libui_sdl/libui/darwin/label.m | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/libui_sdl/libui/darwin/label.m b/src/libui_sdl/libui/darwin/label.m new file mode 100644 index 0000000..897bc3f --- /dev/null +++ b/src/libui_sdl/libui/darwin/label.m @@ -0,0 +1,43 @@ +// 14 august 2015 +#import "uipriv_darwin.h" + +struct uiLabel { + uiDarwinControl c; + NSTextField *textfield; +}; + +uiDarwinControlAllDefaults(uiLabel, textfield) + +char *uiLabelText(uiLabel *l) +{ + return uiDarwinNSStringToText([l->textfield stringValue]); +} + +void uiLabelSetText(uiLabel *l, const char *text) +{ + [l->textfield setStringValue:toNSString(text)]; +} + +NSTextField *newLabel(NSString *str) +{ + NSTextField *tf; + + tf = [[NSTextField alloc] initWithFrame:NSZeroRect]; + [tf setStringValue:str]; + [tf setEditable:NO]; + [tf setSelectable:NO]; + [tf setDrawsBackground:NO]; + finishNewTextField(tf, NO); + return tf; +} + +uiLabel *uiNewLabel(const char *text) +{ + uiLabel *l; + + uiDarwinNewControl(uiLabel, l); + + l->textfield = newLabel(toNSString(text)); + + return l; +} |