// Process the incoming event. void ElementTabSet::ProcessEvent(Core::Event& event) { Core::Element::ProcessEvent(event); if (event.GetCurrentElement() == this && event == "click") { // Find the tab that this click occured on Core::Element* tabs = GetChildByTag("tabs"); Core::Element* tab = event.GetTargetElement(); while (tab && tab != this && tab->GetParentNode() != tabs) tab = tab->GetParentNode(); // Abort if we couldn't find the tab the click occured on if (!tab || tab == this) return; // Determine the new active tab index int new_active_tab = active_tab; for (int i = 0; i < tabs->GetNumChildren(); i++) { if (tabs->GetChild(i) == tab) { new_active_tab = i; break; } } SetActiveTab(new_active_tab); } }
// CMFCTabCtrlEx 메시지 처리기입니다. LRESULT CMFCTabCtrlEx::OnCloseEpub(WPARAM wParam, LPARAM lParam) { TRACE(_T("CMFCTabCtrlEx::OnCloseEpub() START\r\n")); // HRESULT hr = S_OK; // Remove epub theApp.m_WebkitEngine.Close((CWnd *)wParam); // Remove tab int tabID = (int)lParam; int index = GetTabByID(tabID); if(index >= 0) { int next = -1; if(index + 1 < GetTabsNum()) next = index + 1; else if( index - 1 >= 0 ) next = index - 1; // if( next >= 0) { SetActiveTab(next); ShowTab(next); } if(!RemoveTab(index)) return S_FALSE; } // TRACE(_T("CMFCTabCtrlEx::OnCloseEpub() END\r\n")); return hr; }
//--------------------------------------------------------------------------- void wxTabbedWindow::RemoveTab( int tabNo ) { twTabInfo* pTab = ((twTabInfo*)(mTabs.Item( tabNo )->GetData())); pTab->mpContent->Destroy(); delete pTab; mTabs.Erase( mTabs.Item( tabNo ) ); // if ( mActiveTab >= mTabs.GetCount() ); if ( mActiveTab >= mTabs.GetCount() ) mActiveTab = mTabs.GetCount() - 1; SetActiveTab( mActiveTab ); }
BOOL Panel::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { switch (((LPNMHDR)lParam)->code) { case TCN_SELCHANGE: // Pick up a tab change SetActiveTab(GetActiveTab()); break; } return CWnd::OnNotify(wParam, lParam, pResult); }
void CPodcastAppUi::TabRightL() { if (iNaviStyle == ENaviTabGroup) { TInt ati = iTabGroup->ActiveTabIndex(); if(ati < iTabGroup->TabCount()-1) { SetActiveTab(ati+1); TabChangedL(ati+1); } } }
void CPodcastAppUi::TabLeftL() { if (iNaviStyle == ENaviTabGroup) { TInt ati = iTabGroup->ActiveTabIndex(); if(ati > 0) { SetActiveTab(ati-1); TabChangedL(ati-1); } } }
//--------------------------------------------------------------------------- void wxTabbedWindow::OnLButtonDown( wxMouseEvent& event ) { // floats, why? int x = (int)event.m_x; int y = (int)event.m_y; int tabNo = HitTest( wxPoint(x,y) ); if ( tabNo != -1 ) { SetActiveTab( tabNo ); } }
////////////////// // Trap arrow-left key to skip disabled tabs. // This is the only way to know where we're coming from--ie from // arrow-left (prev) or arrow-right (next). // BOOL CMyTabCtrl::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT)) { int iNewTab = (pMsg->wParam == VK_LEFT) ? PrevEnabledTab(GetCurSel(), FALSE) : NextEnabledTab(GetCurSel(), FALSE); if (iNewTab >= 0) SetActiveTab(iNewTab); return TRUE; } return CTabCtrl::PreTranslateMessage(pMsg); }
BOOL CMyTabCtrl::SubclassDlgItem(UINT nID, CWnd* pParent) { if (!CTabCtrl::SubclassDlgItem(nID, pParent)) return FALSE; ModifyStyle(0, TCS_OWNERDRAWFIXED); // If first tab is disabled, go to next enabled tab if (!IsTabEnabled(0)) { int iTab = NextEnabledTab(0, TRUE); SetActiveTab(iTab); } return TRUE; }
/***************************************************************************** * Function - SetActiveTab * DESCRIPTION: *****************************************************************************/ bool MenuBar::SetActiveTab(int index) { MenuTab* pChild = (MenuTab*)Group::GetFirstChild(); for (int i = 0; i < index && pChild != NULL; i++) { pChild = (MenuTab*)Group::GetNextChild(pChild); } if (pChild) { return SetActiveTab(pChild); } return false; }
//////////////// // Translate parent property sheet message. Translates Control-Tab and // Control-Shift-Tab keys. These are normally handled by the property // sheet, so you must call this function from your prop sheet's // PreTranslateMessage function. // BOOL CMyTabCtrl::TranslatePropSheetMsg(MSG* pMsg) { WPARAM key = pMsg->wParam; if (pMsg->message == WM_KEYDOWN && GetAsyncKeyState(VK_CONTROL) < 0 && (key == VK_TAB || key == VK_PRIOR || key == VK_NEXT)) { int iNewTab = (key==VK_PRIOR || GetAsyncKeyState(VK_SHIFT) < 0) ? PrevEnabledTab(GetCurSel(), TRUE) : NextEnabledTab(GetCurSel(), TRUE); if (iNewTab >= 0) SetActiveTab(iNewTab); return TRUE; } return FALSE; }
void GnITabCtrl::PushTabButton(GnInterface* pInterface, GnIInputEvent* pEvent) { if( pEvent->GetEventType() != GnIInputEvent::PUSH ) return; gint numPushTabButton = -1; for( gtuint i = 0; i < mpTabButtons->GetChildrenSize(); i++ ) { GnInterface* child = mpTabButtons->GetChild( i ); if( child == pInterface ) { numPushTabButton = (gint)i; } } if( numPushTabButton == -1 ) return; SetActiveTab( numPushTabButton ); }
/* -------------------------------------------------- * Handle this key event. Return true if it is taken care of * --------------------------------------------------*/ bool MenuBar::HandleKeyEvent(Keys KeyID) { switch(KeyID) { case MPC_MENU_KEY: { Component* child = GetCurrentChild(); child = GetNextChild(child); SetActiveTab((MenuTab*)child); return true; } case MPC_HOME_KEY: { DisplayController::GetInstance()->ResetToHome(); return true; } default: return false; } }
void CAdvanceTabWnd::OnActiveTabChanged(POSITION posOldActiveTab, POSITION posNewActiveTab) { SetActiveTab(); }