Class: MittensUi::Checkbox

Inherits:
Core
  • Object
show all
Defined in:
lib/mittens_ui/checkbox.rb

Instance Attribute Summary collapse

Attributes inherited from Core

#core_widget

Instance Method Summary collapse

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 = {}) ⇒ Checkbox

Returns a new instance of Checkbox.



7
8
9
10
11
12
13
14
15
16
# File 'lib/mittens_ui/checkbox.rb', line 7

def initialize(options={})
			label = options[:label] || "Checkbox"

			@value = nil
  @checkbox = Gtk::CheckButton.new(label)

  $vertical_box.pack_start(@checkbox)

  super(@checkbox, options)
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/mittens_ui/checkbox.rb', line 5

def value
  @value
end

Instance Method Details

#toggleObject



18
19
20
21
22
# File 'lib/mittens_ui/checkbox.rb', line 18

def toggle
  @checkbox.signal_connect "toggled" do
    yield
  end
end