Mercurial > osx-quasimode
changeset 12:4bb0e66b4d7f
implemented quasimode.setSize()
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Sun, 11 Apr 2010 21:18:13 -0700 |
parents | f98ecd33c5e0 |
children | bab79fdfa745 |
files | JavaScriptQuasimode.m Quasimode.h Quasimode.m |
diffstat | 3 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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
--- 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;