wxGridCellRenderer(3)
π wxGridCellRenderer β bestie edition π
okay so this is the wxGridCellRenderer page from the Erlang module definitions, and it's literally the glow-up artist for your grid cells. no cap.
β¨ NAME β¨
wxGridCellRenderer β this class is the one actually responsible for drawing the cell in the grid. it's giving artiste. it's giving main character. π
π¦ DESCRIPTION π¦
so here's the vibe: you hand this thing over to wxGridCellAttr (the one listed below, iykyk) when you want to change the format of one specific cell, or you pass it to wxGrid:setDefaultRenderer/2 when you want to change the look of all the cells. either way, it's doing the most. π
IMPORTANT: this is an abstract class. lowkey you can't just use it raw like that. you will normally use one of the predefined derived classes (list below β¬οΈ) or derive your own class from it. periodt.
See also, bestie: π
wxGridCellBoolRendererwxGridCellFloatRendererwxGridCellNumberRendererwxGridCellStringRenderer
also, wxWidgets docs: wxGridCellRenderer β if you want the original source material, it's right there. π
πΈ DATA TYPES πΈ
wxGridCellRenderer() :: wx:wx_object().
that's it. that's the type. she's a wx:wx_object(). iconic. β¨
π FUNCTIONS π
π draw(This, Grid, Attr, Dc, Rect, Row, Col, IsSelected) -> ok
sooo the full signature is:
draw(This, Grid, Attr, Dc, Rect, Row, Col, IsSelected) -> ok
when
This :: wxGridCellRenderer(),
Grid :: wxGrid:wxGrid(),
Attr :: wxGridCellAttr:wxGridCellAttr(),
Dc :: wxDC:wxDC(),
Rect ::
{X :: integer(),
Y :: integer(),
W :: integer(),
H :: integer()},
Row :: integer(),
Col :: integer(),
IsSelected :: boolean().
what does it do? it draws the given cell on the provided DC, inside the given rectangle, using the style specified by the attribute, plus the default-or-selected state that corresponds to the isSelected value. slay. π
now listen β this is a pure virtual function, but it does have a default implementation. and that default implementation is not lazy, bestie, it will prepare the DC using the given attribute: it draws the rectangle with the background colour from attr and sets the text colour and font. she did that. π«Ά
π getBestSize(This, Grid, Attr, Dc, Row, Col) -> {W :: integer(), H :: integer()}
full signature:
getBestSize(This, Grid, Attr, Dc, Row, Col) ->
{W :: integer(), H :: integer()}
when
This :: wxGridCellRenderer(),
Grid :: wxGrid:wxGrid(),
Attr :: wxGridCellAttr:wxGridCellAttr(),
Dc :: wxDC:wxDC(),
Row :: integer(),
Col :: integer().
get the preferred size of the cell for its contents. basically: how much room does this content need to breathe? π§
heads up, bestie: this method must be overridden in the derived classes to return the minimal fitting size for displaying the content of the given grid cell. no override, no size. don't skip it. π
and that's the whole page, bestie π
this was brought to you by Ericsson AB, from wx 2.6, and yes the page itself is wxGridCellRenderer(3). go forth and render some cells. you're gonna eat. π₯πβ
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms