2015-04-11 22:49:34 -05:00
|
|
|
// 9 april 2015
|
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
struct label {
|
|
|
|
uiLabel l;
|
|
|
|
NSTextField *label;
|
|
|
|
};
|
2015-04-11 22:49:34 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
static void destroy(void *data)
|
2015-04-11 22:49:34 -05:00
|
|
|
{
|
2015-04-17 17:40:12 -05:00
|
|
|
struct label *l = (struct label *) data;
|
2015-04-11 22:49:34 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
uiFree(l);
|
|
|
|
}
|
2015-04-11 22:49:34 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
static char *labelText(uiLabel *ll)
|
2015-04-11 22:49:34 -05:00
|
|
|
{
|
2015-04-17 17:40:12 -05:00
|
|
|
struct label *l = (struct label *) ll;
|
2015-04-11 22:49:34 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
return uiDarwinNSStringToText([l->label stringValue]);
|
2015-04-11 22:49:34 -05:00
|
|
|
}
|
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
static void labelSetText(uiLabel *ll, const char *text)
|
2015-04-11 22:49:34 -05:00
|
|
|
{
|
2015-04-17 17:40:12 -05:00
|
|
|
struct label *l = (struct label *) ll;
|
2015-04-11 22:49:34 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
[l->label setStringValue:toNSString(text)];
|
2015-04-11 22:49:34 -05:00
|
|
|
}
|
|
|
|
|
2015-04-16 14:08:49 -05:00
|
|
|
uiLabel *uiNewLabel(const char *text)
|
2015-04-11 22:49:34 -05:00
|
|
|
{
|
2015-04-17 17:40:12 -05:00
|
|
|
struct label *l;
|
2015-04-11 22:49:34 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
l = uiNew(struct label);
|
2015-04-16 13:41:24 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
uiDarwinNewControl(uiControl(l), [NSTextField class], NO, NO, destroy, NULL);
|
2015-04-16 13:41:24 -05:00
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
l->label = (NSTextField *) VIEW(l);
|
|
|
|
|
|
|
|
[l->label setStringValue:toNSString(text)];
|
|
|
|
[l->label setEditable:NO];
|
|
|
|
[l->label setSelectable:NO];
|
|
|
|
[l->label setDrawsBackground:NO];
|
|
|
|
finishNewTextField(l->label, NO);
|
2015-04-16 13:41:24 -05:00
|
|
|
|
|
|
|
uiLabel(l)->Text = labelText;
|
|
|
|
uiLabel(l)->SetText = labelSetText;
|
|
|
|
|
2015-04-17 17:40:12 -05:00
|
|
|
return uiLabel(l);
|
2015-04-11 22:49:34 -05:00
|
|
|
}
|