summaryrefslogtreecommitdiff
path: root/new/newcontrol_darwin.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-07 15:45:00 -0400
committerPietro Gagliardi <[email protected]>2015-04-07 15:45:56 -0400
commit96e25cf50293d2c8f33bbd4d2578a4e2b63441f9 (patch)
tree59e11ab0eeff206f4bbfb1460d44b35e4e5dc7ea /new/newcontrol_darwin.c
parenta013fe638412809fe3dd18f0231d68d1ce469d56 (diff)
Added the Mac OS X uiContainer. Added it to uiWindow. Added the Mac OS X coordinate system mirroring to the new control logic. Renamed *_darwin.c to *_darwin.m.
Diffstat (limited to 'new/newcontrol_darwin.c')
-rw-r--r--new/newcontrol_darwin.c99
1 files changed, 0 insertions, 99 deletions
diff --git a/new/newcontrol_darwin.c b/new/newcontrol_darwin.c
deleted file mode 100644
index 66a7ecc..0000000
--- a/new/newcontrol_darwin.c
+++ /dev/null
@@ -1,99 +0,0 @@
-// 7 april 2015
-#include "uipriv_darwin.h"
-
-typedef struct uiSingleWidgetControl uiSingleWidgetControl;
-
-struct uiSingleViewControl {
- uiControl control;
- NSView *control;
- NSScrollView *scrollView;
- NSView *immediate; // the control that is added to the parent container; either control or scrollView
- void *data;
-};
-
-#define S(c) ((uiSingleViewControl *) (c))
-
-static uintptr_t singleHandle(uiControl *c)
-{
- return (uintptr_t) (S(c)->control);
-}
-
-static void singleSetParent(uiControl *c, uintptr_t parent)
-{
- NSView *parentView = (NSView *) parent;
-
- [parentView addSubview:S(c)->immediate];
-}
-
-static uiSize singlePreferredSize(uiControl *c, uiSizing *d)
-{
- uiSize size;
-
- // TODO
- size.width = size.height = 0;
- return size;
-}
-
-static void singleResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height, uiSizing *d)
-{
- NSRect frame;
-
- frame.origin.x = x;
- frame.origin.y = y;
- frame.size.width = width;
- frame.size.height = height;
- frame = [S(c)->immediate frameForAlignmentRect:frame];
- [S(c)->immediate setFrame:frame];
-}
-
-static void singleContainerShow(uiControl *c)
-{
- [S(c)->immediate setHidden:NO];
-}
-
-static void singleContainerHide(uiControl *c)
-{
- [S(c)->immediate setHidden:YES];
-}
-
-// TODO connect free function
-
-uiControl *uiDarwinNewControl(Class class, BOOL inScrollView, BOOL scrollViewHasBorder, void *data)
-{
- uiSingleViewControl *c;
-
- c = g_new0(uiSingleViewControl, 1);
- // thanks to autoxr and arwyn in irc.freenode.net/#macdev
- c->widget = (NSView *) [[class alloc] initWithFrame:NSZeroRect];
- c->immediate = c->control;
-
- // TODO turn into bit field?
- if (inScrollView) {
- c->scrollView = [[NSScrollView alloc] initWithFrame:NSZeroRect];
- [c->scrollView setDocumentView:c->control];
- [c->scrollView setHasHorizontalScroller:YES];
- [c->scrollView setHasVerticalScroller:YES];
- [c->scrollView setAutohidesScrollers:YES];
- if (scrollViewHasBorder)
- [c->scrollView setBorderType:NSBezelBorder];
- else
- [c->scrollView setBorderType:NSNoBorder];
- c->immediate = (NSView *) (c->scrolledWindow);
- }
-
- c->control.handle = singleHandle;
- c->control.setParent = singleSetParent;
- c->control.preferredSize = singlePreferredSize;
- c->control.resize = singleResize;
- c->control.containerShow = singleContainerShow;
- c->control.containerHide = singleContainerHide;
-
- c->data = data;
-
- return (uiControl *) c;
-}
-
-void *uiDarwinControlData(uiControl *c)
-{
- return S(c)->data;
-}