[macruby-changes] [339] MacRuby/trunk/lib/hotcocoa

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 9 13:24:12 PDT 2008


Revision: 339
          http://trac.macosforge.org/projects/ruby/changeset/339
Author:   rich at infoether.com
Date:     2008-07-09 13:24:11 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
changing to LayoutView and layout

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

Modified: MacRuby/trunk/lib/hotcocoa/mappings/packing_view.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/packing_view.rb	2008-07-09 18:25:01 UTC (rev 338)
+++ MacRuby/trunk/lib/hotcocoa/mappings/packing_view.rb	2008-07-09 20:24:11 UTC (rev 339)
@@ -1,6 +1,6 @@
 require 'hotcocoa/packing_view'
 
-Mappings.map :packing_view => :PackingView do
+Mappings.map :layout => :LayoutView do
 
   defaults :frame => DefaultEmptyRect
 

Modified: MacRuby/trunk/lib/hotcocoa/mappings/slider.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/slider.rb	2008-07-09 18:25:01 UTC (rev 338)
+++ MacRuby/trunk/lib/hotcocoa/mappings/slider.rb	2008-07-09 20:24:11 UTC (rev 339)
@@ -16,6 +16,10 @@
       setMaxValue(value)
     end
     
+    def tic_marks=(value)
+      setNumberOfTickMarks(value)
+    end
+    
   end
   
 end

Modified: MacRuby/trunk/lib/hotcocoa/mappings/window.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/window.rb	2008-07-09 18:25:01 UTC (rev 338)
+++ MacRuby/trunk/lib/hotcocoa/mappings/window.rb	2008-07-09 20:24:11 UTC (rev 339)
@@ -38,6 +38,10 @@
       orderFrontRegardless
     end
     
+    def content_view=(view)
+      setContentView(view)
+    end
+    
   end
   
   delegating "window:shouldDragDocumentWithEvent:from:withPasteboard:", :to => :should_drag_document?,    :parameters => [:shouldDragDocumentWithEvent, :from, :withPasteboard]

Modified: MacRuby/trunk/lib/hotcocoa/packing_view.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/packing_view.rb	2008-07-09 18:25:01 UTC (rev 338)
+++ MacRuby/trunk/lib/hotcocoa/packing_view.rb	2008-07-09 20:24:11 UTC (rev 339)
@@ -1,5 +1,5 @@
 module HotCocoa
-class PackingView < NSView
+class LayoutView < NSView
 
   def initWithFrame(frame)
     super
@@ -49,7 +49,7 @@
       relayout!
     end
   end
-
+  
   # options can be
   #
   #  :start -> bool
@@ -167,54 +167,54 @@
       subview_dimension = vertical ? subview_size.height : subview_size.width
 
       if vertical
-	view_frame.origin.x = @margin
-	if options[:start]
+        view_frame.origin.x = @margin
+        if options[:start]
           view_frame.origin.y = dimension
         else
           view_frame.origin.y = end_dimension - subview_dimension
         end        
       else
-	if options[:start]
+        if options[:start]
           view_frame.origin.x = dimension
         else
           view_frame.origin.x = end_dimension - subview_dimension
         end        
-	view_frame.origin.y = @margin
+        view_frame.origin.y = @margin
       end
 
       if options[:expand]
         if vertical
-	  view_frame.size.height = expandable_size
-	else
+          view_frame.size.height = expandable_size
+        else
           view_frame.size.width = expandable_size
         end
-	subview_dimension = expandable_size
+        subview_dimension = expandable_size
       end
 
       case options[:other]
-	when :fill
-          if vertical
-            view_frame.size.width = view_size.width - (2 * @margin)
-          else
-            view_frame.size.height = view_size.height - (2 * @margin)
-          end           
+      when :fill
+        if vertical
+          view_frame.size.width = view_size.width - (2 * @margin)
+        else
+          view_frame.size.height = view_size.height - (2 * @margin)
+        end           
 
-        when :align_head
-	  # Nothing to do
+      when :align_head
+        # Nothing to do
 
-	when :align_center
-	  if vertical
-	    view_frame.origin.x = (view_size.width / 2.0) - (subview_size.width / 2.0)
-	  else
-	    view_frame.origin.y = (view_size.height / 2.0) - (subview_size.height / 2.0)
-	  end
+      when :align_center
+        if vertical
+          view_frame.origin.x = (view_size.width / 2.0) - (subview_size.width / 2.0)
+        else
+          view_frame.origin.y = (view_size.height / 2.0) - (subview_size.height / 2.0)
+        end
 
-	when :align_tail
-          if vertical
-	    view_frame.origin.x = view_size.width - subview_size.width - @margin
-          else
-	    view_frame.origin.y = view_size.height - subview_size.height - @margin
-          end
+      when :align_tail
+        if vertical
+          view_frame.origin.x = view_size.width - subview_size.width - @margin
+        else
+          view_frame.origin.y = view_size.height - subview_size.height - @margin
+        end
       end
 
       puts "view #{view} options #{options} final frame #{view_frame}" if $DEBUG
@@ -225,9 +225,9 @@
       if options[:start]
         dimension += subview_dimension + @spacing
         if vertical
-	  dimension += options[:bottom_padding] + options[:top_padding]
-	else
-	  dimension += options[:left_padding] + options[:right_padding]
+          dimension += options[:bottom_padding] + options[:top_padding]
+        else
+          dimension += options[:left_padding] + options[:right_padding]
         end
       else
         end_dimension -= subview_dimension + @spacing
@@ -236,6 +236,5 @@
       view.frame = view_frame      
     end    
   end
-
 end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080709/b40357e1/attachment-0001.html 


More information about the macruby-changes mailing list