Class: ListView
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
-
#list_selection ⇒ Object
Returns the value of attribute list_selection.
-
#store ⇒ Object
Returns the value of attribute store.
Instance Method Summary collapse
- #add_to_list(entry, position = "append") ⇒ Object
- #emit_signal(*args) ⇒ Object
-
#initialize ⇒ ListView
constructor
A new instance of ListView.
Constructor Details
#initialize ⇒ ListView
Returns a new instance of ListView.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/gswax/shared.rb', line 171 def initialize @store = Gtk::ListStore.new(String, String) @list = Gtk::TreeView.new(@store) @list.enable_search=(true) @list.headers_visible=(false) renderer = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new("", renderer, :text => 0) @list.append_column(column) @list_selection = @list.selection @list_selection.mode=(Gtk::SELECTION_MULTIPLE) @list.signal_connect("row-activated"){|view, path, column| emit_signal("row-activated", view, path, column) } @list_selection.signal_connect("changed"){|view, path, column| emit_signal("changed", view, path, column) } end |
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
169 170 171 |
# File 'lib/gswax/shared.rb', line 169 def list @list end |
#list_selection ⇒ Object
Returns the value of attribute list_selection.
169 170 171 |
# File 'lib/gswax/shared.rb', line 169 def list_selection @list_selection end |
#store ⇒ Object
Returns the value of attribute store.
169 170 171 |
# File 'lib/gswax/shared.rb', line 169 def store @store end |
Instance Method Details
#add_to_list(entry, position = "append") ⇒ Object
189 190 191 192 193 194 195 196 197 |
# File 'lib/gswax/shared.rb', line 189 def add_to_list(entry, position = "append") if position == "append" iter = @store.append else iter = @store.prepend end @store.set_value(iter, 0, File.basename(entry)) @store.set_value(iter, 1, entry) end |
#emit_signal(*args) ⇒ Object
199 200 201 |
# File 'lib/gswax/shared.rb', line 199 def emit_signal(*args) changed; notify_observers(*args) end |