# HG changeset patch # User Atul Varma # Date 1271045893 25200 # Node ID 4bb0e66b4d7fb17dcb2525daf311af40813a0bfd # Parent f98ecd33c5e0e17bb0706ea56a9036547283a4e8 implemented quasimode.setSize() diff -r f98ecd33c5e0 -r 4bb0e66b4d7f JavaScriptQuasimode.m --- a/JavaScriptQuasimode.m Sun Apr 11 21:00:37 2010 -0700 +++ b/JavaScriptQuasimode.m Sun Apr 11 21:18:13 2010 -0700 @@ -15,9 +15,14 @@ JSValueIsNumber(ctx, arguments[0]) && JSValueIsNumber(ctx, arguments[1])) { Quasimode *quasimode = (Quasimode *) JSObjectGetPrivate(thisObject); - int x = (int) JSValueToNumber(ctx, arguments[0], NULL); - int y = (int) JSValueToNumber(ctx, arguments[1], NULL); - [quasimode setSizeWithX: x Y: y]; + int width = (int) JSValueToNumber(ctx, arguments[0], NULL); + int height = (int) JSValueToNumber(ctx, arguments[1], NULL); + + if (width > 0 && height > 0) { + NSSize size = {width, height}; + + [[quasimode window] setContentSize: size]; + } } return JSValueMakeUndefined(ctx); } diff -r f98ecd33c5e0 -r 4bb0e66b4d7f Quasimode.h --- a/Quasimode.h Sun Apr 11 21:00:37 2010 -0700 +++ b/Quasimode.h Sun Apr 11 21:18:13 2010 -0700 @@ -6,6 +6,6 @@ WebView *view; } - (id)init; -- (void)setSizeWithX:(int)X Y:(int)Y; +- (NSWindow *)window; - (WebView *)view; @end diff -r f98ecd33c5e0 -r 4bb0e66b4d7f Quasimode.m --- a/Quasimode.m Sun Apr 11 21:00:37 2010 -0700 +++ b/Quasimode.m Sun Apr 11 21:18:13 2010 -0700 @@ -48,11 +48,11 @@ [window makeKeyAndOrderFront: self]; } return self; - } +} -- (void)setSizeWithX:(int)X Y:(int)Y { - printf("setSize(%d, %d)\n", X, Y); - } +- (NSWindow *)window { + return window; +} - (WebView *)view { return view;