lib/shoes/swt/dialog.rb in shoes-swt-4.0.0.pre3 vs lib/shoes/swt/dialog.rb in shoes-swt-4.0.0.pre4
- old
+ new
@@ -13,11 +13,11 @@
def confirm(msg = '')
answer_id = open_message_box CONFIRM_STYLE, msg
confirmed? answer_id
end
- def dialog_chooser(title, folder = false)
- style = ::Swt::SWT::OPEN
+ def dialog_chooser(title, folder = false, style = :open)
+ style = (style == :save ? ::Swt::SWT::SAVE : ::Swt::SWT::OPEN)
shell = ::Swt::Widgets::Shell.new Shoes.display
fd = folder ? ::Swt::Widgets::DirectoryDialog.new(shell, style) : ::Swt::Widgets::FileDialog.new(shell, style)
fd.setText title
fd.open
end