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

40 :
41 m_frame( aFrame )
42{
43}

◆ ~GRID_CELL_LAYER_RENDERER()

GRID_CELL_LAYER_RENDERER::~GRID_CELL_LAYER_RENDERER ( )
override

Definition at line 46 of file grid_layer_box_helpers.cpp.

47{
48}

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

53{
54 int value = aGrid.GetTable()->GetValueAsLong( aRow, aCol );
55 COLOR_SETTINGS* cs = nullptr;
56
57 wxRect rect = aRect;
58 rect.Inflate( -1 );
59
60 // erase background
61 wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
62
63 if( m_frame )
64 {
66 }
67 else
68 {
69 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
71 cs = mgr.GetColorSettings( settings->m_ColorTheme );
72 }
73
74 // draw the swatch
75 wxBitmap bitmap( 14, 14 );
77 cs->GetColor( ToLAYER_ID( LAYER_PCB_BACKGROUND ) ),
78 cs->GetColor( ToLAYER_ID( value ) ) );
79 aDC.DrawBitmap( bitmap, rect.GetLeft() + 4, rect.GetTop() + 3, true );
80
81 // draw the text
82 PCB_LAYER_ID layer = ToLAYER_ID( value );
83 wxString layerName;
84
85 if( m_frame )
86 layerName = m_frame->GetBoard()->GetLayerName( layer );
87 else
88 layerName = BOARD::GetStandardLayerName( layer );
89
90 rect.SetLeft( rect.GetLeft() + bitmap.GetWidth() + 8 );
91 SetTextColoursAndFont( aGrid, aAttr, aDC, isSelected );
92 aGrid.DrawTextRectangle( aDC, layerName, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
93}
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:187
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:696
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:413
Color settings are a bit different than most of the settings objects in that there can be more than o...
static void DrawColorSwatch(wxBitmap &aLayerbmp, const COLOR4D &aBackground, const COLOR4D &aColor)
BOARD * GetBoard() const
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:220
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:932
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References LAYER_SELECTOR::DrawColorSwatch(), SETTINGS_MANAGER::GetAppSettings(), PCB_BASE_FRAME::GetBoard(), COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), SETTINGS_MANAGER::GetColorSettings(), BOARD::GetLayerName(), BOARD::GetStandardLayerName(), LAYER_PCB_BACKGROUND, APP_SETTINGS_BASE::m_ColorTheme, m_frame, Pgm(), 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: