Class: Nuklear::UI::Popup
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Window
#content_area, #flags, #height, #id, #left, #title, #top, #width
Instance Method Summary collapse
-
#initialize(title, type: :static, enabled: false, **options) ⇒ Popup
constructor
A new instance of Popup.
- #result(visibility, context) ⇒ Object
- #to_command ⇒ Object
- #visible? ⇒ Boolean
Methods inherited from Window
#background=, #background?, #border=, #border?, #check_flag, #closable=, #closable?, #close, #enabled=, #minimizable=, #minimizable?, #movable=, #movable?, #no_input=, #no_input?, #no_scrollbar=, #no_scrollbar?, #scalable=, #scalable?, #scale_left=, #scale_left?, #scroll_auto_hide=, #scroll_auto_hide?, #set_flag, #titlebar=, #titlebar?
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(title, type: :static, enabled: false, **options) ⇒ Popup
Returns a new instance of Popup.
8 9 10 11 12 13 |
# File 'lib/nuklear/ui/popup.rb', line 8 def initialize(title, type: :static, enabled: false, **) super title, enabled: enabled, ** self.type = type on(:visible) { self.enabled = true } on(:hidden) { self.enabled = false } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Nuklear::UI::Container
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/nuklear/ui/popup.rb', line 6 def type @type end |
Instance Method Details
#result(visibility, context) ⇒ Object
31 32 33 34 |
# File 'lib/nuklear/ui/popup.rb', line 31 def result(visibility, context) trigger(visibility) run_commands(context) if visible? end |
#to_command ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/nuklear/ui/popup.rb', line 15 def to_command [:ui_popup, type == :dynamic ? NK_POPUP_DYNAMIC : NK_POPUP_STATIC, title, flags, left, top, width, height ] end |
#visible? ⇒ Boolean
27 28 29 |
# File 'lib/nuklear/ui/popup.rb', line 27 def visible? @enabled end |