Class: Glimmer::SWT::TabFolderProxy
- Inherits:
-
WidgetProxy
- Object
- WidgetProxy
- Glimmer::SWT::TabFolderProxy
- Defined in:
- lib/glimmer/swt/tab_folder_proxy.rb
Constant Summary collapse
- STYLE =
<<~CSS .tabs .tab.selected { background: rgb(80, 116, 211); color: white; } .tabs .tab { background-color: inherit; float: left; border: none; outline: none; cursor: pointer; padding: 14px 16px; transition: 0.3s; font-size: 17px; } .tabs { overflow: hidden; border: 1px solid #ccc; background-color: #f1f1f1; } CSS
Constants inherited from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS
Instance Attribute Summary collapse
-
#tabs ⇒ Object
readonly
Returns the value of attribute tabs.
Attributes inherited from WidgetProxy
#args, #background, #children, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #parent, #path, #rendered
Instance Method Summary collapse
- #dom ⇒ Object
- #hide_all_tab_content ⇒ Object
-
#initialize(parent, args, block) ⇒ TabFolderProxy
constructor
A new instance of TabFolderProxy.
- #post_initialize_child(child) ⇒ Object
- #tabs_dom_element ⇒ Object
- #tabs_id ⇒ Object
- #tabs_path ⇒ Object
Methods inherited from WidgetProxy
#add_content_on_render, #add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #build_dom, #can_handle_observation_request?, #clear_css_classes, #content, #content_on_render_blocks, #css_classes, #default_observation_request_to_event_mapping, #dispose, #dom_element, #effective_observation_request_to_event_mapping, #element, #event_listener_proxies, for, #get_data, #handle_observation_request, #has_style?, #id, #id=, #layout, #listener_dom_element, #listener_path, max_id_number_for, max_id_numbers, #method_missing, #name, next_id_number_for, #observation_request_to_event_mapping, #observation_requests, #pack, #parent_dom_element, #parent_path, #post_add_content, #post_dispose_child, #property_type_converters, #remove_all_listeners, #remove_css_class, #remove_css_classes, #remove_event_listener_proxies, #render, reset_max_id_numbers!, #selector, #set_attribute, #set_data, #set_focus, #skip_content_on_render_blocks?, #style_element, #swt_widget, underscored_widget_name, widget_class, widget_exists?, #widget_property_listener_installers
Methods included from PropertyOwner
#attribute_getter, #attribute_setter, #get_attribute, #set_attribute
Constructor Details
#initialize(parent, args, block) ⇒ TabFolderProxy
Returns a new instance of TabFolderProxy.
51 52 53 54 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 51 def initialize(parent, args, block) super(parent, args, block) @tabs = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer::SWT::WidgetProxy
Instance Attribute Details
#tabs ⇒ Object (readonly)
Returns the value of attribute tabs.
49 50 51 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 49 def tabs @tabs end |
Instance Method Details
#dom ⇒ Object
84 85 86 87 88 89 90 91 92 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 84 def dom tab_folder_id = id tab_folder_id_style = css @dom ||= html { div(id: tab_folder_id, style: tab_folder_id_style, class: 'tab-folder') { div(id: tabs_id, class: 'tabs') } }.to_s end |
#hide_all_tab_content ⇒ Object
68 69 70 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 68 def hide_all_tab_content @children.each(&:hide) end |
#post_initialize_child(child) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 56 def post_initialize_child(child) unless @children.include?(child) @children << child tabs_dom_element.append(child.tab_dom) child.render end if @children.size == 1 child.show end end |
#tabs_dom_element ⇒ Object
80 81 82 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 80 def tabs_dom_element Document.find(tabs_path) end |
#tabs_id ⇒ Object
76 77 78 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 76 def tabs_id id + '-tabs' end |
#tabs_path ⇒ Object
72 73 74 |
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 72 def tabs_path path + " > ##{tabs_id}" end |