26#include <wx/dcmemory.h>
27#include <wx/odcombo.h>
28#include <wx/menuitem.h>
55 bmpDC.SelectObject( aLayerbmp );
57 brush.SetStyle( wxBRUSHSTYLE_SOLID );
59 if( aBackground != COLOR4D::UNSPECIFIED )
62 bmpDC.SetBrush( brush );
63 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
66 brush.SetColour( aColor.
ToColour() );
67 bmpDC.SetBrush( brush );
68 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
70 bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
71 bmpDC.SetPen( *wxBLACK_PEN );
72 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
77 const wxSize& size,
int n,
const wxString choices[] ) :
78 wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
81 if( choices !=
nullptr )
90 const wxSize& size,
const wxArrayString& choices ) :
91 wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ),
94 if( !choices.IsEmpty() )
111 if( GetSelection() < 0 )
114 return (
int)(intptr_t) GetClientData( GetSelection() );
120 for(
int i = 0; i < (int) GetCount(); i++ )
122 if( GetClientData( (
unsigned) i ) == (
void*)(intptr_t) layer )
124 if( GetSelection() != i )
147 for(
int i = 0; i < (int) GetCount(); ++i )
149 wxBitmap layerbmp( size, size );
158 if( aEvent.GetKeyCode() == WXK_ESCAPE && IsPopupShown() )
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
double GetScaleFactor() const
Get the DPI scale from all known sources in order:
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
wxColour ToColour() const
~LAYER_BOX_SELECTOR() override
void onKeyDown(wxKeyEvent &aEvent)
LAYER_BOX_SELECTOR(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=nullptr)
int GetLayerSelection() const
int SetLayerSelection(int layer)
Base class to build a layer list.
virtual COLOR4D getLayerColor(int aLayer) const =0
static void DrawColorSwatch(wxBitmap &aLayerbmp, const COLOR4D &aBackground, const COLOR4D &aColor)
bool SetLayersHotkeys(bool value)
@ LAYER_PCB_BACKGROUND
PCB background color.