void TTeamMenuItem::DrawContentLabel() { BMenu* menu = Menu(); menu->MovePenBy(0, fLabelAscent); float cachedWidth = menu->StringWidth(Label()); if (Submenu() && fVertical) cachedWidth += 18; const char* label = Label(); char* truncLabel = NULL; float max = 0; if (fVertical && static_cast<TBarApp*>(be_app)->Settings()->superExpando) max = menu->MaxContentWidth() - kSwitchWidth; else max = menu->MaxContentWidth() - 4.0f; if (max > 0) { BPoint penloc = menu->PenLocation(); BRect frame = Frame(); float offset = penloc.x - frame.left; if (cachedWidth + offset > max) { truncLabel = (char*)malloc(strlen(label) + 4); if (!truncLabel) return; TruncateLabel(max-offset, truncLabel); label = truncLabel; } } if (!label) label = Label(); TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView(); bool canHandle = !barview->Dragging() || barview->AppCanHandleTypes(Signature()); if (_IsSelected() && IsEnabled() && canHandle) menu->SetLowColor(tint_color(menu->LowColor(), B_HIGHLIGHT_BACKGROUND_TINT)); else menu->SetLowColor(menu->LowColor()); menu->DrawString(label); free(truncLabel); }