Sha256: c474f558d0bc7714a91404dc5e7fbd5048e458df3f9dee88cc6799c784a635bc

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'Context/Gtk/Widget'
require 'gtk2'

module JLDrill::Gtk
    class PromptWindow < Gtk::Dialog
        include Context::Gtk::Widget

        attr_reader :response
        
        def initialize(view, title, message)
            @view = view
            @response = @view.context.cancel
            super(title, nil,
                  Gtk::Dialog::DESTROY_WITH_PARENT,
                  [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
                  [Gtk::Stock::NO, Gtk::Dialog::RESPONSE_NO],
                  [Gtk::Stock::YES, Gtk::Dialog::RESPONSE_YES])
            self.vbox.add(Gtk::Label.new(message))
        end
        
        def execute
            self.run do |response|
                case response
                when Gtk::Dialog::RESPONSE_YES
                    @response = @view.context.yes
                when Gtk::Dialog::RESPONSE_NO 
                    @response = @view.context.no
                else 
                    @response = @view.context.cancel
                end
            end
            @response
        end
    end	    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.5.1.7 lib/jldrill/views/gtk/widgets/PromptWindow.rb