summaryrefslogtreecommitdiff
path: root/prevlib/prefsize_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-02 22:53:03 -0400
committerPietro Gagliardi <[email protected]>2014-07-02 22:53:03 -0400
commit8a81650b3da7ce00725336df9e03b38e935c5a65 (patch)
tree08af843f0460e7226f305cf7162021ef54e8c3f7 /prevlib/prefsize_darwin.m
parent4dd5ceb11d62bd6b9af4847936314a9d8c45707f (diff)
Moved it all back; the preemptive multitaksing during an event handler kills us on all platforms. Going to have to restrict ALL GUI accss to happening from one t hread, so going to need to drop uitask entirely and have just a start() callback for startup code and a post() function for posting requests to windows (like channel sends but into a perpetual buffer).
Diffstat (limited to 'prevlib/prefsize_darwin.m')
-rw-r--r--prevlib/prefsize_darwin.m97
1 files changed, 0 insertions, 97 deletions
diff --git a/prevlib/prefsize_darwin.m b/prevlib/prefsize_darwin.m
deleted file mode 100644
index 4001c3e..0000000
--- a/prevlib/prefsize_darwin.m
+++ /dev/null
@@ -1,97 +0,0 @@
-// 15 may 2014
-
-#include "objc_darwin.h"
-#import <AppKit/NSControl.h>
-#import <AppKit/NSScrollView.h>
-#import <AppKit/NSTableView.h>
-#import <AppKit/NSProgressIndicator.h>
-#import <AppKit/NSView.h>
-// needed for the methods called by alignmentInfo()
-#import <AppKit/NSLayoutConstraint.h>
-
-#define to(T, x) ((T *) (x))
-#define toNSControl(x) to(NSControl, (x))
-#define toNSScrollView(x) to(NSScrollView, (x))
-#define toNSTableView(x) to(NSTableView, (x))
-#define toNSProgressIndicator(x) to(NSProgressIndicator, (x))
-#define toNSView(x) to(NSView, (x))
-
-#define inScrollView(x) ([toNSScrollView((x)) documentView])
-#define listboxInScrollView(x) toNSTableView(inScrollView((x)))
-#define areaInScrollView(x) inScrollView((x))
-
-struct xsize controlPrefSize(id control)
-{
- NSControl *c;
- NSRect r;
- struct xsize s;
-
- c = toNSControl(control);
- [c sizeToFit];
- r = [c frame];
- s.width = (intptr_t) r.size.width;
- s.height = (intptr_t) r.size.height;
- return s;
-}
-
-struct xsize listboxPrefSize(id scrollview)
-{
- NSTableView *c;
- NSRect r;
- struct xsize s;
-
- c = listboxInScrollView(toNSScrollView(scrollview));
- [c sizeToFit];
- r = [c frame];
- s.width = (intptr_t) r.size.width;
- s.height = (intptr_t) r.size.height;
- return s;
-}
-
-struct xsize pbarPrefSize(id control)
-{
- NSProgressIndicator *c;
- NSRect r;
- struct xsize s;
-
- c = toNSProgressIndicator(control);
- [c sizeToFit];
- r = [c frame];
- s.width = (intptr_t) r.size.width;
- s.height = (intptr_t) r.size.height;
- return s;
-}
-
-struct xsize areaPrefSize(id scrollview)
-{
- NSView *c;
- NSRect r;
- struct xsize s;
-
- c = areaInScrollView(toNSScrollView(scrollview));
- // don't size to fit; the frame size is already the size we want
- r = [c frame];
- s.width = (intptr_t) r.size.width;
- s.height = (intptr_t) r.size.height;
- return s;
-}
-
-struct xalignment alignmentInfo(id c, struct xrect newrect)
-{
- NSView *v;
- struct xalignment a;
- NSRect r;
-
- v = toNSView(c);
- r = NSMakeRect((CGFloat) newrect.x,
- (CGFloat) newrect.y,
- (CGFloat) newrect.width,
- (CGFloat) newrect.height);
- r = [v alignmentRectForFrame:r];
- a.alignmentRect.x = (intptr_t) r.origin.x;
- a.alignmentRect.y = (intptr_t) r.origin.y;
- a.alignmentRect.width = (intptr_t) r.size.width;
- a.alignmentRect.height = (intptr_t) r.size.height;
- a.baseline = (intptr_t) [v baselineOffsetFromBottom];
- return a;
-}