Class: Interphase::SimpleListView
- Defined in:
- lib/interphase/widgets/simple_list_view.rb
Overview
A simple list view which displays an Array
.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Attributes inherited from ListView
Attributes inherited from Widget
Instance Method Summary collapse
-
#initialize(items = [], **options, &block) ⇒ SimpleListView
constructor
A new instance of SimpleListView.
-
#refresh_items ⇒ Object
Copies #items into #rows, where each item is one row.
Methods inherited from ListView
Methods inherited from Widget
#destroy, #method_missing, #on, #respond_to_missing?, #show, #size
Constructor Details
#initialize(items = [], **options, &block) ⇒ SimpleListView
Returns a new instance of SimpleListView.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/interphase/widgets/simple_list_view.rb', line 11 def initialize(items = [], **, &block) super(['Column'], , &block) gtk_instance.headers_visible = false @items = Interphase::Helpers::Observable.new(items) do refresh_items end refresh_items end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Interphase::Widget
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
9 10 11 |
# File 'lib/interphase/widgets/simple_list_view.rb', line 9 def items @items end |
Instance Method Details
#refresh_items ⇒ Object
Copies #items into #rows, where each item is one row.
24 25 26 27 28 |
# File 'lib/interphase/widgets/simple_list_view.rb', line 24 def refresh_items items.each do |item| rows << [item] end end |