Module: Glimmer::LibUI::ControlProxy::Column
- Included in:
- BackgroundColorColumnProxy, ButtonColumnProxy, CheckboxColumnProxy, CheckboxTextColorColumnProxy, CheckboxTextColumnProxy, ImageColumnProxy, ImageTextColorColumnProxy, ImageTextColumnProxy, ProgressBarColumnProxy, TextColorColumnProxy, TextColumnProxy
- Defined in:
- lib/glimmer/libui/control_proxy/column.rb,
lib/glimmer/libui/control_proxy/column/text_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/image_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/button_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/checkbox_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/image_text_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/text_color_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/progress_bar_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/checkbox_text_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/background_color_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/image_text_color_column_proxy.rb,
lib/glimmer/libui/control_proxy/column/checkbox_text_color_column_proxy.rb
Overview
Common logic for all column proxy objects
Defined Under Namespace
Classes: BackgroundColorColumnProxy, ButtonColumnProxy, CheckboxColumnProxy, CheckboxTextColorColumnProxy, CheckboxTextColumnProxy, ImageColumnProxy, ImageTextColorColumnProxy, ImageTextColumnProxy, ProgressBarColumnProxy, TextColorColumnProxy, TextColumnProxy
Class Method Summary
collapse
-
.default_value ⇒ Object
subclasses may override to provide a valid default value like a blank image for image columns and false for checkbox.
Instance Method Summary
collapse
Class Method Details
.default_value ⇒ Object
subclasses may override to provide a valid default value like a blank image for image columns and false for checkbox
29
30
31
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 29
def default_value
nil
end
|
Instance Method Details
#can_handle_listener?(listener_name) ⇒ Boolean
98
99
100
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 98
def can_handle_listener?(listener_name)
listener_name == 'on_clicked'
end
|
#column_index ⇒ Object
column index used in table append column API call expanded to ensure DualColumn index accounts for two columns acting as one
49
50
51
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 49
def column_index
@column_index ||= @parent_proxy.send(:next_column_index)
end
|
#column_listeners ⇒ Object
112
113
114
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 112
def column_listeners
@column_listeners ||= {}
end
|
#column_listeners_for(listener_name) ⇒ Object
116
117
118
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 116
def column_listeners_for(listener_name)
column_listeners[listener_name] ||= []
end
|
120
121
122
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 120
def configure_sort_indicator
set_sort_indicator(@sort_indicator, reset_columns: false)
end
|
#data_bind_write(property, model_binding) ⇒ Object
89
90
91
92
93
94
95
96
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 89
def data_bind_write(property, model_binding)
case property
when 'sort_indicator'
Glimmer::DataBinding::Observer.proc do
model_binding.call(sort_indicator)
end.observe(self, :sort_indicator)
end
end
|
#handle_listener(listener_name, &listener) ⇒ Object
102
103
104
105
106
107
108
109
110
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 102
def handle_listener(listener_name, &listener)
column_listeners_for(listener_name) << listener
begin
super rescue => e
end
end
|
#index ⇒ Object
actual index within table columns (disregarding extra fillings that account for DualColumn instances)
54
55
56
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 54
def index
@parent_proxy.column_proxies.index(self)
end
|
#initialize(keyword, parent, args, &block) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 34
def initialize(keyword, parent, args, &block)
@keyword = keyword
@parent_proxy = parent
@args = args
@block = block
@enabled = true
post_add_content if @block.nil?
end
|
#name ⇒ Object
43
44
45
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 43
def name
@args.first
end
|
#other_columns ⇒ Object
58
59
60
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 58
def other_columns
@parent_proxy.column_proxies.reject {|c| c == self}
end
|
#sort_indicator ⇒ Object
62
63
64
65
66
67
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 62
def sort_indicator
return @sort_indicator if !@content_added
result = ::LibUI.(@parent_proxy.libui, index)
LibUI.integer_to_column_sort_indicator(result)
end
|
#sort_indicator=(*args) ⇒ Object
Also known as:
set_sort_indicator
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 69
def sort_indicator=(*args)
options = args.last.is_a?(Hash) ? args.pop : {reset_columns: true}
value = args.first
@sort_indicator = value
return @sort_indicator if !@content_added
other_columns.each { |c| c.set_sort_indicator(nil, reset_columns: false) } if options[:reset_columns]
value = LibUI.column_sort_indicator_to_integer(value)
::LibUI.(@parent_proxy.libui, index, value)
end
|
#toggle_sort_indicator(value = nil) ⇒ Object
81
82
83
84
85
86
87
|
# File 'lib/glimmer/libui/control_proxy/column.rb', line 81
def toggle_sort_indicator(value = nil)
if value.nil?
self.sort_indicator = self.sort_indicator != :ascending ? :ascending : :descending
else
self.sort_indicator = value
end
end
|