22#include <wx/dcmemory.h>
23#include <wx/odcombo.h>
24#include <wx/menuitem.h>
25#include <wx/settings.h>
47 const wxSize& size,
int n,
const wxString choices[] ) :
48 wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ),
52 GetParent()->Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( LAYER_BOX_SELECTOR::onKeyDown ),
61 GetParent()->Disconnect( wxEVT_CHAR_HOOK, wxKeyEventHandler( LAYER_BOX_SELECTOR::onKeyDown ),
69 if( GetSelection() < 0 )
72 return (
int)(intptr_t) GetClientData( GetSelection() );
78 for(
int i = 0; i < (int) GetCount(); i++ )
80 if( GetClientData( (
unsigned) i ) == (
void*)(intptr_t) layer )
82 if( GetSelection() != i )
102void LAYER_BOX_SELECTOR::onKeyDown( wxKeyEvent& aEvent )
104 if( aEvent.GetKeyCode() == WXK_ESCAPE && IsPopupShown() )
114void LAYER_BOX_SELECTOR::OnDrawBackground( wxDC& dc,
const wxRect& rect,
int item,
int flags)
const
116 if( ( flags & wxODCB_PAINTING_CONTROL ) && !IsEnabled() )
118 wxColour fgCol = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT );
119 wxColour bgCol = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
122 bgCol = bgCol.ChangeLightness( 106 );
124 bgCol = bgCol.ChangeLightness( 160 );
126 dc.SetTextForeground( fgCol );
127 dc.SetBrush( bgCol );
129 dc.DrawRectangle( rect.Inflate( 1, 1 ) );
130 dc.SetClippingRegion( rect );
134 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)
bool SetLayersHotkeys(bool value)