Class: Gtk::CList

Inherits:
TreeView
  • Object
show all
Defined in:
lib/gui/widgets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ttitle) ⇒ CList

Returns a new instance of CList.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gui/widgets.rb', line 9

def initialize(ttitle)
 @nb_event=0
  super(Gtk::ListStore.new(Gdk::Color, *ttitle.collect{|d| d.class}))
		set_enable_search(false)
  i=1
		renderer=Gtk::CellRendererText.new()
		#renderer.background = "pink"
  ttitle.each {|col|
		column=Gtk::TreeViewColumn.new(col, 
                          	renderer,{
                             	 :background_gdk => 0,
                             	 :text => i
							  })
		column.set_sort_column_id(i)
		append_column(column)
		i+=1
  }
end

Instance Attribute Details

#nb_eventObject

Returns the value of attribute nb_event.



4
5
6
# File 'lib/gui/widgets.rb', line 4

def nb_event
  @nb_event
end

Instance Method Details

#append(ttext) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/gui/widgets.rb', line 28

def append(ttext)
  row=model.append
		set_bg_color(ttext[1], row)
		i=1
		ttext.each {|val|
   row[i]=val
			i+=1
		}
		@nb_event+=1
end

#changed_all_column_name(table) ⇒ Object

change title of each column



70
71
72
73
74
75
76
# File 'lib/gui/widgets.rb', line 70

def changed_all_column_name(table)
	indx=0
	columns.each do |col|
		col.set_title(table[indx])
		indx+=1
	end
end

#changed_column_name(col, str) ⇒ Object

change title to str of column col



81
82
83
# File 'lib/gui/widgets.rb', line 81

def changed_column_name(col,str)
	get_column(col).set_title(str) unless col > (columns.size - 1)
end

#clearObject



58
59
60
61
# File 'lib/gui/widgets.rb', line 58

def clear()
		model.clear()
		@nb_event=0
end

#get_value(iter, column) ⇒ Object



63
64
65
# File 'lib/gui/widgets.rb', line 63

def get_value(iter, column)
	model.get_value(iter, column) unless iter == nil
end

#prepend(ttext) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/gui/widgets.rb', line 39

def prepend(ttext)
		row=model.prepend
		if ttext
 set_bg_color(ttext[1], row)
 i=1
 ttext.each {|val|
  row[i]=val
  i+=1
 }
 @nb_event+=1
		end
end

#remove(row) ⇒ Object



52
53
54
55
56
# File 'lib/gui/widgets.rb', line 52

def remove(row)
if model.remove(row)
	@nb_event-=1
end
end

#set_sort_column(col_src, col_dst) ⇒ Object



6
7
8
# File 'lib/gui/widgets.rb', line 6

def set_sort_column(col_src,col_dst)
	get_column(col_src-1).set_sort_column_id(col_dst)
end