Class: JLDrill::Gtk::PromptWindow

Inherits:
Gtk::Dialog
  • Object
show all
Includes:
Context::Gtk::Widget
Defined in:
lib/jldrill/views/gtk/widgets/PromptWindow.rb

Instance Attribute Summary collapse

Attributes included from Context::Gtk::Widget

#gtkWidgetMainWindow

Instance Method Summary collapse

Methods included from Context::Gtk::Widget

#addToThisWidget, #afterWidgetIsAdded, #afterWidgetIsRemoved, #expandWidgetHeight, #expandWidgetHeight?, #expandWidgetWidth, #expandWidgetWidth?, #gtkAddWidget, #gtkRemoveWidget, #isAMainWindow, #isInTests?, #removeFromThisWidget, #setupWidget, #widgetWasAddedTo, #widgetWasRemovedFrom

Constructor Details

#initialize(view, title, message) ⇒ PromptWindow

Returns a new instance of PromptWindow.



11
12
13
14
15
16
17
18
19
20
# File 'lib/jldrill/views/gtk/widgets/PromptWindow.rb', line 11

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

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/jldrill/views/gtk/widgets/PromptWindow.rb', line 9

def response
  @response
end

Instance Method Details

#executeObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jldrill/views/gtk/widgets/PromptWindow.rb', line 22

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