Organized the dummyRect declarations/definitions/etc. in the Objective-C files. I think that's it for the Objective-C conversion of the Mac OS X code!

This commit is contained in:
Pietro Gagliardi 2014-05-16 09:13:11 -04:00
parent acc4a54356
commit a9717bfb4f
5 changed files with 14 additions and 7 deletions

View File

@ -17,6 +17,8 @@
#define toNSUInteger(x) ((NSUInteger) (x))
#define fromNSUInteger(x) ((uintptr_t) (x))
extern NSRect dummyRect;
@interface areaView : NSView {
NSTrackingArea *trackingArea;
}
@ -103,7 +105,7 @@ keyEvent(flagsChanged, areaView_flagsChanged)
id makeArea(void)
{
return [[areaView alloc]
initWithFrame:NSMakeRect(0, 0, 100, 100)];
initWithFrame:dummyRect];
}
void drawImage(void *pixels, intptr_t width, intptr_t height, intptr_t stride, intptr_t xdest, intptr_t ydest)

View File

@ -10,6 +10,8 @@
#include <Foundation/NSAutoreleasePool.h>
#include <AppKit/NSEvent.h>
extern NSRect dummyRect;
@interface appDelegate : NSObject
@end
@ -56,6 +58,7 @@ id windowGetContentView(id window)
BOOL initCocoa(id appDelegate)
{
dummyRect = NSMakeRect(0, 0, 100, 100);
[NSApplication sharedApplication];
if ([NSApp setActivationPolicy:NSApplicationActivationPolicyRegular] != YES)
return NO;

View File

@ -19,6 +19,8 @@
#define toNSUInteger(x) ((NSUInteger) (x))
#define fromNSUInteger(x) ((uintptr_t) (x))
extern NSRect dummyRect;
id toListboxItem(id key, id value)
{
return [NSMutableDictionary dictionaryWithObject:value forKey:key];
@ -101,7 +103,7 @@ id makeListbox(id tableColumn, BOOL multisel)
NSTableView *listbox;
listbox = [[NSTableView alloc]
initWithFrame:NSMakeRect(0, 0, 100, 100)];
initWithFrame:dummyRect];
[listbox addTableColumn:tableColumn];
[listbox setAllowsMultipleSelection:multisel];
[listbox setAllowsEmptySelection:YES];

View File

@ -10,6 +10,9 @@
#define toNSView(x) to(NSView, (x))
#define toNSScrollView(x) to(NSScrollView, (x))
// because the only way to make a new NSControl/NSView is with a frame (it gets overridden later)
NSRect dummyRect;
id toNSString(char *str)
{
return [NSString stringWithUTF8String:str];
@ -43,7 +46,7 @@ id makeScrollView(id content)
NSScrollView *scrollview;
scrollview = [[NSScrollView alloc]
initWithFrame:NSMakeRect(0, 0, 100, 100)];
initWithFrame:dummyRect];
[scrollview setHasHorizontalScroller:YES];
[scrollview setHasVerticalScroller:YES];
[scrollview setAutohidesScrollers:YES];

View File

@ -14,8 +14,7 @@
#include <AppKit/NSProgressIndicator.h>
#include <AppKit/NSScrollView.h>
// because the only way to make a new NSControl/NSView is with a frame (it gets overridden later)
static NSRect dummyRect;// = NSMakeRect(0, 0, 100, 100);
extern NSRect dummyRect;
#define to(T, x) ((T *) (x))
#define toNSWindow(x) to(NSWindow, (x))
@ -60,8 +59,6 @@ id makeWindow(id delegate)
{
NSWindow *w;
// TODO separate to initilaizer
dummyRect = NSMakeRect(0, 0, 100, 100);
w = [[NSWindow alloc]
initWithContentRect:dummyRect
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)