X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0c3e2a5baacbb9f9a43f0887521061c9aa0239d4..61b98a2dac629cb5dbe1a6834ace6a33ba4eb103:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 76aca9086c..77729d68c6 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/common/window.cpp +// Name: src/common/wincmn.cpp // Purpose: common (to all ports) wxWindow functions // Author: Julian Smart, Vadim Zeitlin // Modified by: @@ -554,7 +554,14 @@ void wxWindowBase::SendDestroyEvent() bool wxWindowBase::Destroy() { - SendDestroyEvent(); + // If our handle is invalid, it means that this window has never been + // created, either because creating it failed or, more typically, because + // this wxWindow object was default-constructed and its Create() method had + // never been called. As we didn't send wxWindowCreateEvent in this case + // (which is sent after successful creation), don't send the matching + // wxWindowDestroyEvent neither. + if ( GetHandle() ) + SendDestroyEvent(); delete this; @@ -853,6 +860,16 @@ wxSize wxWindowBase::GetWindowBorderSize() const return size*2; } +bool +wxWindowBase::InformFirstDirection(int direction, + int size, + int availableOtherDir) +{ + return GetSizer() && GetSizer()->InformFirstDirection(direction, + size, + availableOtherDir); +} + wxSize wxWindowBase::GetEffectiveMinSize() const { // merge the best size with the min size, giving priority to the min size @@ -1054,7 +1071,7 @@ void wxWindowBase::SendSizeEvent(int flags) wxSizeEvent event(GetSize(), GetId()); event.SetEventObject(this); if ( flags & wxSEND_EVENT_POST ) - wxPostEvent(this, event); + wxPostEvent(GetEventHandler(), event); else HandleWindowEvent(event); } @@ -2634,7 +2651,7 @@ bool wxWindowBase::SendIdleEvents(wxIdleEvent& event) void wxWindowBase::OnInternalIdle() { - if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen()) + if ( wxUpdateUIEvent::CanUpdate(this) ) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } @@ -2957,19 +2974,19 @@ wxAccessible* wxWindowBase::CreateAccessible() // list classes implementation // ---------------------------------------------------------------------------- -#if wxUSE_STL +#if wxUSE_STD_CONTAINERS #include "wx/listimpl.cpp" WX_DEFINE_LIST(wxWindowList) -#else // !wxUSE_STL +#else // !wxUSE_STD_CONTAINERS void wxWindowListNode::DeleteData() { delete (wxWindow *)GetData(); } -#endif // wxUSE_STL/!wxUSE_STL +#endif // wxUSE_STD_CONTAINERS/!wxUSE_STD_CONTAINERS // ---------------------------------------------------------------------------- // borders @@ -3273,8 +3290,8 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move) wxWindowList::compatibility_iterator i = siblings.Find(win); wxCHECK_RET( i, wxT("MoveBefore/AfterInTabOrder(): win is not a sibling") ); - // unfortunately, when wxUSE_STL == 1 DetachNode() is not implemented so we - // can't just move the node around + // unfortunately, when wxUSE_STD_CONTAINERS == 1 DetachNode() is not + // implemented so we can't just move the node around wxWindow *self = (wxWindow *)this; siblings.DeleteObject(self); if ( move == OrderAfter )