Class: Wx::Grid

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/classes/grid.rb

Overview

A data-oriented editable table control.

Instance Method Summary collapse

Instance Method Details

#__delete_colsObject



134
# File 'lib/wx/classes/grid.rb', line 134

alias :__delete_cols :delete_cols

#__delete_rowsObject



125
# File 'lib/wx/classes/grid.rb', line 125

alias :__delete_rows :delete_rows

#__insert_colsObject



112
# File 'lib/wx/classes/grid.rb', line 112

alias :__insert_cols :insert_cols

#__insert_rowsObject

This and the following methods do a bit of book-keeping - as rows and columns are deleted and inserted, the position of the columns and rows with stored editors and renderers may move.



103
# File 'lib/wx/classes/grid.rb', line 103

alias :__insert_rows :insert_rows

#__register_data_typeObject

Store the renderers / editors associated with types, if used



39
# File 'lib/wx/classes/grid.rb', line 39

alias :__register_data_type :register_data_type

#__set_tableObject

Set a grid table base to provide data



32
# File 'lib/wx/classes/grid.rb', line 32

alias :__set_table :set_table

#delete_cols(pos = 0, num = 1, update_labels = true) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/wx/classes/grid.rb', line 135

def delete_cols(pos = 0, num = 1, update_labels = true)
  __delete_cols(pos, num, update_labels)
  __col_editors.slice!(pos, num)
  __col_renderers.slice!(pos, num)
  num.times do
    __cell_editors.map { | col | col.slice!(pos, num) if col }
  end
  num.times do
    __cell_renderers.map { | col | col.slice!(pos, num) if col }
  end
end

#delete_rows(pos = 0, num = 1, update_labels = true) ⇒ Object



126
127
128
129
130
131
132
# File 'lib/wx/classes/grid.rb', line 126

def delete_rows(pos = 0, num = 1, update_labels = true)
  __delete_rows(pos, num, update_labels)
  __row_editors.slice!(pos, num)
  __row_renderers.slice!(pos, num)
  __cell_editors.slice!(pos, num)
  __cell_renderers.slice!(pos, num)
end

#insert_cols(pos = 0, num = 1, update_labels = true) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/wx/classes/grid.rb', line 113

def insert_cols(pos = 0, num = 1, update_labels = true)
  __insert_cols(pos, num, update_labels)
  num.times { __col_editors.insert(pos, nil) }
  num.times { __col_renderers.insert(pos, nil) }
  num.times do
    __cell_editors.map { | col | col.insert(pos, []) if col }
  end
  num.times do
    __cell_renderers.map { | col | col.insert(pos, []) if col }
  end
end

#insert_rows(pos = 0, num = 1, update_labels = true) ⇒ Object



104
105
106
107
108
109
110
# File 'lib/wx/classes/grid.rb', line 104

def insert_rows(pos = 0, num = 1, update_labels = true)
  __insert_rows(pos, num, update_labels)
  num.times { __row_editors.insert(pos, nil) }
  num.times { __row_renderers.insert(pos, nil) }
  num.times { __cell_editors.insert(pos, []) }
  num.times { __cell_renderers.insert(pos, []) }
end

#register_data_type(type_name, renderer, editor) ⇒ Object



40
41
42
43
44
# File 'lib/wx/classes/grid.rb', line 40

def register_data_type(type_name, renderer, editor)
  __register_data_type(type_name, renderer, editor)
  @__named_type_info ||= {}
  @__named_type_info[type_name] = [ renderer, editor ]
end

#set_table(table, sel_mode = Wx::Grid::GridSelectCells) ⇒ Object



33
34
35
36
# File 'lib/wx/classes/grid.rb', line 33

def set_table(table, sel_mode = Wx::Grid::GridSelectCells)
  __set_table(table, sel_mode)
  @__grid_table = table
end