Sha256: c748939308c9dcfc4e876a5f5a7474f5c08eb072ebb89d096b7cc907049e431c

Contents?: true

Size: 667 Bytes

Versions: 5

Compression:

Stored size: 667 Bytes

Contents

module Fidgit
  # A simple dialog that manages a message with a set of buttons beneath it.
  class FileDialog < DialogState
    def initialize(type, options = {}, &block)
      options = {
        show: true,
        background_color: DEFAULT_BACKGROUND_COLOR,
        border_color: DEFAULT_BORDER_COLOR,
      }.merge! options

      super(options)

      pack :vertical, align: :center, padding: 0 do |packer|
        FileBrowser.new(type, { parent: packer }.merge!(options)) do |sender, result, file_name|
          hide
          block.call result, file_name if block
        end
      end

      show if options[:show]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fidgit-0.0.6alpha lib/fidgit/states/file_dialog.rb
fidgit-0.0.5alpha lib/fidgit/states/file_dialog.rb
fidgit-0.0.4alpha lib/fidgit/states/file_dialog.rb
fidgit-0.0.3alpha lib/fidgit/states/file_dialog.rb
fidgit-0.0.2alpha lib/fidgit/states/file_dialog.rb