Class: JLDrill::Gtk::OptionsWindow::Scale

Inherits:
Object
  • Object
show all
Defined in:
lib/jldrill/views/gtk/widgets/OptionsWindow.rb

Overview

A horizontal slider with a label on the left

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, first, last, step) ⇒ Scale

Returns a new instance of Scale.



31
32
33
34
35
36
37
# File 'lib/jldrill/views/gtk/widgets/OptionsWindow.rb', line 31

def initialize(label, first, last, step)
    @box = Gtk::HBox.new()
    @label = Gtk::Label.new(label + ": ") 
    @scale = Gtk::HScale.new(first, last, step)
    @box.pack_start(@label, false)
    @box.pack_start(@scale, true)
end

Instance Attribute Details

#boxObject (readonly)

Returns the value of attribute box.



29
30
31
# File 'lib/jldrill/views/gtk/widgets/OptionsWindow.rb', line 29

def box
  @box
end

#labelObject (readonly)

Returns the value of attribute label.



29
30
31
# File 'lib/jldrill/views/gtk/widgets/OptionsWindow.rb', line 29

def label
  @label
end

#scaleObject (readonly)

Returns the value of attribute scale.



29
30
31
# File 'lib/jldrill/views/gtk/widgets/OptionsWindow.rb', line 29

def scale
  @scale
end

Instance Method Details

#add(widget, expand = true, fill = true, padding = 0) ⇒ Object

Add a widget to the right of the slider



40
41
42
# File 'lib/jldrill/views/gtk/widgets/OptionsWindow.rb', line 40

def add(widget, expand=true, fill=true, padding=0)
    @box.pack_start(widget, expand, fill, padding)
end