Created
October 31, 2010 11:14
macrubyでGUIつきでググる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
framework 'Cocoa' | |
framework 'WebKit' | |
application = NSApplication.sharedApplication | |
# create the window | |
width = 800.0 | |
height = 600.0 | |
frame = [0.0, 0.0, width, height] | |
mask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | |
window = NSWindow.alloc.initWithContentRect(frame, | |
styleMask:mask, | |
backing:NSBackingStoreBuffered, | |
defer:false) | |
# assign a content view instance | |
content_view = NSView.alloc.initWithFrame(frame) | |
window.contentView = content_view | |
# create a web view positioned in the top left quarter of the super view | |
web_view_frame = [0.0, 0.0, width, height] # [位置,位置,長さ,長さ] (開始位置は左下) | |
web_view = WebView.alloc.initWithFrame(web_view_frame, frameName: "Web Frame", groupName: nil) | |
request = NSURLRequest.requestWithURL(NSURL.URLWithString("http://www.google.co.jp/search?q=zakuni")) | |
web_view.mainFrame.loadRequest(request) | |
content_view.addSubview(web_view) | |
# center the window | |
window.center | |
# show the window | |
window.display | |
window.makeKeyAndOrderFront(nil) | |
window.orderFrontRegardless | |
application.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment