Class: MG::CheckBox

Inherits:
Widget show all
Defined in:
doc/API_reference.rb

Overview

check_box.on_selected { |type| puts “selected!” if type == :selected }

Instance Attribute Summary

Attributes inherited from Node

#alpha, #anchor_point, #color, #name, #position, #rotation, #scale, #size, #z_index

Constructors collapse

Instance Method Summary collapse

Methods inherited from Widget

#enabled=, #enabled?, #highlighted=, #highlighted?, #on_touch, #touch_enabled=, #touch_enabled?

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #number_of_running_actions, #parent, #run_action, #schedule, #schedule_once, #stop_action, #stop_all_actions, #unschedule, #visible=, #visible?

Constructor Details

#initialize(background, cross) ⇒ CheckBox

Creates a new CheckBox widget.

Parameters:

  • background (String)

    a background texture name.

  • cross (String)

    a cross texture name.



1541
# File 'doc/API_reference.rb', line 1541

def initialize(background, cross); end

Instance Method Details

#on_selected {|Symbol| ... } ⇒ self

Configures a block to be called when a touch event is received on the widget.

Yields:

  • (Symbol)

    the given block will be called when the event is received with a Symbol that describes the type of event, which can be :selected or :unselected

Returns:

  • (self)

    the receiver.



1560
# File 'doc/API_reference.rb', line 1560

def on_selected; end

#selected=(value) ⇒ Object

Set selected state for checkbox.

Parameters:

  • value (Boolean)

    true that checkbox is selected, false otherwise.



1552
# File 'doc/API_reference.rb', line 1552

def selected=(value); end

#selected?Boolean

Get selected state of checkbox.

Returns:

  • (Boolean)

    true if checkbox is selected.



1548
# File 'doc/API_reference.rb', line 1548

def selected?; end