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 toNSUInteger(x) ((NSUInteger) (x))
#define fromNSUInteger(x) ((uintptr_t) (x)) #define fromNSUInteger(x) ((uintptr_t) (x))
extern NSRect dummyRect;
@interface areaView : NSView { @interface areaView : NSView {
NSTrackingArea *trackingArea; NSTrackingArea *trackingArea;
} }
@ -103,7 +105,7 @@ keyEvent(flagsChanged, areaView_flagsChanged)
id makeArea(void) id makeArea(void)
{ {
return [[areaView alloc] 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) 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 <Foundation/NSAutoreleasePool.h>
#include <AppKit/NSEvent.h> #include <AppKit/NSEvent.h>
extern NSRect dummyRect;
@interface appDelegate : NSObject @interface appDelegate : NSObject
@end @end
@ -56,6 +58,7 @@ id windowGetContentView(id window)
BOOL initCocoa(id appDelegate) BOOL initCocoa(id appDelegate)
{ {
dummyRect = NSMakeRect(0, 0, 100, 100);
[NSApplication sharedApplication]; [NSApplication sharedApplication];
if ([NSApp setActivationPolicy:NSApplicationActivationPolicyRegular] != YES) if ([NSApp setActivationPolicy:NSApplicationActivationPolicyRegular] != YES)
return NO; return NO;

View File

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

View File

@ -10,6 +10,9 @@
#define toNSView(x) to(NSView, (x)) #define toNSView(x) to(NSView, (x))
#define toNSScrollView(x) to(NSScrollView, (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) id toNSString(char *str)
{ {
return [NSString stringWithUTF8String:str]; return [NSString stringWithUTF8String:str];
@ -43,7 +46,7 @@ id makeScrollView(id content)
NSScrollView *scrollview; NSScrollView *scrollview;
scrollview = [[NSScrollView alloc] scrollview = [[NSScrollView alloc]
initWithFrame:NSMakeRect(0, 0, 100, 100)]; initWithFrame:dummyRect];
[scrollview setHasHorizontalScroller:YES]; [scrollview setHasHorizontalScroller:YES];
[scrollview setHasVerticalScroller:YES]; [scrollview setHasVerticalScroller:YES];
[scrollview setAutohidesScrollers:YES]; [scrollview setAutohidesScrollers:YES];

View File

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