b4338a30e1
IsEnabled() wrongly returned true even when the TLW was actually disabled due to a native modal dialog using it as owner being currently shown. Fix this by trusting the actual HWND state, rather than our internal m_isEnabled, except before the window is created. Do it for TLWs only even if, in principle, we could check for WS_DISABLED for the other windows too. However this would make IsThisEnabled() inconsistent with the other platforms, where it returns true when the window parent is disabled, but the window itself isn't, which is currently also emulated by wxMSW, but wouldn't be the case if we trusted WS_DISABLED presence. And while there might be other problems due to lying about the actual window state in this function, it doesn't seem to create any problems in practice, so for now leave the old logic in place. As a side effect, this makes wxWindowDisabler work correctly when a message box is shown by another window when it's created, as it will now correctly avoid re-enabling the message box parent in its dtor. Closes https://github.com/wxWidgets/wxWidgets/pull/2117 See #11887.
58 lines
2.0 KiB
C++
58 lines
2.0 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: wx/msw/nonownedwnd.h
|
|
// Purpose: wxNonOwnedWindow declaration for wxMSW.
|
|
// Author: Vadim Zeitlin
|
|
// Created: 2011-10-09
|
|
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef _WX_MSW_NONOWNEDWND_H_
|
|
#define _WX_MSW_NONOWNEDWND_H_
|
|
|
|
class wxNonOwnedWindowShapeImpl;
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// wxNonOwnedWindow
|
|
// ----------------------------------------------------------------------------
|
|
|
|
class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase
|
|
{
|
|
public:
|
|
wxNonOwnedWindow();
|
|
virtual ~wxNonOwnedWindow();
|
|
|
|
virtual bool Reparent(wxWindowBase* newParent) wxOVERRIDE;
|
|
virtual void InheritAttributes() wxOVERRIDE;
|
|
virtual bool IsThisEnabled() const wxOVERRIDE;
|
|
|
|
protected:
|
|
virtual bool DoClearShape() wxOVERRIDE;
|
|
virtual bool DoSetRegionShape(const wxRegion& region) wxOVERRIDE;
|
|
#if wxUSE_GRAPHICS_CONTEXT
|
|
virtual bool DoSetPathShape(const wxGraphicsPath& path) wxOVERRIDE;
|
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
|
|
|
virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxOVERRIDE;
|
|
|
|
private:
|
|
bool HandleDPIChange(const wxSize& newDPI, const wxRect& newRect);
|
|
|
|
#if wxUSE_GRAPHICS_CONTEXT
|
|
wxNonOwnedWindowShapeImpl* m_shapeImpl;
|
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
|
|
|
// Keep track of the DPI used in this window. So when per-monitor dpi
|
|
// awareness is enabled, both old and new DPI are known for
|
|
// wxDPIChangedEvent and wxWindow::MSWUpdateOnDPIChange.
|
|
wxSize m_activeDPI;
|
|
|
|
// This window supports handling per-monitor DPI awareness when the
|
|
// application manifest contains <dpiAwareness>PerMonitorV2</dpiAwareness>.
|
|
bool m_perMonitorDPIaware;
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow);
|
|
};
|
|
|
|
#endif // _WX_MSW_NONOWNEDWND_H_
|