void NetListView::FrameResized(float width, float height) { BListView::FrameResized(width, height); //Ensure the bevel on the right is drawn properly if(width < oldWidth) oldWidth = width; PushState(); BRect invalRect(oldWidth, 0, oldWidth, height); ConvertFromParent(&invalRect); BRegion lineRegion(invalRect); ConstrainClippingRegion(&lineRegion); Draw(invalRect); oldWidth = width; PopState(); //Do word wrapping BFont curFont; GetFont(&curFont); float itemWidth = Bounds().Width(); float wrapWidth = (itemWidth - 6)/curFont.Size(); for(int itemNum = 0; itemNum < CountItems(); itemNum++) { NetListItem* item = (NetListItem*)(Items()[itemNum]); item->SetWidth(itemWidth); item->CalcWordWrap(wrapWidth); } //DoForEach(UpdateItem, (void*)this); Invalidate(); BListView::FrameResized(width, height); }
void BComboBox::TextInput::MakeFocus(bool state) { //+ PRINT(("_BTextInput_::MakeFocus(state=%d, view=%s)\n", state, //+ Parent()->Name())); if (state == IsFocus()) return; BComboBox* parent = dynamic_cast<BComboBox*>(Parent()); ASSERT(parent); BTextView::MakeFocus(state); if (state) { SetInitialText(); fClean = true; // text hasn't been dirtied yet. BMessage *m; if (Window() && (m = Window()->CurrentMessage()) != 0 && m->what == B_KEY_DOWN) { // we're being focused by a keyboard event, so // select all... SelectAll(); } } else { ASSERT(fInitialText); if (strcmp(fInitialText, Text()) != 0) parent->CommitValue(); free(fInitialText); fInitialText = NULL; fClean = false; BMessage *m; if (Window() && (m = Window()->CurrentMessage()) != 0 && m->what == B_MOUSE_DOWN) Select(0,0); // hide popup window if it's showing when the text input loses focus if (parent->fPopupWindow && parent->fPopupWindow->Lock()) { if (!parent->fPopupWindow->IsHidden()) parent->HidePopupWindow(); parent->fPopupWindow->Unlock(); } } // make sure the focus indicator gets drawn or undrawn if (Window()) { BRect invalRect(Bounds()); invalRect.InsetBy(-kTextInputMargin, -kTextInputMargin); parent->Draw(invalRect); parent->Flush(); } }
void BTextWidget::CheckAndUpdate(BPoint loc, const BColumn *column, BPoseView *view, bool visible) { BRect oldRect; if (view->ViewMode() != kListMode) oldRect = CalcOldRect(loc, column, view); if (fText->CheckAttributeChanged() && fText->CheckViewChanged(view) && visible) { BRect invalRect(ColumnRect(loc, column, view)); if (view->ViewMode() != kListMode) invalRect = invalRect | oldRect; view->Invalidate(invalRect); } }