Same, but for OS X.
This commit is contained in:
parent
38a5341603
commit
7270b54e81
1
TODO.md
1
TODO.md
|
@ -1,4 +1,3 @@
|
||||||
- change all private names away from uiXxxx and uipXxxx
|
|
||||||
- make it so Windows API calls that do logLastError(), etc. abort whatever they're doing and not try to continue, just like wintable
|
- make it so Windows API calls that do logLastError(), etc. abort whatever they're doing and not try to continue, just like wintable
|
||||||
- figure out what to cleanup in darwin terminate:
|
- figure out what to cleanup in darwin terminate:
|
||||||
- delegate
|
- delegate
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 7 april 2015
|
// 7 april 2015
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
@interface uipButtonDelegate : NSObject {
|
@interface buttonDelegate : NSObject {
|
||||||
uiButton *b;
|
uiButton *b;
|
||||||
void (*onClicked)(uiButton *, void *);
|
void (*onClicked)(uiButton *, void *);
|
||||||
void *onClickedData;
|
void *onClickedData;
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
- (void)setOnClicked:(void (*)(uiButton *, void *))f data:(void *)data;
|
- (void)setOnClicked:(void (*)(uiButton *, void *))f data:(void *)data;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation uipButtonDelegate
|
@implementation buttonDelegate
|
||||||
|
|
||||||
- (IBAction)buttonClicked:(id)sender
|
- (IBAction)buttonClicked:(id)sender
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
struct button {
|
struct button {
|
||||||
uiButton b;
|
uiButton b;
|
||||||
NSButton *button;
|
NSButton *button;
|
||||||
uipButtonDelegate *delegate;
|
buttonDelegate *delegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void defaultOnClicked(uiButton *b, void *data)
|
static void defaultOnClicked(uiButton *b, void *data)
|
||||||
|
@ -88,7 +88,7 @@ uiButton *uiNewButton(const char *text)
|
||||||
[b->button setBezelStyle:NSRoundedBezelStyle];
|
[b->button setBezelStyle:NSRoundedBezelStyle];
|
||||||
setStandardControlFont(b->button);
|
setStandardControlFont(b->button);
|
||||||
|
|
||||||
b->delegate = [uipButtonDelegate new];
|
b->delegate = [buttonDelegate new];
|
||||||
[b->button setTarget:b->delegate];
|
[b->button setTarget:b->delegate];
|
||||||
[b->button setAction:@selector(buttonClicked:)];
|
[b->button setAction:@selector(buttonClicked:)];
|
||||||
[b->delegate setButton:uiButton(b)];
|
[b->delegate setButton:uiButton(b)];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 7 april 2015
|
// 7 april 2015
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
@interface uipCheckboxDelegate : NSObject {
|
@interface checkboxDelegate : NSObject {
|
||||||
uiCheckbox *c;
|
uiCheckbox *c;
|
||||||
void (*onToggled)(uiCheckbox *, void *);
|
void (*onToggled)(uiCheckbox *, void *);
|
||||||
void *onToggledData;
|
void *onToggledData;
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
- (void)setOnToggled:(void (*)(uiCheckbox *, void *))f data:(void *)data;
|
- (void)setOnToggled:(void (*)(uiCheckbox *, void *))f data:(void *)data;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation uipCheckboxDelegate
|
@implementation checkboxDelegate
|
||||||
|
|
||||||
- (IBAction)checkboxToggled:(id)sender
|
- (IBAction)checkboxToggled:(id)sender
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
struct checkbox {
|
struct checkbox {
|
||||||
uiCheckbox c;
|
uiCheckbox c;
|
||||||
NSButton *checkbox;
|
NSButton *checkbox;
|
||||||
uipCheckboxDelegate *delegate;
|
checkboxDelegate *delegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void defaultOnToggled(uiCheckbox *c, void *data)
|
static void defaultOnToggled(uiCheckbox *c, void *data)
|
||||||
|
@ -105,7 +105,7 @@ uiCheckbox *uiNewCheckbox(const char *text)
|
||||||
[c->checkbox setBordered:NO];
|
[c->checkbox setBordered:NO];
|
||||||
setStandardControlFont(c->checkbox);
|
setStandardControlFont(c->checkbox);
|
||||||
|
|
||||||
c->delegate = [uipCheckboxDelegate new];
|
c->delegate = [checkboxDelegate new];
|
||||||
[c->checkbox setTarget:c->delegate];
|
[c->checkbox setTarget:c->delegate];
|
||||||
[c->checkbox setAction:@selector(checkboxToggled:)];
|
[c->checkbox setAction:@selector(checkboxToggled:)];
|
||||||
[c->delegate setCheckbox:uiCheckbox(c)];
|
[c->delegate setCheckbox:uiCheckbox(c)];
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// 6 april 2015
|
// 6 april 2015
|
||||||
#import "uipriv_darwin.h"
|
#import "uipriv_darwin.h"
|
||||||
|
|
||||||
@interface uiApplication : NSApplication
|
@interface applicationClass : NSApplication
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation uiApplication
|
@implementation applicationClass
|
||||||
|
|
||||||
// hey look! we're overriding terminate:!
|
// hey look! we're overriding terminate:!
|
||||||
// we're going to make sure we can go back to main() whether Cocoa likes it or not!
|
// we're going to make sure we can go back to main() whether Cocoa likes it or not!
|
||||||
|
@ -47,7 +47,7 @@ uiInitOptions options;
|
||||||
const char *uiInit(uiInitOptions *o)
|
const char *uiInit(uiInitOptions *o)
|
||||||
{
|
{
|
||||||
options = *o;
|
options = *o;
|
||||||
[uiApplication sharedApplication];
|
[applicationClass sharedApplication];
|
||||||
// don't check for a NO return; something (launch services?) causes running from application bundles to always return NO when asking to change activation policy, even if the change is to the same activation policy!
|
// don't check for a NO return; something (launch services?) causes running from application bundles to always return NO when asking to change activation policy, even if the change is to the same activation policy!
|
||||||
// see https://github.com/andlabs/ui/issues/6
|
// see https://github.com/andlabs/ui/issues/6
|
||||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
|
|
Loading…
Reference in New Issue