Class: Todoable::UI::NewItemDialog

Inherits:
Gtk::Dialog
  • Object
show all
Defined in:
lib/todoable/ui/gtk/newitem.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, title, default_text = '') ⇒ NewItemDialog

Returns a new instance of NewItemDialog



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/todoable/ui/gtk/newitem.rb', line 20

def initialize parent, title, default_text = ''
  super :parent => parent,
        :title => title,
        :flags => [:modal, :destroy_with_parent],
        :buttons => [
          [Gtk::Stock::OK, Gtk::ResponseType::OK],
          [Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL]]

  # Set UI and UX properties
  set_default_response Gtk::ResponseType::OK
  child.margin = 10

  # Populate widget with internal UI elements
  @default_text = default_text
  @name_input = nil
  add_ui_elements
end

Instance Method Details

#run_and_get_inputObject



38
39
40
# File 'lib/todoable/ui/gtk/newitem.rb', line 38

def run_and_get_input
  @name_input.text if run == :ok
end