26#include <wx/dcmemory.h>
27#include <wx/odcombo.h>
28#include <wx/menuitem.h>
54 bmpDC.SelectObject( aLayerbmp );
56 brush.SetStyle( wxBRUSHSTYLE_SOLID );
58 if( aBackground != COLOR4D::UNSPECIFIED )
60 brush.SetColour( aBackground.
WithAlpha( 1.0 ).ToColour() );
61 bmpDC.SetBrush( brush );
62 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
65 brush.SetColour( aColor.ToColour() );
66 bmpDC.SetBrush( brush );
67 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
69 bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
70 bmpDC.SetPen( *wxBLACK_PEN );
71 bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
76 const wxSize& size,
int n,
const wxString choices[] ) :
77 wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
80 if( choices !=
nullptr )
89 const wxSize& size,
const wxArrayString& choices ) :
90 wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ),
93 if( !choices.IsEmpty() )
110 if( GetSelection() < 0 )
113 return (
int)(intptr_t) GetClientData( GetSelection() );
119 for(
int i = 0; i < (int) GetCount(); i++ )
121 if( GetClientData( (
unsigned) i ) == (
void*)(intptr_t) layer )
123 if( GetSelection() != i )
143 for(
int i = 0; i < (int) GetCount(); ++i )
145 wxBitmap layerbmp( 14, 14 );
154 if( aEvent.GetKeyCode() == WXK_ESCAPE && IsPopupShown() )
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.
~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.