class SpinbuttonDemo

Public Class Methods

new(main_window) click to toggle source
# File gtk3/sample/gtk-demo/spinbutton.rb, line 15
def initialize(main_window)
  builder = Gtk::Builder.new(:resource => "/spinbutton/spinbutton.ui")
  builder.connect_signals do |name|
    case name
    when "hex_spin_input"
      proc do |button|
        hex_spin_input(button)
      end
    when "hex_spin_output"
      proc do |button|
        hex_spin_output(button)
      end
    when "time_spin_input"
      proc do |button|
        time_spin_input(button)
      end
    when "time_spin_output"
      proc do |button|
        time_spin_output(button)
      end
    when "month_spin_input"
      proc do |button|
        month_spin_input(button)
      end
    when "month_spin_output"
      proc do |button|
        month_spin_output(button)
      end
    else
    end
  end
  @window = builder["window"]
  @window.screen = main_window.screen
  @window.title = "Spin Buttons"
  @window.resizable = false

  value_to_label = proc do |value|
    value.to_s
  end

  adj = builder["basic_adjustment"]
  basic_label = builder["basic_label"]
  adj.bind_property("value", basic_label, "label", :sync_create,
                    :transform_to => value_to_label)

  hex_adj = builder["hex_adjustment"]
  hex_label = builder["hex_label"]
  hex_adj.bind_property("value", hex_label, "label", :sync_create,
                    :transform_to => value_to_label)

  adj = builder["time_adjustment"]
  time_label = builder["time_label"]
  adj.bind_property("value", time_label, "label", :sync_create,
                    :transform_to => value_to_label)

  adj = builder["month_adjustment"]
  month_label = builder["month_label"]
  adj.bind_property("value", month_label, "label", :sync_create,
                    :transform_to => value_to_label)

end

Public Instance Methods

run() click to toggle source
# File gtk3/sample/gtk-demo/spinbutton.rb, line 77
def run
  if !@window.visible?
    @window.show_all
  else
    @window.destroy
  end
  @window
end