Sha256: 9d75872ef86e6d6a4afe4a571da6a836bf329df04292914705804d875342678f

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8
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.6.0.1 lib/jldrill/views/gtk/widgets/PromptWindow.rb