Propagate wxEVT_DPI_CHANGED to child windows in wxOSX too

This commit is contained in:
Stefan Csomor 2020-07-19 14:30:38 +02:00 committed by Vadim Zeitlin
parent 668f0e7c54
commit 1deb003a7c
2 changed files with 21 additions and 0 deletions

View File

@ -151,6 +151,7 @@ public:
// -------------- // --------------
void OnMouseEvent( wxMouseEvent &event ); void OnMouseEvent( wxMouseEvent &event );
void OnDPIChanged( wxDPIChangedEvent& event );
void MacOnScroll( wxScrollEvent&event ); void MacOnScroll( wxScrollEvent&event );

View File

@ -79,6 +79,7 @@
wxBEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase) wxBEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase)
EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent) EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent)
EVT_DPI_CHANGED(wxWindowMac::OnDPIChanged)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
#define wxMAC_DEBUG_REDRAW 0 #define wxMAC_DEBUG_REDRAW 0
@ -2345,6 +2346,25 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
} }
} }
// propagate the dpi changed event to the subwindows
void wxWindowMac::OnDPIChanged(wxDPIChangedEvent& event)
{
wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
// Only propagate to non-top-level windows
wxWindow *win = node->GetData();
if ( !win->IsTopLevel() )
{
wxDPIChangedEvent event2( event.GetOldDPI(), event.GetNewDPI() );
event2.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(event2);
}
node = node->GetNext();
}
}
void wxWindowMac::TriggerScrollEvent( wxEventType WXUNUSED(scrollEvent) ) void wxWindowMac::TriggerScrollEvent( wxEventType WXUNUSED(scrollEvent) )
{ {
} }