refactoring SizeEvent sending

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2013-06-03 12:58:29 +00:00
parent a002ae4e50
commit cf83b0cfb6
2 changed files with 11 additions and 13 deletions

View File

@@ -55,6 +55,8 @@ public:
long style = 0, long style = 0,
const wxString& name = wxPanelNameStr ); const wxString& name = wxPanelNameStr );
virtual void SendSizeEvent(int flags = 0);
// implement base class pure virtuals // implement base class pure virtuals
virtual void SetLabel( const wxString& label ); virtual void SetLabel( const wxString& label );
virtual wxString GetLabel() const; virtual wxString GetLabel() const;

View File

@@ -1060,11 +1060,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( doResize ) if ( doResize )
{ {
MacRepositionScrollBars() ; MacRepositionScrollBars() ;
MacOnInternalSize(); SendSizeEvent();
wxSize size(actualWidth, actualHeight);
wxSizeEvent event(size, m_windowId);
event.SetEventObject(this);
HandleWindowEvent(event);
} }
} }
} }
@@ -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, // 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 // 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 // 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) if (sizeFlags & wxSIZE_FORCE_EVENT)
{ {
MacOnInternalSize(); SendSizeEvent();
wxSizeEvent event( wxSize(width,height), GetId() );
event.SetEventObject( this );
HandleWindowEvent( event );
} }
return; return;
@@ -1678,10 +1677,7 @@ void wxWindowMac::DoUpdateScrollbarVisibility()
MacRepositionScrollBars() ; MacRepositionScrollBars() ;
if ( triggerSizeEvent ) if ( triggerSizeEvent )
{ {
MacOnInternalSize(); SendSizeEvent();
wxSizeEvent event(GetSize(), m_windowId);
event.SetEventObject(this);
HandleWindowEvent(event);
} }
#endif #endif
} }