class Vizkit::VizkitItem
Constants
- ErrorBrush
- ModifiedBrush
- NormalBrush
Attributes
modified[R]
options[R]
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/vizkit/vizkit_items.rb, line 15 def initialize(*args) super setEditable false @options ||= Hash.new @childs = Array.new @expanded = false end
Public Instance Methods
appendRow(*args)
click to toggle source
Calls superclass method
# File lib/vizkit/vizkit_items.rb, line 126 def appendRow(*args) #store childs otherwise they might get garbage collected @childs << args.flatten super end
child?(text)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 119 def child?(text) each_child(0) do |item| return true if item.text == text end false end
clear()
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 37 def clear @childs.each do |items| items[0].clear items[1].clear removeRow(items[0].index.row) end @childs = [] end
collapse(propagated = false)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 46 def collapse(propagated = false) @expanded = false each_child do |item| item.collapse(true) end end
downsize_children(rows)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 23 def downsize_children(rows) @childs[rows..-1].each do |items| items[0].clear items[1].clear removeRow items[0].index.row end @childs = if rows < 1 then [] else @childs[0, rows] end end
each_child(columns = nil,&block)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 68 def each_child(columns = nil,&block) columns = Array(0..columnCount-1) unless columns columns = Array(columns) 0.upto(rowCount-1) do |r| columns.each do |c| ch = child(r,c) block.call ch if ch end end end
enabled(value=true)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 79 def enabled(value=true) setEnabled(value) each_child do |item| item.enabled(value) end end
expand(propagated = false)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 57 def expand(propagated = false) @expanded = true each_child do |item| item.expand(true) end end
expanded?()
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 53 def expanded? @expanded end
from_variant(data, expected_value)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 132 def from_variant(data, expected_value) case expected_value when Numeric if expected_value.integer? data.to_i else data.to_f end when String data.toString.to_s when Time Time.at(data.toDateTime.toTime_t) when Symbol data.toString.to_sym when true, false data.toBool else raise "cannot convert #{data.toString} to #{expected_value.class} - no conversion" end end
mime_data(items=[])
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 91 def mime_data(items=[]) items << self return parent.mime_data(items) if parent 0 end
modified!(value = true, items = [],update_parent = true)
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 97 def modified!(value = true, items = [],update_parent = true) return if value == @modified @modified = value items << self if value setForeground(ModifiedBrush) parent.modified!(value,items,update_parent) if parent && update_parent else setForeground(NormalBrush) each_child do |item| item.modified!(value,items,false) end end if column == 1 i = index.sibling(row,0) if i.isValid item = i.model.itemFromIndex i item.modified!(value,items,update_parent) end end end
modified?()
click to toggle source
# File lib/vizkit/vizkit_items.rb, line 64 def modified? !!@modified end