## wxGridCellAttr

This class can be used to alter the cells' appearance in the grid by changing their colour/font/... from default. An object of this class may be returned by wxGridTable::GetAttr().

Derived from

No base class

Include files

<wx/grid.h>

Members

wxGridCellAttr::wxGridCellAttr
wxGridCellAttr::Clone
wxGridCellAttr::IncRef
wxGridCellAttr::DecRef
wxGridCellAttr::SetTextColour
wxGridCellAttr::SetBackgroundColour
wxGridCellAttr::SetFont
wxGridCellAttr::SetAlignment
wxGridCellAttr::SetReadOnly
wxGridCellAttr::SetRenderer
wxGridCellAttr::SetEditor
wxGridCellAttr::HasTextColour
wxGridCellAttr::HasBackgroundColour
wxGridCellAttr::HasFont
wxGridCellAttr::HasAlignment
wxGridCellAttr::HasRenderer
wxGridCellAttr::HasEditor
wxGridCellAttr::GetTextColour
wxGridCellAttr::GetBackgroundColour
wxGridCellAttr::GetFont
wxGridCellAttr::GetAlignment
wxGridCellAttr::GetRenderer
wxGridCellAttr::GetEditor
wxGridCellAttr::IsReadOnly
wxGridCellAttr::SetDefAttr

### wxGridCellAttr::wxGridCellAttr

wxGridCellAttr()

Default constructor.

wxGridCellAttr(const wxColour& colText, const wxColour& colBack, const wxFont& font, int hAlign, int vAlign)

Constructor specifying some of the often used attributes.

### wxGridCellAttr::Clone

wxGridCellAttr* Clone() const

Creates a new copy of this object.

### wxGridCellAttr::IncRef

void IncRef()

This class is ref counted: it is created with ref count of 1, so calling DecRef() once will delete it. Calling IncRef() allows to lock it until the matching DecRef() is called

### wxGridCellAttr::DecRef

void DecRef()

### wxGridCellAttr::SetTextColour

void SetTextColour(const wxColour& colText)

Sets the text colour.

### wxGridCellAttr::SetBackgroundColour

void SetBackgroundColour(const wxColour& colBack)

Sets the background colour.

### wxGridCellAttr::SetFont

void SetFont(const wxFont& font)

Sets the font.

### wxGridCellAttr::SetAlignment

void SetAlignment(int hAlign, int vAlign)

Sets the alignment. hAlign can be one of `wxALIGN_LEFT`, `wxALIGN_CENTRE` or `wxALIGN_RIGHT` and vAlign can be one of `wxALIGN_TOP`, `wxALIGN_CENTRE` or `wxALIGN_BOTTOM`.

### wxGridCellAttr::SetReadOnly

void SetReadOnly(bool isReadOnly = true)

### wxGridCellAttr::SetRenderer

void SetRenderer(wxGridCellRenderer* renderer)

takes ownership of the pointer

### wxGridCellAttr::SetEditor

void SetEditor(wxGridCellEditor* editor)

### wxGridCellAttr::HasTextColour

bool HasTextColour() const

accessors

### wxGridCellAttr::HasBackgroundColour

bool HasBackgroundColour() const

### wxGridCellAttr::HasFont

bool HasFont() const

### wxGridCellAttr::HasAlignment

bool HasAlignment() const

### wxGridCellAttr::HasRenderer

bool HasRenderer() const

### wxGridCellAttr::HasEditor

bool HasEditor() const

### wxGridCellAttr::GetTextColour

const wxColour& GetTextColour() const

### wxGridCellAttr::GetBackgroundColour

const wxColour& GetBackgroundColour() const

### wxGridCellAttr::GetFont

const wxFont& GetFont() const

### wxGridCellAttr::GetAlignment

void GetAlignment(int* hAlign, int* vAlign) const

wxPerl note: This method takes no parameters and returns a 2-element list `( hAlign, vAlign )`.

See SetAlignment for the returned values.

### wxGridCellAttr::GetRenderer

wxGridCellRenderer* GetRenderer(wxGrid* grid, int row, int col) const

### wxGridCellAttr::GetEditor

wxGridCellEditor* GetEditor(wxGrid* grid, int row, int col) const

### wxGridCellAttr::IsReadOnly

bool IsReadOnly() const

### wxGridCellAttr::SetDefAttr

void SetDefAttr(wxGridCellAttr* defAttr)