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 130 of file grid_icon_text_helpers.cpp.

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

References m_bitmap, and m_status.

Referenced by Clone().

Member Function Documentation

◆ Clone()

wxGridCellRenderer * GRID_CELL_STATUS_ICON_RENDERER::Clone ( ) const
override

◆ 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 147 of file grid_icon_text_helpers.cpp.

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

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 168 of file grid_icon_text_helpers.cpp.

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

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: