summaryrefslogtreecommitdiff
path: root/new/newcontrol_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-08 04:35:50 -0400
committerPietro Gagliardi <[email protected]>2015-04-08 04:35:50 -0400
commit941825e1902d7ccdea93ad21f518a8c60ce271b2 (patch)
tree81f39bf8afab350e6a002a1e655774e387f20bb5 /new/newcontrol_darwin.m
parent4ab6251449b4c88869b12514f67c8731ab14c93c (diff)
Cleaned out some of that gunk. I can't avoid subclassing the standard controls, but making it so that the uiControl returned by uiDarwinNewControl() can be freed by the caller will help.
Diffstat (limited to 'new/newcontrol_darwin.m')
-rw-r--r--new/newcontrol_darwin.m15
1 files changed, 3 insertions, 12 deletions
diff --git a/new/newcontrol_darwin.m b/new/newcontrol_darwin.m
index 5a346f1..2274190 100644
--- a/new/newcontrol_darwin.m
+++ b/new/newcontrol_darwin.m
@@ -8,7 +8,6 @@ struct uiSingleViewControl {
NSView *view;
NSScrollView *scrollView;
NSView *immediate; // the control that is added to the parent container; either view or scrollView
- void *data;
};
#define S(c) ((uiSingleViewControl *) (c))
@@ -59,12 +58,9 @@ static void singleResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, i
[S(c)->immediate setFrame:frame];
}
-// TODO connect free function
-
-uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHasBorder, void *data)
+uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHasBorder)
{
uiSingleViewControl *c;
- uiFreeOnDealloc *freer;
c = uiNew(uiSingleViewControl);
// thanks to autoxr and arwyn in irc.freenode.net/#macdev
@@ -91,15 +87,10 @@ uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHas
c->control.preferredSize = singlePreferredSize;
c->control.resize = singleResize;
- c->data = data;
-
- freer = (uiFreeOnDealloc *) (c->view);
- [freer uiFreeOnDealloc:c];
-
return (uiControl *) c;
}
-void *uiDarwinControlData(uiControl *c)
+void uiDarwinControlFree(uiControl *c)
{
- return S(c)->data;
+ uiFree(c);
}