KiCad PCB EDA Suite
GRID_CELL_LAYER_RENDERER Class Reference

#include <grid_layer_box_helpers.h>

Inheritance diagram for GRID_CELL_LAYER_RENDERER:

Public Member Functions

 GRID_CELL_LAYER_RENDERER (PCB_BASE_FRAME *aFrame)
 
 ~GRID_CELL_LAYER_RENDERER () override
 
void Draw (wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDC, const wxRect &aRect, int aRow, int aCol, bool isSelected) override
 

Private Attributes

PCB_BASE_FRAMEm_frame
 

Detailed Description

Definition at line 37 of file grid_layer_box_helpers.h.

Constructor & Destructor Documentation

◆ GRID_CELL_LAYER_RENDERER()

GRID_CELL_LAYER_RENDERER::GRID_CELL_LAYER_RENDERER ( PCB_BASE_FRAME aFrame)

Definition at line 37 of file grid_layer_box_helpers.cpp.

37  :
38  m_frame( aFrame )
39 {
40 }

◆ ~GRID_CELL_LAYER_RENDERER()

GRID_CELL_LAYER_RENDERER::~GRID_CELL_LAYER_RENDERER ( )
override

Definition at line 43 of file grid_layer_box_helpers.cpp.

44 {
45 }

Member Function Documentation

◆ Draw()

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

Definition at line 48 of file grid_layer_box_helpers.cpp.

50 {
51  LAYER_NUM value = aGrid.GetTable()->GetValueAsLong( aRow, aCol );
52 
53  wxRect rect = aRect;
54  rect.Inflate( -1 );
55 
56  // erase background
57  wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
58 
59  // draw the swatch
60  wxBitmap bitmap( 14, 14 );
64  cs->GetColor( ToLAYER_ID( value ) ) );
65  aDC.DrawBitmap( bitmap, rect.GetLeft() + 4, rect.GetTop() + 3, true );
66 
67  // draw the text
68  wxString text = m_frame->GetBoard()->GetLayerName( ToLAYER_ID( value ) );
69  rect.SetLeft( rect.GetLeft() + bitmap.GetWidth() + 8 );
70  SetTextColoursAndFont( aGrid, aAttr, aDC, isSelected );
71  aGrid.DrawTextRectangle( aDC, text, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
72 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
virtual COLOR_SETTINGS * GetColorSettings() override
Helper to retrieve the current color settings.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
static void DrawColorSwatch(wxBitmap &aLayerbmp, COLOR4D aBackground, COLOR4D aColor)
COLOR4D GetColor(int aLayer) const
Color settings are a bit different than most of the settings objects in that there can be more than o...
BOARD * GetBoard() const
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:849

References LAYER_SELECTOR::DrawColorSwatch(), PCB_BASE_FRAME::GetBoard(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), BOARD::GetLayerName(), LAYER_PCB_BACKGROUND, m_frame, and ToLAYER_ID().

Member Data Documentation

◆ m_frame

PCB_BASE_FRAME* GRID_CELL_LAYER_RENDERER::m_frame
private

Definition at line 47 of file grid_layer_box_helpers.h.

Referenced by Draw().


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