Class: TkComponent::RBrowserComponent

Inherits:
Base
  • Object
show all
Defined in:
lib/tk_component/components/r_browser_component.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#children, #node, #parent, #parent_node, #tk_item

Instance Method Summary collapse

Methods inherited from Base

#add_child, #build, #component_did_build, #emit, #generate, #name, #parse_component, #parse_nodes, #rebuild, #regenerate, #regenerate_after_node, #regenerate_from_index, #regenerate_from_node

Methods included from BasicComponent

#focus

Constructor Details

#initialize(options = {}) ⇒ RBrowserComponent

Returns a new instance of RBrowserComponent.



11
12
13
14
15
16
17
# File 'lib/tk_component/components/r_browser_component.rb', line 11

def initialize(options = {})
  super
  @data_source = options[:data_source]
  @selected_path = options[:selected_path] || []
  @paned = !!options[:paned]
  @max_columns = options[:max_columns]
end

Instance Attribute Details

#data_sourceObject

Returns the value of attribute data_source.



6
7
8
# File 'lib/tk_component/components/r_browser_component.rb', line 6

def data_source
  @data_source
end

#max_columnsObject

Returns the value of attribute max_columns.



9
10
11
# File 'lib/tk_component/components/r_browser_component.rb', line 9

def max_columns
  @max_columns
end

#panedObject

Returns the value of attribute paned.



8
9
10
# File 'lib/tk_component/components/r_browser_component.rb', line 8

def paned
  @paned
end

#selected_pathObject

Returns the value of attribute selected_path.



7
8
9
# File 'lib/tk_component/components/r_browser_component.rb', line 7

def selected_path
  @selected_path
end

Instance Method Details

#render(p, parent_component) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tk_component/components/r_browser_component.rb', line 19

def render(p, parent_component)
  p.insert_component(TkComponent::BrowserColumnComponent, self,
                     browser: self,
                     column_index: 0,
                     sticky: 'nsew', x_flex: 1, y_flex: 1) do |bc|
    bc.on_event 'ItemSelected', ->(e) do
      puts "ItemSelected"
      emit('PathChanged')
    end
  end
end