X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ccbb8de5cae88b3c4e11140905691ee9e4a4a82..974c115dff4da4a370a3569a3576cacb00eef7bb:/src/msw/statusbar.cpp diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index a6b42bac5a..e694abf247 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -89,7 +89,7 @@ WXDWORD wxStatusBar::MSWGetStyle(long style, WXDWORD *exstyle) const WXDWORD msStyle = wxStatusBarBase::MSWGetStyle(style, exstyle); // wxSTB_SIZEGRIP is part of our default style but it doesn't make sense to - // show size grip if this is the status bar of a non-resizeable TLW so turn + // show size grip if this is the status bar of a non-resizable TLW so turn // it off in such case wxWindow * const parent = GetParent(); wxCHECK_MSG( parent, msStyle, wxS("Status bar must have a parent") ); @@ -103,14 +103,14 @@ WXDWORD wxStatusBar::MSWGetStyle(long style, WXDWORD *exstyle) const // is not given if ( !(style & wxSTB_SIZEGRIP) ) { - *exstyle |= CCS_TOP; + msStyle |= CCS_TOP; } else { #ifndef __WXWINCE__ // may be some versions of comctl32.dll do need it - anyhow, it won't // do any harm - *exstyle |= SBARS_SIZEGRIP; + msStyle |= SBARS_SIZEGRIP; #endif } @@ -213,8 +213,11 @@ void wxStatusBar::MSWUpdateFieldsWidths() widthAvailable -= extraWidth*(count - 1); // extra space between fields widthAvailable -= MSWGetMetrics().textMargin; // and for the last field - if ( HasFlag(wxSTB_SIZEGRIP) ) - widthAvailable -= MSWGetMetrics().gripWidth; + // Deal with the grip: we shouldn't overflow onto the space occupied by it + // so the effectively available space is smaller. + const int gripWidth = HasFlag(wxSTB_SIZEGRIP) ? MSWGetMetrics().gripWidth + : 0; + widthAvailable -= gripWidth; // distribute the available space (client width) among the various fields: @@ -232,6 +235,11 @@ void wxStatusBar::MSWUpdateFieldsWidths() pWidths[i] = nCurPos; } + // The total width of the panes passed to Windows must be equal to the + // total width available, including the grip. Otherwise we get an extra + // separator line just before it. + pWidths[count - 1] += gripWidth; + if ( !StatusBar_SetParts(GetHwnd(), count, pWidths) ) { wxLogLastError("StatusBar_SetParts"); @@ -429,14 +437,6 @@ bool wxStatusBar::GetFieldRect(int i, wxRect& rect) const wxCopyRECTToRect(r, rect); - // Windows seems to under-report the size of the last field rectangle, - // presumably in order to prevent the buggy applications from overflowing - // onto the size grip but we want to return the real size to wx users - if ( HasFlag(wxSTB_SIZEGRIP) && i == (int)m_panes.GetCount() - 1 ) - { - rect.width += MSWGetMetrics().gripWidth - MSWGetBorderWidth(); - } - return true; } @@ -502,9 +502,6 @@ void wxStatusBar::DoMoveWindow(int x, int y, int width, int height) ); } - // adjust fields widths to the new size - MSWUpdateFieldsWidths(); - // we have to trigger wxSizeEvent if there are children window in status // bar because GetFieldRect returned incorrect (not updated) values up to // here, which almost certainly resulted in incorrectly redrawn statusbar @@ -595,15 +592,21 @@ wxStatusBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) } #endif - bool needsEllipsization = HasFlag(wxSTB_ELLIPSIZE_START) || - HasFlag(wxSTB_ELLIPSIZE_MIDDLE) || - HasFlag(wxSTB_ELLIPSIZE_END); - if ( nMsg == WM_SIZE && needsEllipsization ) + if ( nMsg == WM_SIZE ) { - for (int i=0; i