Make message box title bar dark when using dark mode

Unfortunately the message box contents itself remains light, but at
least make its title bar follow the theme.
This commit is contained in:
Vadim Zeitlin 2022-06-27 00:00:02 +01:00
parent a14bcdb5a4
commit 9ca577f6d0

View file

@ -26,6 +26,7 @@
#include "wx/ptr_scpd.h"
#include "wx/dynlib.h"
#include "wx/msw/private/button.h"
#include "wx/msw/private/darkmode.h"
#include "wx/msw/private/metrics.h"
#include "wx/msw/private/msgdlg.h"
#include "wx/modalhook.h"
@ -599,6 +600,24 @@ void wxMessageDialog::DoCentre(int dir)
// Helpers of the wxMSWMessageDialog namespace
// ----------------------------------------------------------------------------
namespace
{
HRESULT CALLBACK
wxTaskDialogCallback(HWND hwnd, UINT msg, WPARAM, LPARAM, LONG_PTR)
{
switch ( msg )
{
case TDN_DIALOG_CONSTRUCTED:
wxMSWDarkMode::EnableForTLW(hwnd);
break;
}
return S_OK;
}
} // anonymous namespace
wxMSWTaskDialogConfig::wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg)
: buttons(new TASKDIALOG_BUTTON[MAX_BUTTONS])
{
@ -747,6 +766,8 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
AddTaskDialogButton(tdc, IDHELP, 0 /* not used */, btnHelpLabel);
}
tdc.pfCallback = wxTaskDialogCallback;
}
void wxMSWTaskDialogConfig::AddTaskDialogButton(TASKDIALOGCONFIG &tdc,