Class: Glimmer::SWT::TabFolderProxy

Inherits:
WidgetProxy show all
Defined in:
lib/glimmer/swt/tab_folder_proxy.rb

Direct Known Subclasses

CTabFolderProxy

Constant Summary collapse

STYLE =
<<~CSS
  .tabs .tab.selected {
    background: white;
    color: black;
  }
  .tabs .tab {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 17px;
    text-decoration: none;
  }
  .tabs .tab:hover {
    color: black
  }
  .tabs .tab > * {
    display: inline-block;
    vertical-align: middle;
  }
  .tabs {
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
  }
CSS

Constants inherited from WidgetProxy

WidgetProxy::DEFAULT_INITIALIZERS, WidgetProxy::JS_KEY_CODE_TO_SWT_KEY_CODE_MAP, WidgetProxy::JS_LOCATION_TO_SWT_KEY_LOCATION_MAP, WidgetProxy::SWT_CURSOR_TO_CSS_CURSOR_MAP

Instance Attribute Summary

Attributes inherited from WidgetProxy

#args, #background, #children, #cursor, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #menu_x, #menu_y, #parent, #path, #rendered

Instance Method Summary collapse

Methods inherited from WidgetProxy

#add_content_on_render, #add_css_class, #add_css_classes, #add_observer, #apply_property_type_converters, #attach, #build_dom, #can_handle_observation_request?, #clear_css_classes, #content, #content_on_render_blocks, #css_classes, #default_observation_request_to_event_mapping, #dialog_ancestor, #dispose, #dom_element, #effective_observation_request_to_event_mapping, #element, #event_handling_suspended?, #event_listener_proxies, for, #get_data, #handle_javascript_observation_request, #handle_observation_request, #has_style?, #id, #id=, #initialize, #listener_dom_element, #listener_path, #listeners, #listeners_for, max_id_number_for, max_id_numbers, #method_missing, #name, next_id_number_for, #observation_request_to_event_mapping, #observation_requests, #parent_dom_element, #parent_path, #parents, #post_add_content, #post_dispose_child, #print, #property_type_converters, #reattach, #remove_all_listeners, #remove_css_class, #remove_css_classes, #remove_event_listener_proxies, #render, reset_max_id_numbers!, #resume_event_handling, #selector, #set_attribute, #set_data, #set_focus, #shell, #skip_content_on_render_blocks?, #style_element, #suspend_event_handling, #swt_data, #swt_widget, underscored_widget_name, widget_class, widget_exists?, widget_handling_listener, #widget_property_listener_installers

Methods included from PropertyOwner

#attribute_getter, #attribute_setter, #get_attribute, #set_attribute

Constructor Details

This class inherits a constructor from Glimmer::SWT::WidgetProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::SWT::WidgetProxy

Instance Method Details

#domObject



86
87
88
89
90
91
92
93
94
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 86

def dom
  tab_folder_id = id
  tab_folder_id_style = css
  @dom ||= html {
    div(id: tab_folder_id, style: tab_folder_id_style, class: name) {
      div(id: tabs_id, class: 'tabs')
    }
  }.to_s
end

#hide_all_tab_contentObject



70
71
72
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 70

def hide_all_tab_content
  @children.each(&:hide)
end

#post_initialize_child(child) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 57

def post_initialize_child(child)
  unless @children.include?(child)
    @children << child
    child.closeable = true if @closeable_children
    tabs_dom_element.append(child.tab_dom)
    child.render
  end
  
  if @children.size == 1
    child.show
  end
end

#tabs_dom_elementObject



82
83
84
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 82

def tabs_dom_element
  Document.find(tabs_path)
end

#tabs_idObject



78
79
80
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 78

def tabs_id
  id + '-tabs'
end

#tabs_pathObject



74
75
76
# File 'lib/glimmer/swt/tab_folder_proxy.rb', line 74

def tabs_path
  path + " > ##{tabs_id}"
end