Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a convenience method to create a window.

  • Loading branch information...
commit 717304c936ba516eae73a4059d72fa1d9e59f046 1 parent 1c8b068
@alloy authored
Showing with 13 additions and 4 deletions.
  1. +3 −3 TODO
  2. +10 −1 lib/irb/cocoa/view_controller.rb
View
6 TODO
@@ -1,8 +1,8 @@
== For the kaigi
-* Add a few convenience methods to create a window/view to play around with.
-* Add ‘try ruby’
-* Add border around textfields that use the same highlighting
+* Add ‘try ruby’.
+* Add border around textfields that use the same highlighting as shown in the gutter.
+* Add a few convenience methods to create views to play around with?
== OLD TODOS
View
11 lib/irb/cocoa/view_controller.rb
@@ -247,6 +247,15 @@ def irb(object, binding = nil)
waitUntilDone: true)
nil
end
-
private :irb
+
+ def window(frame = NSMakeRect(50, 50, 640, 480))
+ window = NSWindow.alloc.initWithContentRect(frame,
+ styleMask:NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask,
+ backing:NSBackingStoreBuffered,
+ defer:false)
+ window.title = "Window for: #{NSApp.mainWindow.title}"
+ window.orderWindow(NSWindowBelow, relativeTo:NSApp.mainWindow.windowNumber)
+ end
+ private :window
end
Please sign in to comment.
Something went wrong with that request. Please try again.