Class: SKUI::Checkbox

Inherits:
Control show all
Defined in:
src/SKUI/checkbox.rb

Overview

Since:

  • 1.0.0

Direct Known Subclasses

RadioButton

Instance Attribute Summary

Attributes inherited from Control

#rect

Attributes inherited from Base

#properties, #window

Instance Method Summary collapse

Methods inherited from Control

#enabled, #left, #name, #position, #release, #size, #stretch, #tab_index, #tooltip, #visible, #width, #z_index

Methods inherited from Base

#background_color, #font, #foreground_color, #inspect, #parent, #release, #to_js, #typename, #ui_id

Methods included from Events

#add_event_handler, included, #release_events, #trigger_event

Constructor Details

#initialize(label, checked = false) ⇒ Checkbox

Returns a new instance of Checkbox.

Parameters:

  • label (String)
  • checked (Boolean) (defaults to: false)

Since:

  • 1.0.0



25
26
27
28
29
# File 'src/SKUI/checkbox.rb', line 25

def initialize( label, checked = false )
  super()
  @properties[ :label ]   = label
  @properties[ :checked ] = checked
end

Instance Method Details

#checkBoolean

Returns:

  • (Boolean)

Since:

  • 1.0.0



33
34
35
# File 'src/SKUI/checkbox.rb', line 33

def check
  self.checked = true
end

#checkedBoolean

Returns:

  • (Boolean)

Since:

  • 1.0.0



15
# File 'src/SKUI/checkbox.rb', line 15

prop_writer( :checked, &TypeCheck::BOOLEAN )

#checked?Boolean

Returns:

  • (Boolean)

Since:

  • 1.0.0



39
40
41
# File 'src/SKUI/checkbox.rb', line 39

def checked?
  self.checked = window.bridge.get_checkbox_state( ui_id )
end

#labelString

Returns:

  • (String)

Since:

  • 1.0.0



11
# File 'src/SKUI/checkbox.rb', line 11

prop( :label, &TypeCheck::STRING )

#toggleBoolean

Returns:

  • (Boolean)

Since:

  • 1.0.0



45
46
47
# File 'src/SKUI/checkbox.rb', line 45

def toggle
  self.checked = !checked?
end

#uncheckBoolean

Returns:

  • (Boolean)

Since:

  • 1.0.0



51
52
53
# File 'src/SKUI/checkbox.rb', line 51

def uncheck
  self.checked = false
end