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 ( PCB_BASE_FRAME aFrame)

Definition at line 36 of file grid_layer_box_helpers.cpp.

36  :
37  m_frame( aFrame )
38 {
39 }
GRID_CELL_LAYER_RENDERER::~GRID_CELL_LAYER_RENDERER ( )
override

Definition at line 42 of file grid_layer_box_helpers.cpp.

43 {
44 }

Member Function Documentation

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 47 of file grid_layer_box_helpers.cpp.

References PCB_GENERAL_SETTINGS::Colors(), LAYER_SELECTOR::DrawColorSwatch(), PCB_BASE_FRAME::GetBoard(), COLORS_DESIGN_SETTINGS::GetLayerColor(), BOARD::GetLayerName(), LAYER_PCB_BACKGROUND, m_frame, PCB_BASE_FRAME::Settings(), and ToLAYER_ID().

49 {
50  LAYER_NUM value = aGrid.GetTable()->GetValueAsLong( aRow, aCol );
51 
52  wxRect rect = aRect;
53  rect.Inflate( -1 );
54 
55  // erase background
56  wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
57 
58  // draw the swatch
59  wxBitmap bitmap( 14, 14 );
63  cds.GetLayerColor( ToLAYER_ID( value ) ) );
64  aDC.DrawBitmap( bitmap, rect.GetLeft() + 4, rect.GetTop() + 3, true );
65 
66  // draw the text
67  wxString text = m_frame->GetBoard()->GetLayerName( ToLAYER_ID( value ) );
68  rect.SetLeft( rect.GetLeft() + bitmap.GetWidth() + 8 );
69  SetTextColoursAndFont( aGrid, aAttr, aDC, isSelected );
70  aGrid.DrawTextRectangle( aDC, text, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
71 }
BOARD * GetBoard() const
PCB_GENERAL_SETTINGS & Settings()
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
COLORS_DESIGN_SETTINGS & Colors()
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
static void DrawColorSwatch(wxBitmap &aLayerbmp, COLOR4D aBackground, COLOR4D aColor)
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Pcbnew.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:810

Member Data Documentation

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: