Class: MittensUi::Slider
Instance Attribute Summary
Attributes inherited from Core
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Slider
constructor
A new instance of Slider.
- #move ⇒ Object (also: #slide)
- #render ⇒ Object
Methods inherited from Core
#hidden?, #hide, #remove, #show
Methods included from Helpers
#icon_map, #list_system_icons, #set_margin_from_opts_for
Constructor Details
#initialize(options = {}) ⇒ Slider
Returns a new instance of Slider.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mittens_ui/slider.rb', line 5 def initialize(={}) start_value = [:start_value].nil? ? 1.0 : [:start_value] stop_value = [:stop_value].nil? ? 10.0 : [:stop_value] step_value = [:step_value].nil? ? 1.0 : [:step_value] init_value = [:initial_value].nil? ? 1.0 : [:initial_value] @scale = Gtk::Scale.new(:horizontal, start_value, stop_value, step_value) @scale.digits = 0 @scale.draw_value = true @scale.value = init_value super(@scale) end |
Instance Method Details
#move ⇒ Object Also known as: slide
19 20 21 22 23 |
# File 'lib/mittens_ui/slider.rb', line 19 def move @scale.signal_connect "value_changed" do || yield() end end |
#render ⇒ Object
26 27 28 29 |
# File 'lib/mittens_ui/slider.rb', line 26 def render $vertical_box.pack_start(@scale) return self end |