Revision
516
Author
rich@infoether.com
Date
2008-08-29 13:16:43 -0700 (Fri, 29 Aug 2008)

Log Message

add alert

Added Paths

Diff

Added: MacRuby/trunk/lib/hotcocoa/mappings/alert.rb (0 => 516)


--- MacRuby/trunk/lib/hotcocoa/mappings/alert.rb	                        (rev 0)
+++ MacRuby/trunk/lib/hotcocoa/mappings/alert.rb	2008-08-29 20:16:43 UTC (rev 516)
@@ -0,0 +1,21 @@
+HotCocoa::Mappings.map :alert => :NSAlert do
+  
+  defaults :default => "OK", :alternate => nil, :other => nil, :info => nil
+  
+  def alloc_with_options(options)
+    if options[:message]
+      NSAlert.alertWithMessageText options.delete(:message), 
+        defaultButton:options.delete(:default), 
+        alternateButton:options.delete(:alternate),
+        otherButton:options.delete(:other),
+        informativeTextWithFormat:options.delete(:info)
+    end
+  end
+  
+  custom_methods do
+    def show
+      runModal
+    end
+  end
+  
+end