Class: Nuklear::UI::Row
- Includes:
- Container
- Defined in:
- lib/nuklear/ui/row.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#type ⇒ Object
Returns the value of attribute type.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(height:, width: nil, type: nil, **options) ⇒ Row
constructor
A new instance of Row.
- #result(_, context) ⇒ Object
- #to_command ⇒ Object
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(height:, width: nil, type: nil, **options) ⇒ Row
Returns a new instance of Row.
7 8 9 10 11 12 13 |
# File 'lib/nuklear/ui/row.rb', line 7 def initialize(height:, width: nil, type: nil, **) super(**) self.type = type self.height = height self.width = width raise ArgumentError, ":width is required if type is :static" if type == :static && width.nil? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Nuklear::UI::Container
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
5 6 7 |
# File 'lib/nuklear/ui/row.rb', line 5 def height @height end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/nuklear/ui/row.rb', line 5 def type @type end |
#width ⇒ Object
Returns the value of attribute width.
5 6 7 |
# File 'lib/nuklear/ui/row.rb', line 5 def width @width end |
Instance Method Details
#result(_, context) ⇒ Object
23 24 25 |
# File 'lib/nuklear/ui/row.rb', line 23 def result(_, context) run_commands(context) end |
#to_command ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/nuklear/ui/row.rb', line 15 def to_command case type when :dynamic then [:ui_layout_row_dynamic, height, commands.size] when :static then [:ui_layout_row_static, height, width, commands.size] else [:ui_layout_row_begin, type || :static, height, commands.size] end end |