26#include <wx/textctrl.h>
55 const wxRect& aRect,
int aRow,
int aCol,
bool isSelected )
57 int value = aGrid.GetTable()->GetValueAsLong( aRow, aCol );
64 wxGridCellRenderer::Draw( aGrid, aAttr, aDC, aRect, aRow, aCol, isSelected );
78 int size =
KiROUND( 14 * aDC.GetContentScaleFactor() );
79 wxBitmap bitmap( size, size );
85 aDC.DrawBitmap( bitmap, rect.GetLeft() + 4,
86 rect.GetTop() + ( rect.GetHeight() - bitmap.GetHeight() ) / 2,
true );
97 rect.SetLeft( rect.GetLeft() + bitmap.GetWidth() + 8 );
98 SetTextColoursAndFont( aGrid, aAttr, aDC, isSelected );
99 aGrid.DrawTextRectangle( aDC, layerName, rect, wxALIGN_LEFT, wxALIGN_CENTRE );
124 wxEvtHandler* aEventHandler )
127 wxDefaultPosition, wxDefaultSize, 0,
nullptr,
128 wxCB_READONLY | wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB | wxBORDER_NONE );
134 wxGridCellEditor::Create(aParent, aId, aEventHandler);
150 return wxEmptyString;
156 wxRect rect( aRect );
159#if !defined( __WXMSW__ ) && !defined( __WXGTK__ )
161 LayerBox()->SetButtonPosition( 0, 0, wxRIGHT, 0 );
164#if defined( __WXMAC__ )
168 LayerBox()->SetSize( rect, wxSIZE_ALLOW_MINUS_ONE );
174 auto* evtHandler =
static_cast<wxGridCellEditorEvtHandler*
>( m_control->GetEventHandler() );
177 evtHandler->SetInSetFocus(
true );
183 m_value = aGrid->GetTable()->GetValueAsLong( aRow, aCol );
194#ifdef __WXOSX_COCOA__
205#if !defined(__WXGTK__)
206 evtHandler->SetInSetFocus(
false );
230 aGrid->GetTable()->SetValueAsLong( aRow, aCol, (
long)
m_value );
243#if defined(__WXGTK__)
244 auto evtHandler =
static_cast<wxGridCellEditorEvtHandler*
>( m_control->GetEventHandler() );
248 evtHandler->SetInSetFocus(
false );
255 auto evtHandler =
static_cast<wxGridCellEditorEvtHandler*
>( m_control->GetEventHandler() );
260 wxFocusEvent event( wxEVT_KILL_FOCUS, m_control->GetId() );
261 event.SetEventObject( m_control );
262 evtHandler->ProcessEvent( event );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
wxString m_ColorTheme
Active color theme name.
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
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
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
GRID_CELL_LAYER_SELECTOR(PCB_BASE_FRAME *aFrame, LSET forbiddenLayers)
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.
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
Class to display a pcb layer list in a wxBitmapComboBox.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void SetNotAllowedLayerSet(LSET aMask)
void ShowNonActivatedLayers(bool aShow)
virtual SETTINGS_MANAGER & GetSettingsManager() const
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
@ LAYER_PCB_BACKGROUND
PCB background color.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
PGM_BASE & Pgm()
The global Program "get" accessor.