Class: ChemistryParadise::GUI::LibUI::TemperatureConverter

Inherits:
Object
  • Object
show all
Includes:
TemperatureConverterModule, LibuiParadise::Extensions
Defined in:
lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb

Overview

ChemistryParadise::GUI::LibUI::TemperatureConverter

Constant Summary

Constants included from TemperatureConverterModule

TemperatureConverterModule::HEIGHT, TemperatureConverterModule::NAMESPACE, TemperatureConverterModule::TITLE, TemperatureConverterModule::USE_THIS_FONT, TemperatureConverterModule::WIDTH

Instance Method Summary collapse

Methods included from TemperatureConverterModule

#border_size?, #calculate_celsius_and_set_the_correct_value, #calculate_fahrenheit_and_set_the_correct_value, #calculate_kelvin_and_set_the_correct_value, #create_the_entries, #create_the_grid, #padding?, #reset_the_shared_module, #return_n_kelvin, #return_the_title_as_label, #set_all_entries_to

Constructor Details

#initialize(run_already = true) ⇒ TemperatureConverter

#

initialize

#


26
27
28
29
30
31
# File 'lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb', line 26

def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Instance Method Details

#create_skeletonObject

#

create_skeleton (create tag, skeleton tag)

#


43
44
45
46
47
48
49
50
51
# File 'lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb', line 43

def create_skeleton
  abort_on_exception
  # ======================================================================= #
  # === @window
  # ======================================================================= #
  @window = ui_padded_main_window(title?, width?, height?, 0)
  create_the_entries
  create_the_grid
end

#resetObject

#

reset (reset tag)

#


36
37
38
# File 'lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb', line 36

def reset
  title_width_height(TITLE, WIDTH, HEIGHT)
end

#return_all_entriesObject

#

return_all_entries

#


56
57
58
# File 'lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb', line 56

def return_all_entries
  []
end

#runObject

#

run

#


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb', line 63

def run
  create_skeleton_then_connect_skeleton
  outer_vbox = padded_vbox
  outer_vbox.minimal(return_the_title_as_label, 0)
  @grid.hash_grid(
    bold_text('Celsius:'), left: 0, top: 0, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
  )
  @grid.hash_grid(
    @entry_celsius, left: 1, top: 0, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
  )

  @grid.hash_grid(
    bold_text('Fahrenheit:'), left: 0, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
  )
  @grid.hash_grid(
    @entry_fahrenheit, left: 1, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
  )

  @grid.hash_grid(
    bold_text('Kelvin:'), left: 0, top: 2, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
  )
  @grid.hash_grid(
    @entry_kelvin, left: 1, top: 2, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
  )

  outer_vbox.minimal(@grid, 12)
  outer_vbox.add_hsep
  outer_vbox.minimal(quit_button)
  outer_vbox.add_hsep
  @window.add(outer_vbox)
  @window.intelligent_exit
end