From cf83b0cfb6cc02c63123d09b84edc8b64a372225 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 3 Jun 2013 12:58:29 +0000 Subject: [PATCH] refactoring SizeEvent sending git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/window.h | 2 ++ src/osx/window_osx.cpp | 22 +++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h index 3cfa8817f2..57afc42463 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -55,6 +55,8 @@ public: long style = 0, const wxString& name = wxPanelNameStr ); + virtual void SendSizeEvent(int flags = 0); + // implement base class pure virtuals virtual void SetLabel( const wxString& label ); virtual wxString GetLabel() const; diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index e1ce896e63..4a137ff4b2 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -1060,11 +1060,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) if ( doResize ) { MacRepositionScrollBars() ; - MacOnInternalSize(); - wxSize size(actualWidth, actualHeight); - wxSizeEvent event(size, m_windowId); - event.SetEventObject(this); - HandleWindowEvent(event); + SendSizeEvent(); } } } @@ -1118,6 +1114,12 @@ wxSize wxWindowMac::DoGetBestSize() const } } +void wxWindowMac::SendSizeEvent(int flags) +{ + MacOnInternalSize(); + wxWindowBase::SendSizeEvent(flags); +} + // set the size of the window: if the dimensions are positive, just use them, // but if any of them is equal to -1, it means that we must find the value for // it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in @@ -1144,10 +1146,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (sizeFlags & wxSIZE_FORCE_EVENT) { - MacOnInternalSize(); - wxSizeEvent event( wxSize(width,height), GetId() ); - event.SetEventObject( this ); - HandleWindowEvent( event ); + SendSizeEvent(); } return; @@ -1678,10 +1677,7 @@ void wxWindowMac::DoUpdateScrollbarVisibility() MacRepositionScrollBars() ; if ( triggerSizeEvent ) { - MacOnInternalSize(); - wxSizeEvent event(GetSize(), m_windowId); - event.SetEventObject(this); - HandleWindowEvent(event); + SendSizeEvent(); } #endif } -- 2.45.2