# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx::GRID # 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 {Wx::GRID::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 Wx::GRID::GridStringTable # # class GridTableBase < Object # 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 {Wx::GRID::GridTableBase#get_value}, is empty. # @param row [Integer] # @param col [Integer] # @return [Boolean] def is_empty_cell(row, col) end alias_method :empty_cell?, :is_empty_cell # Same as {Wx::GRID::GridTableBase#is_empty_cell} but taking {Wx::GridCellCoords}. # Notice that this method is not virtual, only {Wx::GRID::GridTableBase#is_empty_cell} should be overridden. # @param coords [Array(Integer, Integer)] # @return [Boolean] def is_empty(coords) end alias_method :empty?, :is_empty # Must be overridden to implement accessing the table values as text. # @param row [Integer] # @param col [Integer] # @return [String] def get_value(row, col) end alias_method :value, :get_value # Must be overridden to implement setting the table values as text. # @param row [Integer] # @param col [Integer] # @param value [String] # @return [void] def set_value(row, col, value) end # 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}. # @param row [Integer] # @param col [Integer] # @return [String] def get_type_name(row, col) end alias_method :type_name, :get_type_name # 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. # @param row [Integer] # @param col [Integer] # @param typeName [String] # @return [Boolean] def can_get_value_as(row, col, typeName) end alias_method :can_get_value_as?, :can_get_value_as # Returns true if the value of the given cell can be set as if it were of the specified type. # # @see Wx::GRID::GridTableBase#can_get_value_as # @param row [Integer] # @param col [Integer] # @param typeName [String] # @return [Boolean] def can_set_value_as(row, col, typeName) end alias_method :can_set_value_as?, :can_set_value_as # Returns the value of the given cell as a long. # This should only be called if {Wx::GRID::GridTableBase#can_get_value_as} returns true when called with {Wx::GRID::GRID_VALUE_NUMBER} argument. Default implementation always return 0. # @param row [Integer] # @param col [Integer] # @return [Integer] def get_value_as_long(row, col) end alias_method :value_as_long, :get_value_as_long # Returns the value of the given cell as a double. # This should only be called if {Wx::GRID::GridTableBase#can_get_value_as} returns true when called with {Wx::GRID::GRID_VALUE_FLOAT} argument. Default implementation always return 0.0. # @param row [Integer] # @param col [Integer] # @return [Float] def get_value_as_double(row, col) end alias_method :value_as_double, :get_value_as_double # Returns the value of the given cell as a boolean. # This should only be called if {Wx::GRID::GridTableBase#can_get_value_as} returns true when called with {Wx::GRID::GRID_VALUE_BOOL} argument. Default implementation always return false. # @param row [Integer] # @param col [Integer] # @return [Boolean] def get_value_as_bool(row, col) end alias_method :value_as_bool, :get_value_as_bool # Sets the value of the given cell as a long. # This should only be called if {Wx::GRID::GridTableBase#can_set_value_as} returns true when called with {Wx::GRID::GRID_VALUE_NUMBER} argument. Default implementation doesn't do anything. # @param row [Integer] # @param col [Integer] # @param value [Integer] # @return [void] def set_value_as_long(row, col, value) end # Sets the value of the given cell as a double. # This should only be called if {Wx::GRID::GridTableBase#can_set_value_as} returns true when called with {Wx::GRID::GRID_VALUE_FLOAT} argument. Default implementation doesn't do anything. # @param row [Integer] # @param col [Integer] # @param value [Float] # @return [void] def set_value_as_double(row, col, value) end # Sets the value of the given cell as a boolean. # This should only be called if {Wx::GRID::GridTableBase#can_set_value_as} returns true when called with {Wx::GRID::GRID_VALUE_BOOL} argument. Default implementation doesn't do anything. # @param row [Integer] # @param col [Integer] # @param value [Boolean] # @return [void] def set_value_as_bool(row, col, value) end # Clear the table contents. # This method is used by {Wx::GRID::Grid#clear_grid}. # @return [void] def clear; end # Insert additional rows into the table. # @param pos [Integer] The position of the first new row. # @param numRows [Integer] The number of rows to insert. # @return [Boolean] def insert_rows(pos=0, numRows=1) end # Append additional rows at the end of the table. # This method is provided in addition to {Wx::GRID::GridTableBase#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 {Wx::GRID::GridTableBase#insert_rows} unimplemented. # @param numRows [Integer] The number of rows to add. # @return [Boolean] def append_rows(numRows=1) end # Delete rows from the table. # @param pos [Integer] The first row to delete. # @param numRows [Integer] The number of rows to delete. # @return [Boolean] def delete_rows(pos=0, numRows=1) end # Exactly the same as {Wx::GRID::GridTableBase#insert_rows} but for columns. # @param pos [Integer] # @param numCols [Integer] # @return [Boolean] def insert_cols(pos=0, numCols=1) end # Exactly the same as {Wx::GRID::GridTableBase#append_rows} but for columns. # @param numCols [Integer] # @return [Boolean] def append_cols(numCols=1) end # Exactly the same as {Wx::GRID::GridTableBase#delete_rows} but for columns. # @param pos [Integer] # @param numCols [Integer] # @return [Boolean] def delete_cols(pos=0, numCols=1) end # Return the label of the specified row. # @param row [Integer] # @return [String] def get_row_label_value(row) end alias_method :row_label_value, :get_row_label_value # Return the label of the specified column. # @param col [Integer] # @return [String] def get_col_label_value(col) end alias_method :col_label_value, :get_col_label_value # Return the label of the grid's corner. # @return [String] def get_corner_label_value; end alias_method :corner_label_value, :get_corner_label_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. # @param row [Integer] # @param label [String] # @return [void] def set_row_label_value(row, label) end # Exactly the same as {Wx::GRID::GridTableBase#set_row_label_value} but for columns. # @param col [Integer] # @param label [String] # @return [void] def set_col_label_value(col, label) end # 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. # @param arg [String] # @return [void] def set_corner_label_value(arg) end alias_method :corner_label_value=, :set_corner_label_value # 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 {Wx::GRID::GridTableBase#get_attr_ptr} to avoid the need to call DecRef() on the returned pointer manually. # @param row [Integer] # @param col [Integer] # @param kind [Wx::wxGridCellAttr::AttrKind] # @return [Wx::GRID::GridCellAttr] def get_attr(row, col, kind) end alias_method :attr, :get_attr # 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. # @param attr [Wx::GRID::GridCellAttr] # @param row [Integer] # @param col [Integer] # @return [void] def set_attr(attr, row, col) end # 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. # @param attr [Wx::GRID::GridCellAttr] # @param row [Integer] # @return [void] def set_row_attr(attr, row) end # 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. # @param attr [Wx::GRID::GridCellAttr] # @param col [Integer] # @return [void] def set_col_attr(attr, col) end # Default constructor. # @return [Wx::GRID::GridTableBase] def initialize; end # Must be overridden to return the number of rows in the table. # For backwards compatibility reasons, this method is not const. Use {Wx::GRID::GridTableBase#get_rows_count} instead of it in const methods of derived table classes. # @return [Integer] def get_number_rows; end alias_method :number_rows, :get_number_rows # Must be overridden to return the number of columns in the table. # For backwards compatibility reasons, this method is not const. Use {Wx::GRID::GridTableBase#get_cols_count} instead of it in const methods of derived table classes, # @return [Integer] def get_number_cols; end alias_method :number_cols, :get_number_cols # 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 {Wx::GRID::GridTableBase#get_number_rows} without a const_cast from their const methods. # @return [Integer] def get_rows_count; end alias_method :rows_count, :get_rows_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 {Wx::GRID::GridTableBase#get_number_cols} without a const_cast from their const methods. # @return [Integer] def get_cols_count; end alias_method :cols_count, :get_cols_count # Called by the grid when the table is associated with it. # The default implementation stores the pointer and returns it from its {Wx::GRID::GridTableBase#get_view} and so only makes sense if the table cannot be associated with more than one grid at a time. # @param grid [Wx::GRID::Grid] # @return [void] def set_view(grid) end alias_method :view=, :set_view # Returns the last grid passed to {Wx::GRID::GridTableBase#set_view}. # @return [Wx::GRID::Grid] def get_view; end alias_method :view, :get_view # 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 {Wx::GRID::GridTableBase#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. # @param col [Integer] # @return [Boolean] def can_measure_col_using_same_attr(col) end alias_method :can_measure_col_using_same_attr?, :can_measure_col_using_same_attr end # GridTableBase end