@gplx.Internal protected void Focus(GfuiElem cur, boolean fwd) { List_adp allElemsInOwnerWin = List_adp_.new_(); AddSubs(cur.OwnerWin(), allElemsInOwnerWin); int curIdx = allElemsInOwnerWin.Idx_of(cur); GfuiElem target = cur; while (true) { // find next visible elem int cycle = TabBox_.Cycle(fwd, curIdx, allElemsInOwnerWin.Count()); target = GfuiElem_.cast_(allElemsInOwnerWin.Get_at(cycle)); if (target.Visible()) break; if (cycle == curIdx) break; // either (a) one elem in allElemsInOwnerWin or (b) n elems, and cycled back to start; break, else infinite loop curIdx = cycle; } target.Focus(); }
@gplx.Internal protected void MoveTab(GfuiBtn curBtn, int delta) { TabPnlItm curItm = tabBox.Mgr().Get_by(curBtn.Key_of_GfuiElem()); int curIdx = curItm.Idx(); int newIdx = TabBox_.Cycle(delta > 0, curIdx, tabBox.Mgr().Count()); tabBox.Mgr().Move_to(curIdx, newIdx); tabBox .Mgr() .Reorder( 0); // reorder all; exchanging curIdx for newIdx does not work when going from last to // first (17 -> 0, but 0 -> 1) tabBox.PnlBox().SubElems().Move_to(curIdx, newIdx); TabBtnAreaMgr.Move_to(tabBox, curIdx, newIdx); TabBoxEvt_orderChanged.Publish(tabBox, curIdx, newIdx); }
public void Inject(Object obj) { tabBox = TabBox_.cast(obj); IptBnd_.cmd_to_( IptCfg_.Null, tabBox, this, SelectNext_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Tab), IptKey_.add_(IptKey_.Ctrl, IptKey_.PageDown)); IptBnd_.cmd_to_( IptCfg_.Null, tabBox, this, SelectPrev_cmd, IptKey_.add_(IptKey_.Ctrl, IptKey_.Tab, IptKey_.Shift), IptKey_.add_(IptKey_.Ctrl, IptKey_.PageUp)); }
void Select(GfoMsg msg, int delta) { TabPnlItm curTab = tabBox.Mgr().CurTab(); int newIdx = TabBox_.Cycle(delta > 0, curTab.Idx(), tabBox.Mgr().Count()); tabBox.Tabs_Select(newIdx); }