void set_tab_select(struct MyGadget *gd,int tb) { BTabView *bt; WrkWindow *wi; if (wi = (WrkWindow *)gd->pt->Window()) { BAutolock tst(wi); if (bt = (BTabView *)((GadView *)gd->pt)->ChildAt(0)) { bt->Select(tb); gd->pt->Invalidate(); } } }
void ControlWindow::MessageReceived(BMessage* message) { BParameterWeb* web = NULL; status_t err; switch (message->what) { case B_MEDIA_WEB_CHANGED: { // If this is a tab view, find out which tab // is selected BTabView* tabView = dynamic_cast<BTabView*>(fView); int32 tabNum = -1; if (tabView) tabNum = tabView->Selection(); RemoveChild(fView); delete fView; err = BMediaRoster::Roster()->GetParameterWebFor(fNode, &web); if (err >= B_OK && web != NULL) { fView = BMediaTheme::ViewFor(web); AddChild(fView); // Another tab view? Restore previous selection if (tabNum > 0) { BTabView* newTabView = dynamic_cast<BTabView*>(fView); if (newTabView) newTabView->Select(tabNum); } } break; } default: BWindow::MessageReceived(message); } }