void wxStatusBar95::SetFieldsWidth() { if ( !m_nFields ) return; int aBorders[3]; SendMessage(GetHwnd(), SB_GETBORDERS, 0, (LPARAM)aBorders); int extraWidth = aBorders[2]; // space between fields wxArrayInt widthsAbs = CalculateAbsWidths(GetClientSize().x - extraWidth*(m_nFields - 1)); int *pWidths = new int[m_nFields]; int nCurPos = 0; for ( int i = 0; i < m_nFields; i++ ) { nCurPos += widthsAbs[i] + extraWidth; pWidths[i] = nCurPos; } if ( !StatusBar_SetParts(GetHwnd(), m_nFields, pWidths) ) { wxLogLastError(wxT("StatusBar_SetParts")); } delete [] pWidths; }
void wxStatusBarGeneric::DoUpdateFieldWidths() { m_lastClientSize = GetClientSize(); // recompute the cache of the field widths if the status bar width has changed m_widthsAbs = CalculateAbsWidths(m_lastClientSize.x); }
void wxStatusBar::MSWUpdateFieldsWidths() { if ( m_panes.IsEmpty() ) return; const int count = m_panes.GetCount(); const int extraWidth = MSWGetBorderWidth() + MSWGetMetrics().textMargin; // compute the effectively available amount of space: int widthAvailable = GetClientSize().x; // start with the entire width widthAvailable -= extraWidth*(count - 1); // extra space between fields widthAvailable -= MSWGetMetrics().textMargin; // and for the last field // 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: wxArrayInt widthsAbs = CalculateAbsWidths(widthAvailable); // update the field widths in the native control: int *pWidths = new int[count]; int nCurPos = 0; int i; for ( i = 0; i < count; i++ ) { nCurPos += widthsAbs[i] + extraWidth; 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"); } // Now that all parts have been created, set their text. for ( i = 0; i < count; i++ ) { DoUpdateStatusText(i); } delete [] pWidths; }
void wxStatusBarGeneric::DoUpdateFieldWidths() { m_lastClientSize = GetClientSize(); int width = m_lastClientSize.x; if ( ShowsSizeGrip() ) width -= GetSizeGripRect().width; // recompute the cache of the field widths if the status bar width has changed m_widthsAbs = CalculateAbsWidths(width); }
void wxStatusBarGeneric::SetStatusWidths(int n, const int widths_field[]) { // only set status widths when n == number of statuswindows wxCHECK_RET( (size_t)n == m_panes.GetCount(), wxT("status bar field count mismatch") ); wxStatusBarBase::SetStatusWidths(n, widths_field); // update cache int width; GetClientSize(&width, &m_lastClientHeight); m_widthsAbs = CalculateAbsWidths(width); }
void wxStatusBarGeneric::OnSize(wxSizeEvent& WXUNUSED(event)) { // FIXME: workarounds for OS/2 bugs have nothing to do here (VZ) int width; #ifdef __WXPM__ GetSize(&width, &m_lastClientHeight); #else GetClientSize(&width, &m_lastClientHeight); #endif // recompute the cache of the field widths if the status bar width has changed m_widthsAbs = CalculateAbsWidths(width); }
wxRect wxStatusBarUniv::GetTotalFieldRect(wxCoord *borderBetweenFields) { wxRect rect = GetClientRect(); // no, don't do this - the borders are meant to be inside this rect // wxSize sizeBorders = if ( borderBetweenFields ) *borderBetweenFields = m_renderer->GetStatusBarBorderBetweenFields(); //rect.Deflate(sizeBorders.x, sizeBorders.y); // recalc the field widths if needed if ( m_widthsAbs.IsEmpty() ) { // the total width for the fields doesn't include the borders between // them m_widthsAbs = CalculateAbsWidths(rect.width - *borderBetweenFields*(m_panes.GetCount() - 1)); } return rect; }
void wxStatusBarBeOS::DrawStatusBar() { int i=0; int leftPos=0; wxArrayInt widthsAbs; wxString text; m_view->Clear(); BRect bounds(m_view->bounds()); BView * drawview = m_view->GetBack(); if(drawview->LockLooper()) { rgb_color clr; drawview->PushState(); clr = drawview->ViewColor(); clr.red-=50; clr.green-=50; clr.blue-=50; drawview->SetHighColor(clr); drawview->StrokeLine(BPoint(bounds.left, bounds.top), BPoint(bounds.right, bounds.top)); clr.red+=100; clr.green+=100; clr.blue+=100; drawview->SetHighColor(clr); drawview->StrokeLine(BPoint(bounds.left, bounds.top+1), BPoint(bounds.right, bounds.top+1)); drawview->PopState(); if(m_nFields>0) widthsAbs = CalculateAbsWidths(bounds.IntegerWidth() - 2*(m_nFields - 1)); drawview->SetDrawingMode(B_OP_OVER); for(i=0;i<m_nFields;i++) { text = GetStatusBufferText(i); drawview->DrawString(text, BPoint(leftPos, bounds.bottom-2)); leftPos+=widthsAbs[i]+2; } drawview->UnlockLooper(); } m_view->flush(); }
// Get the position and size of the field's internal bounding rectangle bool wxStatusBarGeneric::GetFieldRect(int n, wxRect& rect) const { wxCHECK_MSG( (n >= 0) && (n < m_nFields), false, _T("invalid status bar field index") ); // FIXME: workarounds for OS/2 bugs have nothing to do here (VZ) int width, height; #ifdef __WXPM__ GetSize(&width, &height); #else GetClientSize(&width, &height); #endif // we cache m_widthsAbs between calls and recompute it if client // width has changed (or when it is initially empty) if ( m_widthsAbs.IsEmpty() || (m_lastClientWidth != width) ) { wxConstCast(this, wxStatusBarGeneric)-> m_widthsAbs = CalculateAbsWidths(width); // remember last width for which we have recomputed the widths in pixels wxConstCast(this, wxStatusBarGeneric)-> m_lastClientWidth = width; } rect.x = 0; for ( int i = 0; i < n; i++ ) { rect.x += m_widthsAbs[i]; } rect.x += m_borderX; rect.y = m_borderY; rect.width = m_widthsAbs[n] - 2*m_borderX; rect.height = height - 2*m_borderY; return true; }