Class: Wx::GRID::GridTableBase

Inherits:
Object
  • Object
show all
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

See Also:

Requires:

  • USE_GRID

Direct Known Subclasses

GridStringTable

Instance Method Summary collapse

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::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.

Parameters:

  • numCols (Integer) (defaults to: 1)

Returns:

  • (Boolean)


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.

Parameters:

  • numRows (Integer) (defaults to: 1)

    The number of rows to add.

Returns:

  • (Boolean)


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.

Parameters:

  • row (Integer)
  • col (Integer)
  • typeName (String)

Returns:

  • (Boolean)


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.

Parameters:

  • col (Integer)

Returns:

  • (Boolean)


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.

Parameters:

  • row (Integer)
  • col (Integer)
  • typeName (String)

Returns:

  • (Boolean)

See Also:



81
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 81

def can_set_value_as(row, col, typeName) end

#clearvoid

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.

Parameters:

  • pos (Integer) (defaults to: 0)
  • numCols (Integer) (defaults to: 1)

Returns:

  • (Boolean)


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.

Parameters:

  • pos (Integer) (defaults to: 0)

    The first row to delete.

  • numRows (Integer) (defaults to: 1)

    The number of rows to delete.

Returns:

  • (Boolean)


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.

Parameters:

  • row (Integer)
  • col (Integer)
  • kind (Wx::GridCellAttr::AttrKind)

Returns:



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.

Parameters:

  • col (Integer)

Returns:

  • (String)


189
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 189

def get_col_label_value(col) end

#get_cols_countInteger 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.

Returns:

  • (Integer)


287
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 287

def get_cols_count; end

#get_corner_label_valueString Also known as: corner_label_value

Return the label of the grid’s corner.

Returns:

  • (String)


194
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 194

def get_corner_label_value; end

#get_number_colsInteger 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,

Returns:

  • (Integer)


273
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 273

def get_number_cols; end

#get_number_rowsInteger 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.

Returns:

  • (Integer)


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.

Parameters:

  • row (Integer)

Returns:

  • (String)


183
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 183

def get_row_label_value(row) end

#get_rows_countInteger 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.

Returns:

  • (Integer)


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.

Parameters:

  • row (Integer)
  • col (Integer)

Returns:

  • (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.

Parameters:

  • row (Integer)
  • col (Integer)

Returns:

  • (String)


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.

Parameters:

  • row (Integer)
  • col (Integer)

Returns:

  • (Boolean)


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.

Parameters:

  • row (Integer)
  • col (Integer)

Returns:

  • (Float)


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.

Parameters:

  • row (Integer)
  • col (Integer)

Returns:

  • (Integer)


90
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 90

def get_value_as_long(row, col) end

#get_viewWx::GRID::Grid Also known as: view

Returns the last grid passed to #set_view.

Returns:



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.

Parameters:

  • pos (Integer) (defaults to: 0)
  • numCols (Integer) (defaults to: 1)

Returns:

  • (Boolean)


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.

Parameters:

  • pos (Integer) (defaults to: 0)

    The position of the first new row.

  • numRows (Integer) (defaults to: 1)

    The number of rows to insert.

Returns:

  • (Boolean)


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.

Parameters:

  • coords (Array(Integer, Integer))

Returns:

  • (Boolean)


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.

Parameters:

  • row (Integer)
  • col (Integer)

Returns:

  • (Boolean)


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.

Parameters:



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.

Parameters:



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.

Parameters:

  • col (Integer)
  • label (String)


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.

Parameters:

  • arg (String)


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.

Parameters:



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.

Parameters:

  • row (Integer)
  • label (String)


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.

Parameters:

  • row (Integer)
  • col (Integer)
  • value (String)


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.

Parameters:

  • row (Integer)
  • col (Integer)
  • value (Boolean)


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.

Parameters:

  • row (Integer)
  • col (Integer)
  • value (Float)


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.

Parameters:

  • row (Integer)
  • col (Integer)
  • value (Integer)


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.

Parameters:



295
# File 'lib/wx/doc/gen/grid/grid_table_base.rb', line 295

def set_view(grid) end