lib/ppcurses/view.rb in ppcurses-0.1.0 vs lib/ppcurses/view.rb in ppcurses-0.1.1
- old
+ new
@@ -8,10 +8,20 @@
#
# https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/index.html#//apple_ref/occ/instp/NSView/subviews
class View < ResponderManager
+ attr_accessor :frame
+
+ # Extending classes should set the appropriate frame size;
+ # the default implementation sets the frame to a zero rect
+ # which, although avoids pointer errors, isn't very useful.
+ def initialize
+ @frame = Rect.zeroRect
+ end
+
+
## Managing the View Hierarchy
# superview
# add_subview
@@ -37,9 +47,22 @@
# canBecomeKeyView
# nextKeyView
#
+
+ ## Modifying the Frame Rectangle
+
+
+ def setFrameOrigin( origin )
+ @frame.origin = origin
+ end
+
+
+ def setFrameSize( size )
+ @frame.size = size
+ end
+
end
end