26#include <wx/dcmemory.h>
27#include <wx/odcombo.h>
28#include <wx/menuitem.h>
29#include <wx/settings.h>
51 const wxSize& size,
int n,
const wxString choices[] ) :
52 wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
56 GetParent()->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( LAYER_BOX_SELECTOR::onKeyDown ),
65 GetParent()->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( LAYER_BOX_SELECTOR::onKeyDown ),
73 if( GetSelection() < 0 )
76 return (
int)(intptr_t) GetClientData( GetSelection() );
82 for(
int i = 0; i < (int) GetCount(); i++ )
84 if( GetClientData( (
unsigned) i ) == (
void*)(intptr_t) layer )
86 if( GetSelection() != i )
106void LAYER_BOX_SELECTOR::onKeyDown( wxKeyEvent& aEvent )
108 if( aEvent.GetKeyCode() == WXK_ESCAPE && IsPopupShown() )
118void LAYER_BOX_SELECTOR::OnDrawBackground( wxDC& dc,
const wxRect& rect,
int item,
int flags)
const
120 if( ( flags & wxODCB_PAINTING_CONTROL ) && !IsEnabled() )
122 wxColour fgCol = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT );
123 wxColour bgCol = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
126 bgCol = bgCol.ChangeLightness( 106 );
128 bgCol = bgCol.ChangeLightness( 160 );
130 dc.SetTextForeground( fgCol );
131 dc.SetBrush( bgCol );
133 dc.DrawRectangle( rect.Inflate( 1, 1 ) );
134 dc.SetClippingRegion( rect );
138 wxBitmapComboBox::OnDrawBackground( dc, rect, item, flags );
~LAYER_BOX_SELECTOR() override
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.
bool SetLayersHotkeys(bool value)