[macruby-changes] [342] MacRuby/trunk/sample-macruby/HotCocoa/packing_view.rb
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 9 13:28:19 PDT 2008
Revision: 342
http://trac.macosforge.org/projects/ruby/changeset/342
Author: rich at infoether.com
Date: 2008-07-09 13:28:19 -0700 (Wed, 09 Jul 2008)
Log Message:
-----------
changing to layout
Modified Paths:
--------------
MacRuby/trunk/sample-macruby/HotCocoa/packing_view.rb
Modified: MacRuby/trunk/sample-macruby/HotCocoa/packing_view.rb
===================================================================
--- MacRuby/trunk/sample-macruby/HotCocoa/packing_view.rb 2008-07-09 20:27:22 UTC (rev 341)
+++ MacRuby/trunk/sample-macruby/HotCocoa/packing_view.rb 2008-07-09 20:28:19 UTC (rev 342)
@@ -37,7 +37,7 @@
pv = packing_view :mode => :horizontal, :frame => [0, 0, 0, 24]
l = label(:text => label)
pv.pack l, :other => :align_center
- s = slider :min => 0, :max => 50, :numberOfTickMarks => 20,
+ s = slider :min => 0, :max => 50, :tic_marks => 20,
:on_action => block
s.setFrameSize([0, 24]) # TODO sizeToFit doesn't set the height for us
pv.pack s, :expand => true
@@ -46,8 +46,7 @@
application do |app|
- window :frame => [100, 100, 500, 500],
- :title => "Packing View Madness" do |win|
+ window :frame => [100, 100, 500, 500], :title => "Packing View Madness" do |win|
pv = packing_view :frame => [0, 0, 500, 500]
win.contentView = pv
@@ -66,7 +65,7 @@
vertical_b = button :title => "Vertical", :type => :switch, :state => :on
vertical_b.on_action do |b|
- views.each { |v| v.reset_size }
+ views.each { |v| v.reset_size }
pv.mode = b.on? ? :vertical : :horizontal
end
pane_pv.pack vertical_b, :start => false
@@ -80,15 +79,15 @@
selected_view = views[p.items.selected_index]
options = pv.options_for_view(selected_view)
expand_b.state = options[:expand] ? :on : :off
- left_padding_s.intValue = options[:left_padding]
- right_padding_s.intValue = options[:right_padding]
- top_padding_s.intValue = options[:top_padding]
- bottom_padding_s.intValue = options[:bottom_padding]
- other_p.items.selected = case options[:other]
- when :align_head then 0
- when :align_center then 1
- when :align_tail then 2
- when :fill then 3
+ left_padding_s.intValue = options[:left_padding]
+ right_padding_s.intValue = options[:right_padding]
+ top_padding_s.intValue = options[:top_padding]
+ bottom_padding_s.intValue = options[:bottom_padding]
+ other_p.items.selected = case options[:other]
+ when :align_head then 0
+ when :align_center then 1
+ when :align_tail then 2
+ when :fill then 3
end
end
@@ -133,8 +132,8 @@
tmp_pv.pack l, :other => :align_center
other_p = popup :items => ['Align Head', 'Align Center', 'Align Tail', 'Fill']
other_p.on_action do |x|
- selected_view.reset_size
- pv.change_option_for_view(selected_view, :other, x.items.selected.downcase.tr(' ', '_').intern)
+ selected_view.reset_size
+ pv.change_option_for_view(selected_view, :other, x.items.selected.downcase.tr(' ', '_').intern)
end
tmp_pv.pack other_p, :expand => true
pane_pv.pack tmp_pv, :start => false, :other => :fill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080709/3399199a/attachment-0001.html
More information about the macruby-changes
mailing list