From 87171a103a862469b234a617be19cce1badff52e Mon Sep 17 00:00:00 2001 From: mimi89999 Date: Wed, 15 Apr 2020 14:33:01 +0200 Subject: [PATCH 1/2] Add disabled auibar item to auidemo --- samples/aui/auidemo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/aui/auidemo.cpp b/samples/aui/auidemo.cpp index 816a2c5d4e..d511973154 100644 --- a/samples/aui/auidemo.cpp +++ b/samples/aui/auidemo.cpp @@ -848,6 +848,7 @@ MyFrame::MyFrame(wxWindow* parent, tb4->AddTool(ID_SampleItem+23, "Item 2", tb4_bmp1); tb4->SetToolSticky(ID_SampleItem+23, true); tb4->AddTool(ID_SampleItem+24, "Item 3", tb4_bmp1); + tb4->EnableTool(ID_SampleItem+24, false); tb4->AddTool(ID_SampleItem+25, "Item 4", tb4_bmp1); tb4->AddSeparator(); tb4->AddTool(ID_SampleItem+26, "Item 5", tb4_bmp1); From bc886c1e09b708f6d2bfe0e1b5f5b94fe6eb8cb5 Mon Sep 17 00:00:00 2001 From: mimi89999 Date: Wed, 15 Apr 2020 16:18:44 +0200 Subject: [PATCH 2/2] Change AUI bar on msw to use wxSYS_COLOUR_GRAYTEXT for disabled buttons --- src/aui/barartmsw.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/aui/barartmsw.cpp b/src/aui/barartmsw.cpp index 878aafce5a..730c2020a4 100644 --- a/src/aui/barartmsw.cpp +++ b/src/aui/barartmsw.cpp @@ -105,12 +105,6 @@ void wxAuiMSWToolBarArt::DrawLabel( wxAuiGenericToolBarArt::DrawLabel(dc, wnd, item, rect); } -static const unsigned char -DISABLED_TEXT_GREY_HUE = wxColour::AlphaBlend(0, 255, 0.4); -const wxColour DISABLED_TEXT_COLOR(DISABLED_TEXT_GREY_HUE, - DISABLED_TEXT_GREY_HUE, - DISABLED_TEXT_GREY_HUE); - void wxAuiMSWToolBarArt::DrawButton( wxDC& dc, wxWindow* wnd, @@ -200,9 +194,10 @@ void wxAuiMSWToolBarArt::DrawButton( dc.DrawBitmap(bmp, bmpX, bmpY, true); // set the item's text color based on if it is disabled - dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) - dc.SetTextForeground(DISABLED_TEXT_COLOR); + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); + else + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) { @@ -322,9 +317,10 @@ void wxAuiMSWToolBarArt::DrawDropDownButton( dc.DrawBitmap(bmp, bmpX, bmpY, true); // set the item's text color based on if it is disabled - dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) - dc.SetTextForeground(DISABLED_TEXT_COLOR); + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT)); + else + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) {