Revision
602
Author
lsansonetti@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

Diff

Modified: MacRuby/trunk/lib/hotcocoa/mappings/toolbar.rb (601 => 602)


--- 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