Class: Nuklear::UI::Menu
- Defined in:
- lib/nuklear/ui/menu.rb
Instance Attribute Summary collapse
-
#align ⇒ Object
Returns the value of attribute align.
-
#height ⇒ Object
Returns the value of attribute height.
-
#image ⇒ Object
Returns the value of attribute image.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
-
#title ⇒ Object
Returns the value of attribute title.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(enabled: true, title: nil, image: nil, symbol: nil, align: :left, width:, height:) ⇒ Menu
constructor
A new instance of Menu.
- #result(visible, context) ⇒ Object
- #to_command ⇒ Object
- #visible? ⇒ Boolean
Methods included from TextAlign
Methods included from Container
#<<, #commands, #find, #layout_row_dynamic, #method_missing, #run_command, #run_commands, #traverse, #ui_checkbox, #ui_color_picker, #ui_combo, #ui_edit_focus, #ui_edit_string, #ui_layout_row_begin, #ui_layout_row_dynamic, #ui_layout_row_push, #ui_layout_row_static, #ui_layout_row_template_begin, #ui_layout_row_template_dynamic, #ui_layout_row_template_end, #ui_layout_row_template_static, #ui_layout_row_template_variable, #ui_layout_space_begin, #ui_layout_space_end, #ui_layout_space_push, #ui_layout_widget_bounds, #ui_menu_item, #ui_option, #ui_selectable, #ui_window_close
Methods inherited from Base
Methods included from Enableable
#disable, #disabled=, #disabled?, #enable, #enabled=, #enabled?
Methods included from Events
#event_listeners_for, #on, #trigger
Constructor Details
#initialize(enabled: true, title: nil, image: nil, symbol: nil, align: :left, width:, height:) ⇒ Menu
Returns a new instance of Menu.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nuklear/ui/menu.rb', line 9 def initialize(enabled: true, title: nil, image: nil, symbol: nil, align: :left, width:, height:) super enabled: enabled @title = title @image = image @symbol = symbol @align = align @width = width @height = height end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Nuklear::UI::Container
Instance Attribute Details
#align ⇒ Object
Returns the value of attribute align.
7 8 9 |
# File 'lib/nuklear/ui/menu.rb', line 7 def align @align end |
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/nuklear/ui/menu.rb', line 7 def height @height end |
#image ⇒ Object
Returns the value of attribute image.
7 8 9 |
# File 'lib/nuklear/ui/menu.rb', line 7 def image @image end |
#symbol ⇒ Object
Returns the value of attribute symbol.
7 8 9 |
# File 'lib/nuklear/ui/menu.rb', line 7 def symbol @symbol end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/nuklear/ui/menu.rb', line 7 def title @title end |
#width ⇒ Object
Returns the value of attribute width.
7 8 9 |
# File 'lib/nuklear/ui/menu.rb', line 7 def width @width end |
Instance Method Details
#result(visible, context) ⇒ Object
37 38 39 40 |
# File 'lib/nuklear/ui/menu.rb', line 37 def result(visible, context) @visible = visible run_commands(context) if visible end |
#to_command ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nuklear/ui/menu.rb', line 20 def to_command [:ui_menu, { id: object_id, title: title, image: image, symbol: symbol, align: align_as_flags(align), width: width, height: height } ] end |
#visible? ⇒ Boolean
33 34 35 |
# File 'lib/nuklear/ui/menu.rb', line 33 def visible? @visible end |