summaryrefslogtreecommitdiff
path: root/new/button_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-15 18:49:45 -0400
committerPietro Gagliardi <[email protected]>2015-04-15 18:49:45 -0400
commit518a5ddbf15d50a254c732a80d5907ef8878abe0 (patch)
tree48cf259f98994e4570e65c389fcd9824272884ad /new/button_darwin.m
parent50ae3ca045e7f5f5744043df0a4506e2f6930bb1 (diff)
Split all OS backends into their own folders.
Diffstat (limited to 'new/button_darwin.m')
-rw-r--r--new/button_darwin.m79
1 files changed, 0 insertions, 79 deletions
diff --git a/new/button_darwin.m b/new/button_darwin.m
deleted file mode 100644
index 92e2c76..0000000
--- a/new/button_darwin.m
+++ /dev/null
@@ -1,79 +0,0 @@
-// 7 april 2015
-#import "uipriv_darwin.h"
-
-@interface uiNSButton : NSButton
-@property uiControl *uiC;
-@property void (*uiOnClicked)(uiControl *, void *);
-@property void *uiOnClickedData;
-@end
-
-@implementation uiNSButton
-
-- (void)viewDidMoveToSuperview
-{
- if (uiDarwinControlFreeWhenAppropriate(self.uiC, [self superview])) {
- [self setTarget:nil];
- self.uiC = NULL;
- }
- [super viewDidMoveToSuperview];
-}
-
-- (IBAction)uiButtonClicked:(id)sender
-{
- (*(self.uiOnClicked))(self.uiC, self.uiOnClickedData);
-}
-
-@end
-
-static void defaultOnClicked(uiControl *c, void *data)
-{
- // do nothing
-}
-
-uiControl *uiNewButton(const char *text)
-{
- uiControl *c;
- uiNSButton *b;
-
- c = uiDarwinNewControl([uiNSButton class], NO, NO);
- b = (uiNSButton *) uiControlHandle(c);
- b.uiC = c;
-
- [b setTitle:toNSString(text)];
- [b setButtonType:NSMomentaryPushInButton];
- [b setBordered:YES];
- [b setBezelStyle:NSRoundedBezelStyle];
- setStandardControlFont((NSControl *) b);
-
- [b setTarget:b];
- [b setAction:@selector(uiButtonClicked:)];
-
- b.uiOnClicked = defaultOnClicked;
-
- return b.uiC;
-}
-
-char *uiButtonText(uiControl *c)
-{
- uiNSButton *b;
-
- b = (uiNSButton *) uiControlHandle(c);
- return uiDarwinNSStringToText([b title]);
-}
-
-void uiButtonSetText(uiControl *c, const char *text)
-{
- uiNSButton *b;
-
- b = (uiNSButton *) uiControlHandle(c);
- [b setTitle:toNSString(text)];
-}
-
-void uiButtonOnClicked(uiControl *c, void (*f)(uiControl *, void *), void *data)
-{
- uiNSButton *b;
-
- b = (uiNSButton *) uiControlHandle(c);
- b.uiOnClicked = f;
- b.uiOnClickedData = data;
-}