X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9dabade20bff6c661b7eccbc0e2b809cb670dc75..f0e5a44df103e880f57416f483e8f3f4b4bc9651:/src/msw/statbox.cpp diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index d7881bc2ff..cd21abe857 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -154,36 +154,45 @@ wxSize wxStaticBox::DoGetBestSize() const WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { - switch ( nMsg ) - { #ifndef __WXWINCE__ - case WM_NCHITTEST: - { - // This code breaks some other processing such as enter/leave tracking - // so it's off by default. - - static int s_useHTClient = -1; - if (s_useHTClient == -1) - s_useHTClient = wxSystemOptions::GetOptionInt(wxT("msw.staticbox.htclient")); - if (s_useHTClient == 1) - { - int xPos = LOWORD(lParam); // horizontal position of cursor - int yPos = HIWORD(lParam); // vertical position of cursor - - ScreenToClient(&xPos, &yPos); - - // Make sure you can drag by the top of the groupbox, but let - // other (enclosed) controls get mouse events also - if ( yPos < 10 ) - return (long)HTCLIENT; - } - } - break; -#endif + if ( nMsg == WM_NCHITTEST ) + { + // This code breaks some other processing such as enter/leave tracking + // so it's off by default. + + static int s_useHTClient = -1; + if (s_useHTClient == -1) + s_useHTClient = wxSystemOptions::GetOptionInt(wxT("msw.staticbox.htclient")); + if (s_useHTClient == 1) + { + int xPos = LOWORD(lParam); // horizontal position of cursor + int yPos = HIWORD(lParam); // vertical position of cursor + + ScreenToClient(&xPos, &yPos); + + // Make sure you can drag by the top of the groupbox, but let + // other (enclosed) controls get mouse events also + if ( yPos < 10 ) + return (long)HTCLIENT; + } } +#endif // !__WXWINCE__ return wxControl::MSWWindowProc(nMsg, wParam, lParam); } +void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const +{ + wxStaticBoxBase::GetBordersForSizer(borderTop, borderOther); + + // if not using correct (but backwards cojmpatible) text metrics + // calculations, we need to add some extra margin or otherwise static box + // title is clipped +#if !wxDIALOG_UNIT_COMPATIBILITY + if ( !GetLabel().empty() ) + *borderTop += GetCharHeight()/3; +#endif // !wxDIALOG_UNIT_COMPATIBILITY +} + #endif // wxUSE_STATBOX