[macruby-changes] [602] MacRuby/trunk/lib/hotcocoa/mappings/toolbar.rb

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 17 17:29:24 PDT 2008


Revision: 602
          http://trac.macosforge.org/projects/ruby/changeset/602
Author:   lsansonetti at apple.com
Date:     2008-09-17 17:29:23 -0700 (Wed, 17 Sep 2008)
Log Message:
-----------
adding convenience constants for toolbar size and display

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

Modified: MacRuby/trunk/lib/hotcocoa/mappings/toolbar.rb
===================================================================
--- MacRuby/trunk/lib/hotcocoa/mappings/toolbar.rb	2008-09-17 22:33:35 UTC (rev 601)
+++ MacRuby/trunk/lib/hotcocoa/mappings/toolbar.rb	2008-09-18 00:29:23 UTC (rev 602)
@@ -1,10 +1,24 @@
 HotCocoa::Mappings.map :toolbar => :NSToolbar do
 
+  constant :size, {
+    :default => NSToolbarSizeModeDefault,
+    :regular => NSToolbarSizeModeRegular,
+    :small => NSToolbarSizeModeSmall
+  }
+
+  constant :display, {
+    :default => NSToolbarDisplayModeDefault,
+    :icon_and_label => NSToolbarDisplayModeIconAndLabel,
+    :icon => NSToolbarDisplayModeIconOnly,
+    :label => NSToolbarDisplayModeLabelOnly
+  }
+
   defaults :identifier => 'DefaultToolbarIdentifier',
            :allowed => [:separator, :space, :flexible_space, :show_colors,
                         :show_fonts, :customize, :print],
            :default => [],
-           :allow_customization => true
+           :allow_customization => true,
+           :size => :default
 
   def init_with_options(toolbar, options)
     toolbar.initWithIdentifier options.delete(:identifier)
@@ -56,4 +70,16 @@
     toolbar
   end
 
+  custom_methods do
+
+    def size=(mode)
+      setSizeMode(mode)
+    end
+
+    def display=(mode)
+      setDisplayMode(mode)
+    end
+
+  end
+
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080917/84423e5f/attachment.html 


More information about the macruby-changes mailing list