2015-09-10 13:27:45 -05:00
|
|
|
// 9 september 2015
|
2015-10-09 11:33:45 -05:00
|
|
|
#import "uipriv_darwin.h"
|
2015-09-10 13:27:45 -05:00
|
|
|
|
2016-05-28 14:57:01 -05:00
|
|
|
// 10.8 fixups
|
|
|
|
#define NSEventModifierFlags NSUInteger
|
|
|
|
|
2015-12-19 14:13:44 -06:00
|
|
|
@interface areaView : NSView {
|
2015-09-10 13:27:45 -05:00
|
|
|
uiArea *libui_a;
|
2015-12-19 15:35:18 -06:00
|
|
|
NSTrackingArea *libui_ta;
|
2016-05-27 23:21:30 -05:00
|
|
|
NSSize libui_ss;
|
2016-05-28 11:32:47 -05:00
|
|
|
BOOL libui_enabled;
|
2015-09-10 13:27:45 -05:00
|
|
|
}
|
|
|
|
- (id)initWithFrame:(NSRect)r area:(uiArea *)a;
|
2015-09-13 18:26:40 -05:00
|
|
|
- (uiModifiers)parseModifiers:(NSEvent *)e;
|
2015-09-11 20:20:49 -05:00
|
|
|
- (void)doMouseEvent:(NSEvent *)e;
|
2015-09-13 18:26:40 -05:00
|
|
|
- (int)sendKeyEvent:(uiAreaKeyEvent *)ke;
|
|
|
|
- (int)doKeyDownUp:(NSEvent *)e up:(int)up;
|
|
|
|
- (int)doKeyDown:(NSEvent *)e;
|
|
|
|
- (int)doKeyUp:(NSEvent *)e;
|
|
|
|
- (int)doFlagsChanged:(NSEvent *)e;
|
2015-12-19 15:35:18 -06:00
|
|
|
- (void)setupNewTrackingArea;
|
2016-05-27 23:21:30 -05:00
|
|
|
- (void)setScrollingSize:(NSSize)s;
|
2016-05-28 11:32:47 -05:00
|
|
|
- (BOOL)isEnabled;
|
|
|
|
- (void)setEnabled:(BOOL)e;
|
2015-09-10 13:27:45 -05:00
|
|
|
@end
|
|
|
|
|
|
|
|
struct uiArea {
|
2015-10-09 11:33:45 -05:00
|
|
|
uiDarwinControl c;
|
2015-12-19 14:33:54 -06:00
|
|
|
NSView *view; // either sv or area depending on whether it is scrolling
|
|
|
|
NSScrollView *sv;
|
|
|
|
areaView *area;
|
2016-05-27 23:21:30 -05:00
|
|
|
struct scrollViewData *d;
|
2015-09-10 13:27:45 -05:00
|
|
|
uiAreaHandler *ah;
|
2015-12-19 14:33:54 -06:00
|
|
|
BOOL scrolling;
|
2015-09-10 13:27:45 -05:00
|
|
|
};
|
|
|
|
|
2015-12-19 14:13:44 -06:00
|
|
|
@implementation areaView
|
2015-09-10 13:27:45 -05:00
|
|
|
|
|
|
|
- (id)initWithFrame:(NSRect)r area:(uiArea *)a
|
|
|
|
{
|
|
|
|
self = [super initWithFrame:r];
|
2015-12-19 15:35:18 -06:00
|
|
|
if (self) {
|
2015-09-10 13:27:45 -05:00
|
|
|
self->libui_a = a;
|
2015-12-19 15:35:18 -06:00
|
|
|
[self setupNewTrackingArea];
|
2016-05-27 23:21:30 -05:00
|
|
|
self->libui_ss = r.size;
|
2016-05-28 16:36:31 -05:00
|
|
|
self->libui_enabled = YES;
|
2015-12-19 15:35:18 -06:00
|
|
|
}
|
2015-09-10 13:27:45 -05:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)drawRect:(NSRect)r
|
|
|
|
{
|
2015-12-19 14:33:54 -06:00
|
|
|
uiArea *a = self->libui_a;
|
2015-09-10 13:27:45 -05:00
|
|
|
CGContextRef c;
|
|
|
|
uiAreaDrawParams dp;
|
|
|
|
|
|
|
|
c = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
|
2016-01-08 12:51:39 -06:00
|
|
|
// see draw.m under text for why we need the height
|
|
|
|
dp.Context = newContext(c, [self bounds].size.height);
|
2015-09-10 13:27:45 -05:00
|
|
|
|
2015-12-19 14:33:54 -06:00
|
|
|
dp.AreaWidth = 0;
|
|
|
|
dp.AreaHeight = 0;
|
|
|
|
if (!a->scrolling) {
|
|
|
|
dp.AreaWidth = [self frame].size.width;
|
|
|
|
dp.AreaHeight = [self frame].size.height;
|
|
|
|
}
|
2015-09-10 13:27:45 -05:00
|
|
|
|
|
|
|
dp.ClipX = r.origin.x;
|
|
|
|
dp.ClipY = r.origin.y;
|
|
|
|
dp.ClipWidth = r.size.width;
|
|
|
|
dp.ClipHeight = r.size.height;
|
|
|
|
|
2015-10-11 12:53:47 -05:00
|
|
|
// no need to save or restore the graphics state to reset transformations; Cocoa creates a brand-new context each time
|
2015-12-19 14:33:54 -06:00
|
|
|
(*(a->ah->Draw))(a->ah, a, &dp);
|
2015-10-09 11:33:45 -05:00
|
|
|
|
|
|
|
freeContext(dp.Context);
|
2015-09-10 13:27:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)isFlipped
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2015-09-11 20:20:49 -05:00
|
|
|
- (BOOL)acceptsFirstResponder
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2015-09-13 18:26:40 -05:00
|
|
|
- (uiModifiers)parseModifiers:(NSEvent *)e
|
|
|
|
{
|
|
|
|
NSEventModifierFlags mods;
|
|
|
|
uiModifiers m;
|
|
|
|
|
|
|
|
m = 0;
|
|
|
|
mods = [e modifierFlags];
|
|
|
|
if ((mods & NSControlKeyMask) != 0)
|
|
|
|
m |= uiModifierCtrl;
|
|
|
|
if ((mods & NSAlternateKeyMask) != 0)
|
|
|
|
m |= uiModifierAlt;
|
|
|
|
if ((mods & NSShiftKeyMask) != 0)
|
|
|
|
m |= uiModifierShift;
|
|
|
|
if ((mods & NSCommandKeyMask) != 0)
|
|
|
|
m |= uiModifierSuper;
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2015-12-19 15:35:18 -06:00
|
|
|
- (void)setupNewTrackingArea
|
|
|
|
{
|
|
|
|
self->libui_ta = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
|
|
|
options:(NSTrackingMouseEnteredAndExited |
|
|
|
|
NSTrackingMouseMoved |
|
|
|
|
NSTrackingActiveAlways |
|
|
|
|
NSTrackingInVisibleRect |
|
|
|
|
NSTrackingEnabledDuringMouseDrag)
|
|
|
|
owner:self
|
|
|
|
userInfo:nil];
|
|
|
|
[self addTrackingArea:self->libui_ta];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)updateTrackingAreas
|
|
|
|
{
|
|
|
|
[self removeTrackingArea:self->libui_ta];
|
|
|
|
[self->libui_ta release];
|
|
|
|
[self setupNewTrackingArea];
|
|
|
|
}
|
|
|
|
|
2015-09-11 20:24:39 -05:00
|
|
|
// capture on drag is done automatically on OS X
|
2015-09-11 20:20:49 -05:00
|
|
|
- (void)doMouseEvent:(NSEvent *)e
|
|
|
|
{
|
2015-12-19 14:33:54 -06:00
|
|
|
uiArea *a = self->libui_a;
|
2015-09-11 20:20:49 -05:00
|
|
|
uiAreaMouseEvent me;
|
|
|
|
NSPoint point;
|
2016-06-13 20:20:20 -05:00
|
|
|
int buttonNumber;
|
2015-09-11 20:20:49 -05:00
|
|
|
NSUInteger pmb;
|
|
|
|
unsigned int i, max;
|
|
|
|
|
2015-10-14 07:50:56 -05:00
|
|
|
// this will convert point to drawing space
|
|
|
|
// thanks swillits in irc.freenode.net/#macdev
|
2015-09-11 20:20:49 -05:00
|
|
|
point = [self convertPoint:[e locationInWindow] fromView:nil];
|
|
|
|
me.X = point.x;
|
|
|
|
me.Y = point.y;
|
2015-09-11 20:24:39 -05:00
|
|
|
|
2015-12-19 15:15:50 -06:00
|
|
|
me.AreaWidth = 0;
|
|
|
|
me.AreaHeight = 0;
|
2015-12-19 14:33:54 -06:00
|
|
|
if (!a->scrolling) {
|
2015-12-19 15:15:50 -06:00
|
|
|
me.AreaWidth = [self frame].size.width;
|
|
|
|
me.AreaHeight = [self frame].size.height;
|
2015-12-19 14:33:54 -06:00
|
|
|
}
|
2015-09-11 20:20:49 -05:00
|
|
|
|
|
|
|
buttonNumber = [e buttonNumber] + 1;
|
|
|
|
// swap button numbers 2 and 3 (right and middle)
|
|
|
|
if (buttonNumber == 2)
|
|
|
|
buttonNumber = 3;
|
|
|
|
else if (buttonNumber == 3)
|
|
|
|
buttonNumber = 2;
|
|
|
|
|
|
|
|
me.Down = 0;
|
|
|
|
me.Up = 0;
|
|
|
|
me.Count = 0;
|
|
|
|
switch ([e type]) {
|
|
|
|
case NSLeftMouseDown:
|
|
|
|
case NSRightMouseDown:
|
|
|
|
case NSOtherMouseDown:
|
|
|
|
me.Down = buttonNumber;
|
|
|
|
me.Count = [e clickCount];
|
|
|
|
break;
|
|
|
|
case NSLeftMouseUp:
|
|
|
|
case NSRightMouseUp:
|
|
|
|
case NSOtherMouseUp:
|
|
|
|
me.Up = buttonNumber;
|
|
|
|
break;
|
|
|
|
case NSLeftMouseDragged:
|
|
|
|
case NSRightMouseDragged:
|
|
|
|
case NSOtherMouseDragged:
|
|
|
|
// we include the button that triggered the dragged event in the Held fields
|
|
|
|
buttonNumber = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-09-13 18:26:40 -05:00
|
|
|
me.Modifiers = [self parseModifiers:e];
|
2015-09-11 20:20:49 -05:00
|
|
|
|
|
|
|
pmb = [NSEvent pressedMouseButtons];
|
|
|
|
me.Held1To64 = 0;
|
|
|
|
if (buttonNumber != 1 && (pmb & 1) != 0)
|
|
|
|
me.Held1To64 |= 1;
|
|
|
|
if (buttonNumber != 2 && (pmb & 4) != 0)
|
|
|
|
me.Held1To64 |= 2;
|
|
|
|
if (buttonNumber != 3 && (pmb & 2) != 0)
|
|
|
|
me.Held1To64 |= 4;
|
2016-05-26 21:00:08 -05:00
|
|
|
// buttons 4..32
|
|
|
|
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/index.html#//apple_ref/c/tdef/CGMouseButton says Quartz only supports up to 32 buttons
|
2015-09-11 20:20:49 -05:00
|
|
|
max = 32;
|
|
|
|
for (i = 4; i <= max; i++) {
|
|
|
|
uint64_t j;
|
|
|
|
|
|
|
|
if (buttonNumber == i)
|
|
|
|
continue;
|
|
|
|
j = 1 << (i - 1);
|
|
|
|
if ((pmb & j) != 0)
|
|
|
|
me.Held1To64 |= j;
|
|
|
|
}
|
|
|
|
|
2016-05-28 11:32:47 -05:00
|
|
|
if (self->libui_enabled)
|
|
|
|
(*(a->ah->MouseEvent))(a->ah, a, &me);
|
2015-09-11 20:20:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#define mouseEvent(name) \
|
|
|
|
- (void)name:(NSEvent *)e \
|
|
|
|
{ \
|
|
|
|
[self doMouseEvent:e]; \
|
|
|
|
}
|
|
|
|
mouseEvent(mouseMoved)
|
|
|
|
mouseEvent(mouseDragged)
|
|
|
|
mouseEvent(rightMouseDragged)
|
|
|
|
mouseEvent(otherMouseDragged)
|
|
|
|
mouseEvent(mouseDown)
|
|
|
|
mouseEvent(rightMouseDown)
|
|
|
|
mouseEvent(otherMouseDown)
|
|
|
|
mouseEvent(mouseUp)
|
|
|
|
mouseEvent(rightMouseUp)
|
|
|
|
mouseEvent(otherMouseUp)
|
|
|
|
|
2015-12-19 15:35:18 -06:00
|
|
|
- (void)mouseEntered:(NSEvent *)e
|
|
|
|
{
|
|
|
|
uiArea *a = self->libui_a;
|
|
|
|
|
2016-05-28 11:32:47 -05:00
|
|
|
if (self->libui_enabled)
|
|
|
|
(*(a->ah->MouseCrossed))(a->ah, a, 0);
|
2015-12-19 15:35:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)mouseExited:(NSEvent *)e
|
|
|
|
{
|
|
|
|
uiArea *a = self->libui_a;
|
|
|
|
|
2016-05-28 11:32:47 -05:00
|
|
|
if (self->libui_enabled)
|
|
|
|
(*(a->ah->MouseCrossed))(a->ah, a, 1);
|
2015-12-19 15:35:18 -06:00
|
|
|
}
|
|
|
|
|
2015-09-12 07:11:10 -05:00
|
|
|
// note: there is no equivalent to WM_CAPTURECHANGED on Mac OS X; there literally is no way to break a grab like that
|
|
|
|
// even if I invoke the task switcher and switch processes, the mouse grab will still be held until I let go of all buttons
|
|
|
|
// therefore, no DragBroken()
|
|
|
|
|
2015-09-13 18:26:40 -05:00
|
|
|
- (int)sendKeyEvent:(uiAreaKeyEvent *)ke
|
|
|
|
{
|
2015-12-19 14:33:54 -06:00
|
|
|
uiArea *a = self->libui_a;
|
|
|
|
|
|
|
|
return (*(a->ah->KeyEvent))(a->ah, a, ke);
|
2015-09-13 18:26:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
- (int)doKeyDownUp:(NSEvent *)e up:(int)up
|
|
|
|
{
|
2015-09-13 20:12:48 -05:00
|
|
|
uiAreaKeyEvent ke;
|
2015-09-13 18:26:40 -05:00
|
|
|
|
|
|
|
ke.Key = 0;
|
|
|
|
ke.ExtKey = 0;
|
|
|
|
ke.Modifier = 0;
|
|
|
|
|
|
|
|
ke.Modifiers = [self parseModifiers:e];
|
|
|
|
|
|
|
|
ke.Up = up;
|
|
|
|
|
|
|
|
if (!fromKeycode([e keyCode], &ke))
|
|
|
|
return 0;
|
|
|
|
return [self sendKeyEvent:&ke];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)doKeyDown:(NSEvent *)e
|
|
|
|
{
|
|
|
|
return [self doKeyDownUp:e up:0];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)doKeyUp:(NSEvent *)e
|
|
|
|
{
|
|
|
|
return [self doKeyDownUp:e up:1];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)doFlagsChanged:(NSEvent *)e
|
|
|
|
{
|
|
|
|
uiAreaKeyEvent ke;
|
|
|
|
uiModifiers whichmod;
|
|
|
|
|
|
|
|
ke.Key = 0;
|
|
|
|
ke.ExtKey = 0;
|
|
|
|
|
|
|
|
// Mac OS X sends this event on both key up and key down.
|
|
|
|
// Fortunately -[e keyCode] IS valid here, so we can simply map from key code to Modifiers, get the value of [e modifierFlags], and check if the respective bit is set or not — that will give us the up/down state
|
|
|
|
if (!keycodeModifier([e keyCode], &whichmod))
|
|
|
|
return 0;
|
|
|
|
ke.Modifier = whichmod;
|
|
|
|
ke.Modifiers = [self parseModifiers:e];
|
|
|
|
ke.Up = (ke.Modifiers & ke.Modifier) == 0;
|
|
|
|
// and then drop the current modifier from Modifiers
|
|
|
|
ke.Modifiers &= ~ke.Modifier;
|
|
|
|
return [self sendKeyEvent:&ke];
|
|
|
|
}
|
|
|
|
|
2015-12-19 14:33:54 -06:00
|
|
|
- (void)setFrameSize:(NSSize)size
|
|
|
|
{
|
|
|
|
uiArea *a = self->libui_a;
|
|
|
|
|
|
|
|
[super setFrameSize:size];
|
|
|
|
if (!a->scrolling)
|
|
|
|
// we must redraw everything on resize because Windows requires it
|
|
|
|
[self setNeedsDisplay:YES];
|
|
|
|
}
|
|
|
|
|
2016-05-27 23:21:30 -05:00
|
|
|
- (void)setScrollingSize:(NSSize)s
|
|
|
|
{
|
|
|
|
self->libui_ss = s;
|
|
|
|
[self invalidateIntrinsicContentSize];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSSize)intrinsicContentSize
|
|
|
|
{
|
|
|
|
if (!self->libui_a->scrolling)
|
|
|
|
return [super intrinsicContentSize];
|
|
|
|
return self->libui_ss;
|
|
|
|
}
|
|
|
|
|
2016-05-28 11:32:47 -05:00
|
|
|
- (BOOL)becomeFirstResponder
|
|
|
|
{
|
|
|
|
return [self isEnabled];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)isEnabled
|
|
|
|
{
|
|
|
|
return self->libui_enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setEnabled:(BOOL)e
|
|
|
|
{
|
|
|
|
self->libui_enabled = e;
|
|
|
|
if (!self->libui_enabled && [self window] != nil)
|
|
|
|
if ([[self window] firstResponder] == self)
|
|
|
|
[[self window] makeFirstResponder:nil];
|
|
|
|
}
|
|
|
|
|
2015-09-10 13:27:45 -05:00
|
|
|
@end
|
|
|
|
|
2016-05-27 23:21:30 -05:00
|
|
|
uiDarwinControlAllDefaultsExceptDestroy(uiArea, view)
|
|
|
|
|
|
|
|
static void uiAreaDestroy(uiControl *c)
|
|
|
|
{
|
|
|
|
uiArea *a = uiArea(c);
|
|
|
|
|
|
|
|
if (a->scrolling)
|
|
|
|
scrollViewFreeData(a->sv, a->d);
|
|
|
|
[a->area release];
|
|
|
|
if (a->scrolling)
|
|
|
|
[a->sv release];
|
|
|
|
uiFreeControl(uiControl(a));
|
|
|
|
}
|
2016-04-25 10:54:09 -05:00
|
|
|
|
2015-09-13 18:26:40 -05:00
|
|
|
// called by subclasses of -[NSApplication sendEvent:]
|
|
|
|
// by default, NSApplication eats some key events
|
|
|
|
// this prevents that from happening with uiArea
|
|
|
|
// see http://stackoverflow.com/questions/24099063/how-do-i-detect-keyup-in-my-nsview-with-the-command-key-held and http://lists.apple.com/archives/cocoa-dev/2003/Oct/msg00442.html
|
|
|
|
int sendAreaEvents(NSEvent *e)
|
|
|
|
{
|
|
|
|
NSEventType type;
|
|
|
|
id focused;
|
2015-12-19 14:13:44 -06:00
|
|
|
areaView *view;
|
2015-09-13 18:26:40 -05:00
|
|
|
|
|
|
|
type = [e type];
|
|
|
|
if (type != NSKeyDown && type != NSKeyUp && type != NSFlagsChanged)
|
|
|
|
return 0;
|
|
|
|
focused = [[e window] firstResponder];
|
|
|
|
if (focused == nil)
|
|
|
|
return 0;
|
2015-12-19 14:13:44 -06:00
|
|
|
if (![focused isKindOfClass:[areaView class]])
|
2015-09-13 18:26:40 -05:00
|
|
|
return 0;
|
2015-12-19 14:13:44 -06:00
|
|
|
view = (areaView *) focused;
|
2015-09-13 18:26:40 -05:00
|
|
|
switch (type) {
|
|
|
|
case NSKeyDown:
|
|
|
|
return [view doKeyDown:e];
|
|
|
|
case NSKeyUp:
|
|
|
|
return [view doKeyUp:e];
|
|
|
|
case NSFlagsChanged:
|
|
|
|
return [view doFlagsChanged:e];
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-13 20:05:40 -05:00
|
|
|
void uiAreaSetSize(uiArea *a, int width, int height)
|
2015-10-09 11:33:45 -05:00
|
|
|
{
|
2015-12-19 14:33:54 -06:00
|
|
|
if (!a->scrolling)
|
2016-05-13 20:00:12 -05:00
|
|
|
userbug("You cannot call uiAreaSetSize() on a non-scrolling uiArea. (area: %p)", a);
|
2016-05-27 23:21:30 -05:00
|
|
|
[a->area setScrollingSize:NSMakeSize(width, height)];
|
2015-10-09 11:33:45 -05:00
|
|
|
}
|
|
|
|
|
2015-10-09 14:27:57 -05:00
|
|
|
void uiAreaQueueRedrawAll(uiArea *a)
|
|
|
|
{
|
2015-12-19 14:33:54 -06:00
|
|
|
[a->area setNeedsDisplay:YES];
|
2015-10-09 14:27:57 -05:00
|
|
|
}
|
|
|
|
|
2016-01-24 20:50:10 -06:00
|
|
|
void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height)
|
2016-01-24 20:41:34 -06:00
|
|
|
{
|
|
|
|
if (!a->scrolling)
|
2016-05-13 20:00:12 -05:00
|
|
|
userbug("You cannot call uiAreaScrollTo() on a non-scrolling uiArea. (area: %p)", a);
|
2016-01-24 20:41:34 -06:00
|
|
|
[a->area scrollRectToVisible:NSMakeRect(x, y, width, height)];
|
|
|
|
// don't worry about the return value; it just says whether scrolling was needed
|
|
|
|
}
|
|
|
|
|
2015-10-09 11:33:45 -05:00
|
|
|
uiArea *uiNewArea(uiAreaHandler *ah)
|
2015-09-10 13:27:45 -05:00
|
|
|
{
|
|
|
|
uiArea *a;
|
|
|
|
|
2016-04-25 10:54:09 -05:00
|
|
|
uiDarwinNewControl(uiArea, a);
|
2015-09-10 13:27:45 -05:00
|
|
|
|
|
|
|
a->ah = ah;
|
2015-12-19 14:33:54 -06:00
|
|
|
a->scrolling = NO;
|
|
|
|
|
|
|
|
a->area = [[areaView alloc] initWithFrame:NSZeroRect area:a];
|
|
|
|
|
|
|
|
a->view = a->area;
|
|
|
|
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
2016-06-13 20:05:40 -05:00
|
|
|
uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)
|
2015-12-19 14:33:54 -06:00
|
|
|
{
|
|
|
|
uiArea *a;
|
2016-05-27 23:21:30 -05:00
|
|
|
struct scrollViewCreateParams p;
|
2015-12-19 14:33:54 -06:00
|
|
|
|
2016-04-25 10:54:09 -05:00
|
|
|
uiDarwinNewControl(uiArea, a);
|
2015-12-19 14:33:54 -06:00
|
|
|
|
|
|
|
a->ah = ah;
|
|
|
|
a->scrolling = YES;
|
|
|
|
|
|
|
|
a->area = [[areaView alloc] initWithFrame:NSMakeRect(0, 0, width, height)
|
|
|
|
area:a];
|
|
|
|
|
2016-05-27 23:21:30 -05:00
|
|
|
memset(&p, 0, sizeof (struct scrollViewCreateParams));
|
|
|
|
p.DocumentView = a->area;
|
|
|
|
p.BackgroundColor = [NSColor controlColor];
|
|
|
|
p.DrawsBackground = 1;
|
|
|
|
p.Bordered = NO;
|
|
|
|
p.HScroll = YES;
|
|
|
|
p.VScroll = YES;
|
|
|
|
a->sv = mkScrollView(&p, &(a->d));
|
2015-09-10 13:27:45 -05:00
|
|
|
|
2016-05-27 23:21:30 -05:00
|
|
|
a->view = a->sv;
|
2015-09-10 13:27:45 -05:00
|
|
|
|
|
|
|
return a;
|
|
|
|
}
|