X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/52ca4ec419e41f800bc8e7a7c4f78f6079c603a6..702f5349c6468baae69ce6b7b2c780c3be57ee7c:/include/wx/msw/subwin.h diff --git a/include/wx/msw/subwin.h b/include/wx/msw/subwin.h index cbe712e73c..27f5f714cc 100644 --- a/include/wx/msw/subwin.h +++ b/include/wx/msw/subwin.h @@ -18,7 +18,7 @@ // wxSubwindows contains all HWNDs making part of a single wx control // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxSubwindows +class WXDLLIMPEXP_CORE wxSubwindows { public: // the number of subwindows can be specified either as parameter to ctor or @@ -40,7 +40,8 @@ public: { for ( size_t n = 0; n < m_count; n++ ) { - ::DestroyWindow(m_hwnds[n]); + if ( m_hwnds[n] ) + ::DestroyWindow(m_hwnds[n]); } free(m_hwnds); @@ -60,7 +61,7 @@ public: HWND operator[](size_t n) const { - return wx_const_cast(wxSubwindows *, this)->Get(n); + return const_cast(this)->Get(n); } // initialize the given window: id will be stored in wxWindowIDRef ensuring @@ -95,7 +96,8 @@ public: int sw = show ? SW_SHOW : SW_HIDE; for ( size_t n = 0; n < m_count; n++ ) { - ::ShowWindow(m_hwnds[n], sw); + if ( m_hwnds[n] ) + ::ShowWindow(m_hwnds[n], sw); } } @@ -104,7 +106,8 @@ public: { for ( size_t n = 0; n < m_count; n++ ) { - ::EnableWindow(m_hwnds[n], enable); + if ( m_hwnds[n] ) + ::EnableWindow(m_hwnds[n], enable); } } @@ -116,10 +119,13 @@ public: for ( size_t n = 0; n < m_count; n++ ) { - ::SendMessage(m_hwnds[n], WM_SETFONT, (WPARAM)hfont, 0); + if ( m_hwnds[n] ) + { + ::SendMessage(m_hwnds[n], WM_SETFONT, (WPARAM)hfont, 0); - // otherwise the window might not be redrawn correctly - ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + // otherwise the window might not be redrawn correctly + ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + } } } @@ -129,10 +135,14 @@ public: wxRect r; for ( size_t n = 0; n < m_count; n++ ) { - RECT rc; - ::GetWindowRect(m_hwnds[n], &rc); + if ( m_hwnds[n] ) + { + RECT rc; - r.Union(wxRectFromRECT(rc)); + ::GetWindowRect(m_hwnds[n], &rc); + + r.Union(wxRectFromRECT(rc)); + } } return r;