[macruby-changes] [507] MacRuby/trunk/lib/hotcocoa/mappings

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 27 22:27:16 PDT 2008


Revision: 507
          http://trac.macosforge.org/projects/ruby/changeset/507
Author:   rich at infoether.com
Date:     2008-08-27 22:27:16 -0700 (Wed, 27 Aug 2008)
Log Message:
-----------
add ability to get named image

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

Modified: MacRuby/trunk/lib/hotcocoa/mappings/combo_box.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/combo_box.rb	2008-08-28 05:24:31 UTC (rev 506)
+++ MacRuby/trunk/lib/hotcocoa/mappings/combo_box.rb	2008-08-28 05:27:16 UTC (rev 507)
@@ -13,7 +13,7 @@
       data_source = ComboBoxDataSource.new(data_source) if data_source.kind_of?(Array)
       setDataSource(data_source)
     end
-
+    
   end
   
 end

Modified: MacRuby/trunk/lib/hotcocoa/mappings/image.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/image.rb	2008-08-28 05:24:31 UTC (rev 506)
+++ MacRuby/trunk/lib/hotcocoa/mappings/image.rb	2008-08-28 05:27:16 UTC (rev 507)
@@ -1,12 +1,14 @@
 HotCocoa::Mappings.map :image => :NSImage do
   
-  def init_with_options(image, options)
+  def alloc_with_options(options)
     if options.has_key?(:file)
-      image.initWithContentsOfFile(options.delete(:file))
+      NSImage.alloc.initWithContentsOfFile(options.delete(:file))
     elsif options.has_key?(:url)
-      image.initByReferencingURL(NSURL.alloc.initWithString(options.delete(:url)))
+      NSImage.alloc.initByReferencingURL(NSURL.alloc.initWithString(options.delete(:url)))
+    elsif options.has_key?(:named)
+      NSImage.imageNamed(options.delete(:named))
     else
-      image.init
+      NSImage.alloc.init
     end
   end
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080827/075e758c/attachment-0001.html 


More information about the macruby-changes mailing list