Class: Wx::GRID::GridCellRenderer
- Inherits:
-
Object
- Object
- Wx::GRID::GridCellRenderer
- Defined in:
- lib/wx/doc/gen/grid/grid_cell_renderer.rb
Overview
This class is responsible for actually drawing the cell in the grid.
You may pass it to the GridCellAttr (below) to change the format of one given cell or to Wx::GRID::Grid#set_default_renderer to change the view of all cells. This is an abstract class, and you will normally use one of the predefined derived classes or derive your own class from it.
Category: Grid Related Classes
Direct Known Subclasses
Instance Method Summary collapse
-
#clone ⇒ Wx::GRID::GridCellRenderer
This function must be implemented in derived classes to return a copy of itself.
-
#draw(grid, attr, dc, rect, row, col, isSelected) ⇒ void
Draw the given cell on the provided DC inside the given rectangle using the style specified by the attribute and the default or selected state corresponding to the isSelected value.
-
#get_best_height(grid, attr, dc, row, col, width) ⇒ Integer
(also: #best_height)
Get the preferred height of the cell at the given width.
-
#get_best_size(grid, attr, dc, row, col) ⇒ Wx::Size
(also: #best_size)
Get the preferred size of the cell for its contents.
-
#get_best_width(grid, attr, dc, row, col, height) ⇒ Integer
(also: #best_width)
Get the preferred width of the cell at the given height.
-
#get_max_best_size(grid, attr, dc) ⇒ Wx::Size
(also: #max_best_size)
Get the maximum possible size for a cell using this renderer, if possible.
- #initialize ⇒ Wx::GRID::GridCellRenderer constructor
Constructor Details
#initialize ⇒ Wx::GRID::GridCellRenderer
29 |
# File 'lib/wx/doc/gen/grid/grid_cell_renderer.rb', line 29 def initialize; end |
Instance Method Details
#clone ⇒ Wx::GRID::GridCellRenderer
This function must be implemented in derived classes to return a copy of itself.
33 |
# File 'lib/wx/doc/gen/grid/grid_cell_renderer.rb', line 33 def clone; end |
#draw(grid, attr, dc, rect, row, col, isSelected) ⇒ void
This method returns an undefined value.
Draw the given cell on the provided DC inside the given rectangle using the style specified by the attribute and the default or selected state corresponding to the isSelected value.
This pure virtual function has a default implementation which will prepare the DC using the given attribute: it will draw the rectangle with the background colour from attr and set the text colour and font.
46 |
# File 'lib/wx/doc/gen/grid/grid_cell_renderer.rb', line 46 def draw(grid, attr, dc, rect, row, col, isSelected) end |
#get_best_height(grid, attr, dc, row, col, width) ⇒ Integer Also known as: best_height
Get the preferred height of the cell at the given width.
Some renderers may not have a well-defined best size, but only be able to provide the best height at the given width, e.g. this is the case of the standard Wx::GRID::GridCellAutoWrapStringRenderer. In this case, they should override this method, in addition to #get_best_size.
73 |
# File 'lib/wx/doc/gen/grid/grid_cell_renderer.rb', line 73 def get_best_height(grid, attr, dc, row, col, width) end |
#get_best_size(grid, attr, dc, row, col) ⇒ Wx::Size Also known as: best_size
Get the preferred size of the cell for its contents.
This method must be overridden in the derived classes to return the minimal fitting size for displaying the content of the given grid cell.
59 |
# File 'lib/wx/doc/gen/grid/grid_cell_renderer.rb', line 59 def get_best_size(grid, attr, dc, row, col) end |
#get_best_width(grid, attr, dc, row, col, height) ⇒ Integer Also known as: best_width
Get the preferred width of the cell at the given height.
See #get_best_height, this method is symmetric to it.
86 |
# File 'lib/wx/doc/gen/grid/grid_cell_renderer.rb', line 86 def get_best_width(grid, attr, dc, row, col, height) end |
#get_max_best_size(grid, attr, dc) ⇒ Wx::Size Also known as: max_best_size
Get the maximum possible size for a cell using this renderer, if possible.
This function may be overridden in the derived class if it can return the maximum size needed for displaying the cells rendered it without iterating over all cells. The base class version simply returns DEFAULT_SIZE, indicating that this is infeasible and that #get_best_size should be called for each cell individually. Note that this method will only be used if Wx::GRID::GridTableBase#can_measure_col_using_same_attr is overridden to return true.
97 |
# File 'lib/wx/doc/gen/grid/grid_cell_renderer.rb', line 97 def get_max_best_size(grid, attr, dc) end |