Files
wxWidgets/include/wx/msw/nonownedwnd.h
Vadim Zeitlin 00bd8c5576 Fix high DPI support for MDI windows
High DPI support didn't work for wxMDIParentFrame (and everything
inside it) because it was only enabled when InheritAttributes() from
wxNonOwnedWindow was called and this was only done in wxTopLevelWindow
but not in this class.

Fix this by removing the need to call InheritAttributes() at all and
just initializing m_perMonitorDPIaware when the window is created
automatically, to ensure that it can't be forgotten.

Co-Authored-By: Maarten Bent <MaartenBent@users.noreply.github.com>

Closes #22116.
2022-02-11 18:45:48 +01:00

57 lines
1.9 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 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_