Class: Wx::GRID::GridTableBase
- Defined in:
- lib/wx/doc/gen/grid/grid_table_base.rb
Overview
The almost abstract base class for grid tables.
A grid table is responsible for storing the grid data and, indirectly, grid cell attributes. The data can be stored in the way most convenient for the application but has to be provided in string form to Grid. It is also possible to provide cells values in other formats if appropriate, e.g. as numbers. This base class is not quite abstract as it implements a trivial strategy for storing the attributes by forwarding it to Wx::GridCellAttrProvider and also provides stubs for some other functions. However it does have a number of pure virtual methods which must be implemented in the derived classes.
Category: Grid Related Classes
Direct Known Subclasses
Instance Method Summary collapse
-
#append_cols(numCols = 1) ⇒ Boolean
Exactly the same as #append_rows but for columns.
-
#append_rows(numRows = 1) ⇒ Boolean
Append additional rows at the end of the table.
-
#can_get_value_as(row, col, typeName) ⇒ Boolean
(also: #can_get_value_as?)
Returns true if the value of the given cell can be accessed as if it were of the specified type.
-
#can_measure_col_using_same_attr(col) ⇒ Boolean
(also: #can_measure_col_using_same_attr?)
Override to return true if the same attribute can be used for measuring all cells in the given column.
-
#can_set_value_as(row, col, typeName) ⇒ Boolean
(also: #can_set_value_as?)
Returns true if the value of the given cell can be set as if it were of the specified type.
-
#clear ⇒ void
Clear the table contents.
-
#delete_cols(pos = 0, numCols = 1) ⇒ Boolean
Exactly the same as #delete_rows but for columns.
-
#delete_rows(pos = 0, numRows = 1) ⇒ Boolean
Delete rows from the table.
-
#get_attr(row, col, kind) ⇒ Wx::GRID::GridCellAttr
(also: #attr)
Return the attribute for the given cell.
-
#get_col_label_value(col) ⇒ String
(also: #col_label_value)
Return the label of the specified column.
-
#get_cols_count ⇒ Integer
(also: #cols_count)
Return the number of columns in the table.
-
#get_corner_label_value ⇒ String
(also: #corner_label_value)
Return the label of the grid’s corner.
-
#get_number_cols ⇒ Integer
(also: #number_cols)
Must be overridden to return the number of columns in the table.
-
#get_number_rows ⇒ Integer
(also: #number_rows)
Must be overridden to return the number of rows in the table.
-
#get_row_label_value(row) ⇒ String
(also: #row_label_value)
Return the label of the specified row.
-
#get_rows_count ⇒ Integer
(also: #rows_count)
Return the number of rows in the table.
-
#get_type_name(row, col) ⇒ String
(also: #type_name)
Returns the type of the value in the given cell.
-
#get_value(row, col) ⇒ String
(also: #value)
Must be overridden to implement accessing the table values as text.
-
#get_value_as_bool(row, col) ⇒ Boolean
(also: #value_as_bool)
Returns the value of the given cell as a boolean.
-
#get_value_as_double(row, col) ⇒ Float
(also: #value_as_double)
Returns the value of the given cell as a double.
-
#get_value_as_long(row, col) ⇒ Integer
(also: #value_as_long)
Returns the value of the given cell as a long.
-
#get_view ⇒ Wx::GRID::Grid
(also: #view)
Returns the last grid passed to #set_view.
-
#initialize ⇒ Wx::GRID::GridTableBase
constructor
Default constructor.
-
#insert_cols(pos = 0, numCols = 1) ⇒ Boolean
Exactly the same as #insert_rows but for columns.
-
#insert_rows(pos = 0, numRows = 1) ⇒ Boolean
Insert additional rows into the table.
-
#is_empty(coords) ⇒ Boolean
(also: #empty?)
Same as #is_empty_cell but taking Wx::GridCellCoords.
-
#is_empty_cell(row, col) ⇒ Boolean
(also: #empty_cell?)
May be overridden to implement testing for empty cells.
-
#set_attr(attr, row, col) ⇒ void
Set attribute of the specified cell.
-
#set_col_attr(attr, col) ⇒ void
Set attribute of the specified column.
-
#set_col_label_value(col, label) ⇒ void
Exactly the same as #set_row_label_value but for columns.
-
#set_corner_label_value(arg) ⇒ void
(also: #corner_label_value=)
Set the given label for the grid’s corner.
-
#set_row_attr(attr, row) ⇒ void
Set attribute of the specified row.
-
#set_row_label_value(row, label) ⇒ void
Set the given label for the specified row.
-
#set_value(row, col, value) ⇒ void
Must be overridden to implement setting the table values as text.
-
#set_value_as_bool(row, col, value) ⇒ void
Sets the value of the given cell as a boolean.
-
#set_value_as_double(row, col, value) ⇒ void
Sets the value of the given cell as a double.
-
#set_value_as_long(row, col, value) ⇒ void
Sets the value of the given cell as a long.
-
#set_view(grid) ⇒ void
(also: #view=)
Called by the grid when the table is associated with it.
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize ⇒ Wx::GRID::GridTableBase
Default constructor.
260 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 260 def initialize; end |
Instance Method Details
#append_cols(numCols = 1) ⇒ Boolean
Exactly the same as #append_rows but for columns.
172 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 172 def append_cols(numCols=1) end |
#append_rows(numRows = 1) ⇒ Boolean
Append additional rows at the end of the table.
This method is provided in addition to #insert_rows as some data models may only support appending rows to them but not inserting them at arbitrary locations. In such case you may implement this method only and leave #insert_rows unimplemented.
155 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 155 def append_rows(numRows=1) end |
#can_get_value_as(row, col, typeName) ⇒ Boolean Also known as: can_get_value_as?
Returns true if the value of the given cell can be accessed as if it were of the specified type.
By default the cells can only be accessed as strings. Note that a cell could be accessible in different ways, e.g. a numeric cell may return true for Wx::GRID::GRID_VALUE_NUMBER but also for Wx::GRID::GRID_VALUE_STRING indicating that the value can be coerced to a string form.
70 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 70 def can_get_value_as(row, col, typeName) end |
#can_measure_col_using_same_attr(col) ⇒ Boolean Also known as: can_measure_col_using_same_attr?
Override to return true if the same attribute can be used for measuring all cells in the given column.
This function is provided for optimization purposes: it returns false by default, but can be overridden to return true when all the cells in the same grid column use sensibly the same attribute, i.e. they use the same renderer (either explicitly, or implicitly, due to their type as returned by #get_type_name) and the font of the same size. Returning true from this function allows AutoSizeColumns() to skip looking up the attribute and the renderer for each individual cell, which results in very noticeable performance improvements for the grids with many rows.
309 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 309 def can_measure_col_using_same_attr(col) end |
#can_set_value_as(row, col, typeName) ⇒ Boolean Also known as: can_set_value_as?
Returns true if the value of the given cell can be set as if it were of the specified type.
81 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 81 def can_set_value_as(row, col, typeName) end |
#clear ⇒ void
This method returns an undefined value.
Clear the table contents.
This method is used by Wx::GRID::Grid#clear_grid.
142 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 142 def clear; end |
#delete_cols(pos = 0, numCols = 1) ⇒ Boolean
Exactly the same as #delete_rows but for columns.
178 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 178 def delete_cols(pos=0, numCols=1) end |
#delete_rows(pos = 0, numRows = 1) ⇒ Boolean
Delete rows from the table.
161 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 161 def delete_rows(pos=0, numRows=1) end |
#get_attr(row, col, kind) ⇒ Wx::GRID::GridCellAttr Also known as: attr
Return the attribute for the given cell.
By default this function is simply forwarded to Wx::GridCellAttrProvider#get_attr but it may be overridden to handle attributes directly in the table. Prefer to use get_attr_ptr to avoid the need to call DecRef() on the returned pointer manually.
227 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 227 def get_attr(row, col, kind) end |
#get_col_label_value(col) ⇒ String Also known as: col_label_value
Return the label of the specified column.
189 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 189 def get_col_label_value(col) end |
#get_cols_count ⇒ Integer Also known as: cols_count
Return the number of columns in the table.
This method is not virtual and is only provided as a convenience for the derived classes which can’t call #get_number_cols without a const_cast from their const methods.
287 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 287 def get_cols_count; end |
#get_corner_label_value ⇒ String Also known as: corner_label_value
Return the label of the grid’s corner.
194 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 194 def get_corner_label_value; end |
#get_number_cols ⇒ Integer Also known as: number_cols
Must be overridden to return the number of columns in the table.
For backwards compatibility reasons, this method is not const. Use #get_cols_count instead of it in const methods of derived table classes,
273 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 273 def get_number_cols; end |
#get_number_rows ⇒ Integer Also known as: number_rows
Must be overridden to return the number of rows in the table.
For backwards compatibility reasons, this method is not const. Use #get_rows_count instead of it in const methods of derived table classes.
266 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 266 def get_number_rows; end |
#get_row_label_value(row) ⇒ String Also known as: row_label_value
Return the label of the specified row.
183 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 183 def get_row_label_value(row) end |
#get_rows_count ⇒ Integer Also known as: rows_count
Return the number of rows in the table.
This method is not virtual and is only provided as a convenience for the derived classes which can’t call #get_number_rows without a const_cast from their const methods.
280 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 280 def get_rows_count; end |
#get_type_name(row, col) ⇒ String Also known as: type_name
Returns the type of the value in the given cell.
By default all cells are strings and this method returns Wx::GRID::GRID_VALUE_STRING.
60 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 60 def get_type_name(row, col) end |
#get_value(row, col) ⇒ String Also known as: value
Must be overridden to implement accessing the table values as text.
44 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 44 def get_value(row, col) end |
#get_value_as_bool(row, col) ⇒ Boolean Also known as: value_as_bool
Returns the value of the given cell as a boolean.
This should only be called if #can_get_value_as returns true when called with Wx::GRID::GRID_VALUE_BOOL argument. Default implementation always return false.
108 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 108 def get_value_as_bool(row, col) end |
#get_value_as_double(row, col) ⇒ Float Also known as: value_as_double
Returns the value of the given cell as a double.
This should only be called if #can_get_value_as returns true when called with Wx::GRID::GRID_VALUE_FLOAT argument. Default implementation always return 0.0.
99 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 99 def get_value_as_double(row, col) end |
#get_value_as_long(row, col) ⇒ Integer Also known as: value_as_long
Returns the value of the given cell as a long.
This should only be called if #can_get_value_as returns true when called with Wx::GRID::GRID_VALUE_NUMBER argument. Default implementation always return 0.
90 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 90 def get_value_as_long(row, col) end |
#get_view ⇒ Wx::GRID::Grid Also known as: view
Returns the last grid passed to #set_view.
300 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 300 def get_view; end |
#insert_cols(pos = 0, numCols = 1) ⇒ Boolean
Exactly the same as #insert_rows but for columns.
167 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 167 def insert_cols(pos=0, numCols=1) end |
#insert_rows(pos = 0, numRows = 1) ⇒ Boolean
Insert additional rows into the table.
148 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 148 def insert_rows(pos=0, numRows=1) end |
#is_empty(coords) ⇒ Boolean Also known as: empty?
Same as #is_empty_cell but taking Wx::GridCellCoords.
Notice that this method is not virtual, only #is_empty_cell should be overridden.
37 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 37 def is_empty(coords) end |
#is_empty_cell(row, col) ⇒ Boolean Also known as: empty_cell?
May be overridden to implement testing for empty cells.
This method is used by the grid to test if the given cell is not used and so whether a neighbouring cell may overflow into it. By default it only returns true if the value of the given cell, as returned by #get_value, is empty.
29 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 29 def is_empty_cell(row, col) end |
#set_attr(attr, row, col) ⇒ void
This method returns an undefined value.
Set attribute of the specified cell.
By default this function is simply forwarded to Wx::GridCellAttrProvider#set_attr. The table takes ownership of attr, i.e. will call DecRef() on it.
238 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 238 def set_attr(attr, row, col) end |
#set_col_attr(attr, col) ⇒ void
This method returns an undefined value.
Set attribute of the specified column.
By default this function is simply forwarded to Wx::GridCellAttrProvider#set_col_attr. The table takes ownership of attr, i.e. will call DecRef() on it.
256 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 256 def set_col_attr(attr, col) end |
#set_col_label_value(col, label) ⇒ void
This method returns an undefined value.
Exactly the same as #set_row_label_value but for columns.
209 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 209 def set_col_label_value(col, label) end |
#set_corner_label_value(arg) ⇒ void Also known as: corner_label_value=
This method returns an undefined value.
Set the given label for the grid’s corner.
The default version does nothing, i.e. the label is not stored. You must override this method in your derived class if you wish Wx::GRID::Grid#get_corner_label_value to work.
216 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 216 def set_corner_label_value(arg) end |
#set_row_attr(attr, row) ⇒ void
This method returns an undefined value.
Set attribute of the specified row.
By default this function is simply forwarded to Wx::GridCellAttrProvider#set_row_attr. The table takes ownership of attr, i.e. will call DecRef() on it.
247 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 247 def set_row_attr(attr, row) end |
#set_row_label_value(row, label) ⇒ void
This method returns an undefined value.
Set the given label for the specified row.
The default version does nothing, i.e. the label is not stored. You must override this method in your derived class if you wish Wx::GRID::Grid#set_row_label_value to work.
203 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 203 def set_row_label_value(row, label) end |
#set_value(row, col, value) ⇒ void
This method returns an undefined value.
Must be overridden to implement setting the table values as text.
52 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 52 def set_value(row, col, value) end |
#set_value_as_bool(row, col, value) ⇒ void
This method returns an undefined value.
Sets the value of the given cell as a boolean.
This should only be called if #can_set_value_as returns true when called with Wx::GRID::GRID_VALUE_BOOL argument. Default implementation doesn’t do anything.
136 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 136 def set_value_as_bool(row, col, value) end |
#set_value_as_double(row, col, value) ⇒ void
This method returns an undefined value.
Sets the value of the given cell as a double.
This should only be called if #can_set_value_as returns true when called with Wx::GRID::GRID_VALUE_FLOAT argument. Default implementation doesn’t do anything.
127 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 127 def set_value_as_double(row, col, value) end |
#set_value_as_long(row, col, value) ⇒ void
This method returns an undefined value.
Sets the value of the given cell as a long.
This should only be called if #can_set_value_as returns true when called with Wx::GRID::GRID_VALUE_NUMBER argument. Default implementation doesn’t do anything.
118 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 118 def set_value_as_long(row, col, value) end |
#set_view(grid) ⇒ void Also known as: view=
This method returns an undefined value.
Called by the grid when the table is associated with it.
The default implementation stores the pointer and returns it from its #get_view and so only makes sense if the table cannot be associated with more than one grid at a time.
295 |
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 295 def set_view(grid) end |