KiCad PCB EDA Suite
GRID_CELL_STATUS_ICON_RENDERER Class Reference

#include <grid_icon_text_helpers.h>

Inheritance diagram for GRID_CELL_STATUS_ICON_RENDERER:

Public Member Functions

 GRID_CELL_STATUS_ICON_RENDERER (int aStatus)
 
void Draw (wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDC, const wxRect &aRect, int aRow, int aCol, bool isSelected) override
 
wxSize GetBestSize (wxGrid &grid, wxGridCellAttr &attr, wxDC &dc, int row, int col) override
 
wxGridCellRenderer * Clone () const override
 

Private Attributes

int m_status
 
wxBitmap m_bitmap
 

Detailed Description

Definition at line 75 of file grid_icon_text_helpers.h.

Constructor & Destructor Documentation

◆ GRID_CELL_STATUS_ICON_RENDERER()

GRID_CELL_STATUS_ICON_RENDERER::GRID_CELL_STATUS_ICON_RENDERER ( int  aStatus)

Definition at line 131 of file grid_icon_text_helpers.cpp.

131 :
132 m_status( aStatus )
133{
134 if( m_status != 0 )
135 {
136 m_bitmap = wxArtProvider::GetBitmap( wxArtProvider::GetMessageBoxIconId( m_status ),
137 wxART_BUTTON );
138 }
139 else
140 {
141 // Dummy bitmap for size
142 m_bitmap = wxArtProvider::GetBitmap( wxArtProvider::GetMessageBoxIconId( wxICON_INFORMATION ),
143 wxART_BUTTON );
144 }
145}

References m_bitmap, and m_status.

Referenced by Clone().

Member Function Documentation

◆ Clone()

wxGridCellRenderer * GRID_CELL_STATUS_ICON_RENDERER::Clone ( ) const
override

Definition at line 176 of file grid_icon_text_helpers.cpp.

177{
179}

References GRID_CELL_STATUS_ICON_RENDERER(), and m_status.

◆ Draw()

void GRID_CELL_STATUS_ICON_RENDERER::Draw ( wxGrid &  aGrid,
wxGridCellAttr &  aAttr,
wxDC &  aDC,
const wxRect &  aRect,
int  aRow,
int  aCol,
bool  isSelected 
)
override

Definition at line 148 of file grid_icon_text_helpers.cpp.

151{
152 wxRect rect = aRect;
153 rect.Inflate( -1 );
154
155 // erase background
156 wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
157
158 // Draw icon
159 if( ( m_status != 0 ) && m_bitmap.IsOk() )
160 {
161 aDC.DrawBitmap( m_bitmap,
162 rect.GetLeft() + ( rect.GetWidth() - m_bitmap.GetWidth() ) / 2,
163 rect.GetTop() + ( rect.GetHeight() - m_bitmap.GetHeight() ) / 2,
164 true );
165 }
166}

References m_bitmap, and m_status.

◆ GetBestSize()

wxSize GRID_CELL_STATUS_ICON_RENDERER::GetBestSize ( wxGrid &  grid,
wxGridCellAttr &  attr,
wxDC &  dc,
int  row,
int  col 
)
override

Definition at line 169 of file grid_icon_text_helpers.cpp.

171{
172 return wxSize( m_bitmap.GetWidth() + 6, m_bitmap.GetHeight() + 4 );
173}

References m_bitmap.

Member Data Documentation

◆ m_bitmap

wxBitmap GRID_CELL_STATUS_ICON_RENDERER::m_bitmap
private

Definition at line 87 of file grid_icon_text_helpers.h.

Referenced by Draw(), GetBestSize(), and GRID_CELL_STATUS_ICON_RENDERER().

◆ m_status

int GRID_CELL_STATUS_ICON_RENDERER::m_status
private

Definition at line 86 of file grid_icon_text_helpers.h.

Referenced by Clone(), Draw(), and GRID_CELL_STATUS_ICON_RENDERER().


The documentation for this class was generated from the following files: