26#include <wx/textctrl.h>
55 const wxRect& aRect,
int aRow,
int aCol,
bool isSelected )
57 int value = aGrid.GetTable()->GetValueAsLong( aRow, aCol );
61 cs =
m_frame->GetColorSettings();
69 wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
75 int size =
KiROUND( 14 * aDC.GetContentScaleFactor() );
84 aDC.DrawBitmap(
m_bitmap, rect.GetLeft() + 4,
85 rect.GetTop() + ( rect.GetHeight() -
m_bitmap.GetHeight() ) / 2,
true );
92 layerName =
m_frame->GetBoard()->GetLayerName( layer );
96 rect.SetLeft( rect.GetLeft() +
m_bitmap.GetWidth() + 8 );
97 SetTextColoursAndFont( aGrid, aAttr, aDC, isSelected );
98 aGrid.DrawTextRectangle( aDC, layerName, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
109 bool aShowNonActivated ) :
125 wxEvtHandler* aEventHandler )
128 wxDefaultPosition, wxDefaultSize, 0,
nullptr,
129 wxCB_READONLY | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB | wxBORDER_NONE );
136 wxGridCellEditor::Create(aParent, aId, aEventHandler);
147 return m_frame->GetBoard()->GetLayerName( layer );
152 return wxEmptyString;
158 wxRect rect( aRect );
161#if !defined( __WXMSW__ ) && !defined( __WXGTK__ )
163 LayerBox()->SetButtonPosition( 0, 0, wxRIGHT, 0 );
166#if defined( __WXMAC__ )
170 LayerBox()->SetSize( rect, wxSIZE_ALLOW_MINUS_ONE );
176 auto* evtHandler =
static_cast<wxGridCellEditorEvtHandler*
>( m_control->GetEventHandler() );
179 evtHandler->SetInSetFocus(
true );
185 m_value = aGrid->GetTable()->GetValueAsLong( aRow, aCol );
197#ifdef __WXOSX_COCOA__
208#if !defined(__WXGTK__)
209 evtHandler->SetInSetFocus(
false );
233 aGrid->GetTable()->SetValueAsLong( aRow, aCol, (
long)
m_value );
246#if defined(__WXGTK__)
247 auto evtHandler =
static_cast<wxGridCellEditorEvtHandler*
>( m_control->GetEventHandler() );
251 evtHandler->SetInSetFocus(
false );
258 auto evtHandler =
static_cast<wxGridCellEditorEvtHandler*
>( m_control->GetEventHandler() );
263 wxFocusEvent event( wxEVT_KILL_FOCUS, m_control->GetId() );
264 event.SetEventObject( m_control );
265 evtHandler->ProcessEvent( event );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
void Draw(wxGrid &aGrid, wxGridCellAttr &aAttr, wxDC &aDC, const wxRect &aRect, int aRow, int aCol, bool isSelected) override
~GRID_CELL_LAYER_RENDERER() override
GRID_CELL_LAYER_RENDERER(PCB_BASE_FRAME *aFrame)
bool EndEdit(int, int, const wxGrid *, const wxString &, wxString *newval) override
wxGridCellEditor * Clone() const override
GRID_CELL_LAYER_SELECTOR(PCB_BASE_FRAME *aFrame, const LSET &forbiddenLayers, bool aShowNonActivated=false)
void onComboCloseUp(wxCommandEvent &aEvent)
void onComboDropDown(wxCommandEvent &aEvent)
PCB_LAYER_BOX_SELECTOR * LayerBox() const
void ApplyEdit(int aRow, int aCol, wxGrid *aGrid) override
void BeginEdit(int aRow, int aCol, wxGrid *aGrid) override
void Create(wxWindow *aParent, wxWindowID aId, wxEvtHandler *aEventHandler) override
wxString GetValue() const override
void SetSize(const wxRect &aRect) override
int GetLayerSelection() const
int SetLayerSelection(int layer)
static void DrawColorSwatch(wxBitmap &aLayerbmp, const COLOR4D &aBackground, const COLOR4D &aColor)
bool SetLayersHotkeys(bool value)
LSET is a set of PCB_LAYER_IDs.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Class to display a pcb layer list in a wxBitmapComboBox.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void ShowNonActivatedLayers(bool aShow)
void SetNotAllowedLayerSet(const LSET &aMask)
@ LAYER_PCB_BACKGROUND
PCB background color.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
COLOR_SETTINGS * GetColorSettings(const wxString &aName)
T * GetAppSettings(const char *aFilename)