Class: Glimmer::SWT::ShellProxy
Constant Summary
collapse
- STYLE =
"html {\n width: 100%;\n height: 100%;\n}\nbody {\n width: 100%;\n height: 100%;\n margin: 0;\n}\n.shell {\n height: 100%;\n margin: 0;\n}\n.shell iframe {\n width: 100%;\n height: 100%;\n}\n.shell .dialog-overlay {\n position: fixed;\n z-index: 10;\n padding-top: 100px;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: rgba(0,0,0,0.4);\n}\n"
- WIDTH_MIN =
130
- HEIGHT_MIN =
0
Constants inherited
from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS
Instance Attribute Summary collapse
Attributes inherited from WidgetProxy
#args, #background, #children, #disposed?, #enabled, #focus, #font, #foreground, #menu, #menu_requested, #parent, #path, #rendered
Instance Method Summary
collapse
#default_layout, #get_layout, #layout=, #layout, #pack
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, #dialog_ancestor, #dispose, #dom_element, #effective_observation_request_to_event_mapping, #event_handling_suspended?, #event_listener_proxies, for, #get_data, #handle_observation_request, #has_style?, #id, #id=, #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, #parent_dom_element, #parents, #post_add_content, #post_dispose_child, #post_initialize_child, #property_type_converters, #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_widget, underscored_widget_name, widget_class, widget_exists?, widget_handling_listener, #widget_property_listener_installers
#attribute_getter, #attribute_setter, #get_attribute, #set_attribute
Constructor Details
Returns a new instance of ShellProxy.
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 47
def initialize(args)
@args = args
@children = []
render
@layout = FillLayoutProxy.new(self, [])
@layout.margin_width = 0
@layout.margin_height = 0
self.minimum_size = Point.new(WIDTH_MIN, HEIGHT_MIN)
DisplayProxy.instance.shells << self
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Glimmer::SWT::WidgetProxy
Instance Attribute Details
Returns the value of attribute menu_bar.
42
43
44
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 42
def
end
|
#minimum_size ⇒ Object
TODO consider renaming to ShellProxy to match SWT API
41
42
43
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 41
def minimum_size
@minimum_size
end
|
Instance Method Details
#close ⇒ Object
136
137
138
139
140
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 136
def close
DisplayProxy.instance.shells.delete(self)
dom_element.remove
@open = false
end
|
#dom ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 93
def dom
i = 0
body_id = id
body_class = ([name, 'hide'] + css_classes.to_a).join(' ')
@dom ||= html {
div(id: body_id, class: body_class) {
style(class: 'common-style') {
style_dom_css
}
[LayoutProxy, WidgetProxy].map(&:descendants).reduce(:+).each do |style_class|
if style_class.constants.include?('STYLE')
style(class: "#{style_class.name.split(':').last.underscore.gsub('_', '-').sub(/-proxy$/, '')}-style") {
style_class::STYLE
}
end
end
div(class: 'dialog-overlay hide') {
}
}
}.to_s
end
|
#element ⇒ Object
58
59
60
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 58
def element
'div'
end
|
#hide ⇒ Object
131
132
133
134
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 131
def hide
dom_element.add_class('hide')
@open = false
end
|
#open(async: true) ⇒ Object
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 116
def open(async: true)
work = lambda do
unless @open
DisplayProxy.instance.shells.select(&:open?).reject {|s| s == self}.map(&:hide)
dom_element.remove_class('hide')
@open = true
end
end
if async
DisplayProxy.instance.async_exec(&work)
else
work.call
end
end
|
#open? ⇒ Boolean
142
143
144
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 142
def open?
@open
end
|
#parent_path ⇒ Object
62
63
64
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 62
def parent_path
'body'
end
|
#style_dom_css ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 81
def style_dom_css
" .hide {\n display: none !important;\n }\n .selected {\n background: rgb(80, 116, 211);\n color: white;\n }\n CSS\nend\n"
|
#text ⇒ Object
66
67
68
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 66
def text
$document.title
end
|
#text=(value) ⇒ Object
70
71
72
|
# File 'lib/glimmer/swt/shell_proxy.rb', line 70
def text=(value)
Document.title = value
end
|