Class: Shirka::Qt::ListController
Instance Attribute Summary
Attributes inherited from Controller
#app, #components, #data, #parent, #view
Instance Method Summary
collapse
Methods inherited from Controller
#add_component, #initialize, #on_component_adding
Methods included from Eventalk
#add_watcher, #fire, #forward, #watch, #watchers
Instance Method Details
#add_item(text = '', controller_class = nil) ⇒ Object
10
11
12
13
14
|
# File 'lib/shirka/qt/list/controller.rb', line 10
def add_item(text='', controller_class=nil)
controller_class ||= item_controller_class
comp = controller_class.new app, self, text
add_component comp
end
|
#init(data) ⇒ Object
5
6
7
8
|
# File 'lib/shirka/qt/list/controller.rb', line 5
def init(data)
@item_ids = {}
data.each { |i| add_item i }
end
|
#item_controller_class ⇒ Object
21
22
23
24
|
# File 'lib/shirka/qt/list/controller.rb', line 21
def item_controller_class
name = self.class.to_s.sub(/Controller$/, 'ItemController')
Object.const_get name rescue ::Shirka::Qt::ListItemController
end
|
#on_component_added(component, data = nil) ⇒ Object
31
32
33
34
|
# File 'lib/shirka/qt/list/controller.rb', line 31
def on_component_added(component, data=nil)
id = data
@item_ids[id] = component
end
|
#on_double_clicked(id) ⇒ Object
26
27
28
29
|
# File 'lib/shirka/qt/list/controller.rb', line 26
def on_double_clicked(id)
controller = @item_ids[id]
controller.on_double_clicked
end
|
#view_class ⇒ Object
16
17
18
19
|
# File 'lib/shirka/qt/list/controller.rb', line 16
def view_class
name = self.class.to_s.sub(/Controller$/, 'View')
Object.const_get name rescue ::Shirka::Qt::ListView
end
|