Module: QDA::GUI::ItemData

Included in:
HashLikeItemData, ListLikeItemData
Defined in:
lib/weft/wxgui/utilities.rb

Overview

ItemData - allows widgets to store information about assocations with underlying project objects such as categories and documents.

Instance Method Summary collapse

Instance Method Details

#get_item_data(id) ⇒ Object Also known as: get_client_data

for faked-up item data



25
26
27
# File 'lib/weft/wxgui/utilities.rb', line 25

def get_item_data(id)
  data[id]
end

#set_item_data(id, data_obj) ⇒ Object Also known as: set_client_data

for faked-up item data



31
32
33
# File 'lib/weft/wxgui/utilities.rb', line 31

def set_item_data(id, data_obj)
  data[id] = data_obj
end

#value_to_ident(value) ⇒ Object

returns the key associated with the value value



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/weft/wxgui/utilities.rb', line 37

def value_to_ident(value)
  return nil if value.nil?
  if value.nil?
    return nil
  elsif value.respond_to?(:dbid)
    the_id = value.dbid
  elsif value.kind_of?(Fixnum)
    the_id = value
  else
    Kernel.raise "Cannot search for invalid value #{value.inspect}"
  end
  return index(the_id)
end