[macruby-changes] [362] MacRuby/trunk/sample-macruby/HotCocoa/layout_view.rb

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 10 13:54:53 PDT 2008


Revision: 362
          http://trac.macosforge.org/projects/ruby/changeset/362
Author:   rich at infoether.com
Date:     2008-07-10 13:54:53 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
update layout method

Modified Paths:
--------------
    MacRuby/trunk/sample-macruby/HotCocoa/layout_view.rb

Modified: MacRuby/trunk/sample-macruby/HotCocoa/layout_view.rb
===================================================================
--- MacRuby/trunk/sample-macruby/HotCocoa/layout_view.rb	2008-07-10 20:54:28 UTC (rev 361)
+++ MacRuby/trunk/sample-macruby/HotCocoa/layout_view.rb	2008-07-10 20:54:53 UTC (rev 362)
@@ -9,15 +9,17 @@
     alloc.initWithFrame([0, 0, *DefaultSize])
   end
   
+  def initWithFrame(frame)
+    super
+    @layout = HotCocoa::LayoutOptions.new(self)
+    self
+  end
+  
   def reset_size
     setFrameSize(DefaultSize)
   end
   
-  def layout
-    @layout ||= HotCocoa::LayoutOptions.new
-  end
-
-  attr_accessor :number
+  attr_accessor :number, :layout
  
   def drawRect(rect)
     (color :red => 0.29, :green => 0.26, :blue => 0.55).set
@@ -90,7 +92,7 @@
         view = MyView.create
         views << view
         view.number = views.size
-        win.view << view
+        win.view.addSubview view
         views_p.items = views.map { |x| "View #{x.number}" }
         selected_view = views[0]
       end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080710/ab5108a8/attachment.html 


More information about the macruby-changes mailing list