Class: MG::Widget

Inherits:
Node
  • Object
show all
Defined in:
doc/API_reference.rb

Overview

directly but use a subclass instead.

Direct Known Subclasses

Button, Layout, Slider, Text, Web

Properties collapse

Attributes inherited from Node

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

Events collapse

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #parent, #run_action, #stop_action, #stop_all_actions

Instance Attribute Details

#enabled?Boolean

Whether the widget is enabled. When enabled, a widget can be touched or clicked. By default, a widget is enabled.

Returns:

  • (Boolean)

    whether the widget is enabled.



1156
1157
1158
# File 'doc/API_reference.rb', line 1156

def enabled?
  @enabled?
end

#highlighted?Boolean

Whether the widget is highlighted. By default, a widget is not highlighted.

Returns:

  • (Boolean)

    whether the widget is highlighted.



1165
1166
1167
# File 'doc/API_reference.rb', line 1165

def highlighted?
  @highlighted?
end

#touch_enabled?Boolean

Whether the widget is touch enabled. When touch enabled, a widget supports on_touch. By default, a widget is not touch enabled.

Returns:

  • (Boolean)

    whether the widget is touch enabled.



1161
1162
1163
# File 'doc/API_reference.rb', line 1161

def touch_enabled?
  @touch_enabled?
end

Instance Method Details

#on_touch {|Symbol| ... } ⇒ Widget

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 :begin, :move, :end or :cancel.

Returns:



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

def on_touch; end