[macruby-changes] [364] MacRuby/trunk/lib/hotcocoa/mappings/window.rb

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 10 14:34:19 PDT 2008


Revision: 364
          http://trac.macosforge.org/projects/ruby/changeset/364
Author:   rich at infoether.com
Date:     2008-07-10 14:34:19 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
change the way the options are used to insert a LayoutView, allowing it to accept the default_options when building the window and :view => :layout being removed

Modified Paths:
--------------
    MacRuby/trunk/lib/hotcocoa/mappings/window.rb

Modified: MacRuby/trunk/lib/hotcocoa/mappings/window.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/window.rb	2008-07-10 21:06:17 UTC (rev 363)
+++ MacRuby/trunk/lib/hotcocoa/mappings/window.rb	2008-07-10 21:34:19 UTC (rev 364)
@@ -4,7 +4,8 @@
             :backing => :buffered, 
             :defer => true,
             :show => true,
-            :view => :layout
+            :view => :layout,
+            :default_layout => {}
             
   constant :backing, :buffered => NSBackingStoreBuffered
   
@@ -17,10 +18,16 @@
   }
 
   def init_with_options(window, options)
-    window.initWithContentRect options.delete(:frame), 
+    window = window.initWithContentRect options.delete(:frame), 
                                styleMask:options.delete(:style), 
                                backing:options.delete(:backing), 
                                defer:options.delete(:defer)
+    if options[:view] == :layout
+      options.delete(:view)
+      window.setContentView(LayoutView.alloc.initWithFrame([0,0,window.contentView.frameSize.width, window.contentView.frameSize.height]))
+      window.contentView.default_layout = options.delete(:default_layout)
+    end
+    window
   end
     
   custom_methods do
@@ -34,11 +41,7 @@
     end
 
     def view=(view)
-      if view == :layout
-        setContentView(LayoutView.alloc.initWithFrame([0,0,contentView.frameSize.width, contentView.frameSize.height]))
-      else
-        setContentView(view)
-      end
+      setContentView(view)
     end
     
     def show
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080710/602c6eae/attachment.html 


More information about the macruby-changes mailing list