diff --git a/common/widgets/layer_box_selector.cpp b/common/widgets/layer_box_selector.cpp index 6a94bd0c35..cec018b0df 100644 --- a/common/widgets/layer_box_selector.cpp +++ b/common/widgets/layer_box_selector.cpp @@ -26,10 +26,12 @@ #include #include #include +#include #include #include #include +#include "kiplatform/ui.h" LAYER_SELECTOR::LAYER_SELECTOR() @@ -164,3 +166,29 @@ void LAYER_BOX_SELECTOR::onKeyDown( wxKeyEvent& aEvent ) aEvent.Skip(); } + + +void LAYER_BOX_SELECTOR::OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags) const +{ +#ifndef __WXMSW__ + if( ( flags & wxODCB_PAINTING_CONTROL ) && !IsEnabled() ) + { + wxColour fgCol = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ); + wxColour bgCol = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ); + + if( KIPLATFORM::UI::IsDarkTheme() ) + bgCol = bgCol.ChangeLightness( 106 ); + else + bgCol = bgCol.ChangeLightness( 160 ); + + dc.SetTextForeground( fgCol ); + dc.SetBrush( bgCol ); + dc.SetPen( bgCol ); + dc.DrawRectangle( rect.Inflate( 1, 1 ) ); + dc.SetClippingRegion( rect ); + return; + } +#endif + + wxBitmapComboBox::OnDrawBackground( dc, rect, item, flags ); +} diff --git a/include/widgets/layer_box_selector.h b/include/widgets/layer_box_selector.h index 42397a367e..33e17f7453 100644 --- a/include/widgets/layer_box_selector.h +++ b/include/widgets/layer_box_selector.h @@ -91,6 +91,8 @@ public: private: void onKeyDown( wxKeyEvent& aEvent ); + + void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags) const override; }; #endif // LAYER_BOX_SELECTOR_H