void CTabCtrl::OnCreate(void) { // Change WndProc to our multi purpose one. WindowProc(PopupWndProc); // Get window dimensions. m_rcArea = ClientRect(); // Calculate tab page position. CRect rcPage(2, m_iTabHeight, m_rcArea.right-3, m_rcArea.bottom-3); // Create the page dialogs. for (int i = 0; i < m_iNumPages; i++) { // Create the page, hide and centre in control. m_pPageTable[i].pPage->Parent(*this); m_pPageTable[i].pPage->RunModeless(); m_pPageTable[i].pPage->Show(SW_HIDE); m_pPageTable[i].pPage->Move(rcPage); } //Activate first page, if one. if (m_iNumPages) ActivatePage(0); }
// activate a page based on its place in the list BOOL CNewWizDialog::SetActivePage(int nPage) { CNewWizPage* pPage = GetPage(nPage); if (pPage == NULL) return FALSE; ActivatePage(pPage); return TRUE; }
// Set next page as active page void CNewWizDialog::SetNextPage() { CNewWizPage* pPage = GetNextPage(); if (ActivatePage(pPage)) { EnableBack(TRUE); } }
void Gui::ActivatePage( const std::string & pagename, float activation_time, std::ostream & error_output) { if (!ActivatePage(pagename, activation_time)) error_output << "Gui page not found: " << pagename << std::endl; }
// Activate the page with the specified dialog resource void CNewWizDialog::SetActivePageByResource(UINT nResourceID) { CNewWizPage* pPage = GetPageByResourceID(nResourceID); if (pPage == NULL) return; if (!DeactivatePage()) return; ActivatePage(pPage); }
BOOL COXCustomizeManager::ActivatePage(COXCustomizePage* pCustomizePage) { HSHBGROUP hGroup=NULL; int nIndex=-1; if(!FindPage(pCustomizePage,hGroup,nIndex)) return FALSE; ASSERT(hGroup!=NULL && nIndex!=-1); return ActivatePage(hGroup,nIndex); }
BOOL COXCustomizeManager::ActivatePage(LPCTSTR lpszTitle, LPCTSTR lpszGroup) { HSHBGROUP hGroup=NULL; int nIndex=-1; if(!FindPage(lpszTitle,lpszGroup,hGroup,nIndex)) return FALSE; ASSERT(hGroup!=NULL && nIndex!=-1); return ActivatePage(hGroup,nIndex); }
BOOL COXCustomizeManager::CloseManager(BOOL bIsOk) { ASSERT(m_bInitialized); // loop through pages and call OnCloseManager POSITION pos=m_mapPages.GetStartPosition(); while(pos!=NULL) { COXCustomizePage* pCustomizePage=NULL; DWORD dwID=NULL; m_mapPages.GetNextAssoc(pos,pCustomizePage,dwID); ASSERT(pCustomizePage!=NULL); if(::IsWindow(pCustomizePage->GetSafeHwnd())) { if(!pCustomizePage->OnCloseManager(bIsOk)) { ActivatePage(pCustomizePage); return FALSE; } } } COXCustomizePage* pActivePage=GetActivePage(); if(pActivePage!=NULL) { pActivePage->Unload(); m_pActivePage=NULL; } m_shb.DeleteAllGroups(); // loop through pages and destroy them pos=m_mapPages.GetStartPosition(); while(pos!=NULL) { COXCustomizePage* pCustomizePage=NULL; DWORD dwID=NULL; m_mapPages.GetNextAssoc(pos,pCustomizePage,dwID); ASSERT(pCustomizePage!=NULL); if(::IsWindow(pCustomizePage->GetSafeHwnd())) { if(!pCustomizePage->DestroyWindow()) { TRACE(_T("COXCustomizeManager::CloseManager: failed to destroy customize page %s"),pCustomizePage->GetTitle()); return FALSE; } } } m_mapPages.RemoveAll(); m_mapTooltips.RemoveAll(); m_bInitialized=FALSE; return TRUE; }
void CDlgControl::OnTcnSelchangeTab(NMHDR *pNMHDR, LRESULT *pResult) { // int iOldItem; // iOldItem = m_iCurrentItem ; m_iCurrentItem = m_tabCtrl.GetCurSel() ; ActivatePage( m_iCurrentItem ) ; *pResult = 0; }
void COXCustomizeManager::OnActivateItem(NMHDR* pNotifyStruct, LRESULT* result) { LPNMSHORTCUTBAR pNMSHB=(LPNMSHORTCUTBAR)pNotifyStruct; ASSERT(pNMSHB!=NULL); if(pNMSHB->nItem>=0) { if(!ActivatePage(pNMSHB->hGroup,pNMSHB->nItem)) { TRACE(_T("COXCustomizeManager::OnActivateItem: failed to activate page\n")); } } *result=0; }
BOOL COXCustomizeManager::ActivatePage(CustomizeManagerPage pageType) { POSITION pos=m_mapObjects.GetStartPosition(); while(pos!=NULL) { DWORD dwType=0; COXCustomizePage* pCustomizePage=NULL; m_mapObjects.GetNextAssoc(pos,pCustomizePage,dwType); ASSERT(pCustomizePage!=NULL); if((CustomizeManagerPage)dwType==pageType) return ActivatePage(pCustomizePage); } return FALSE; }
void CTabCtrl::OnLeftButtonUp(const CPoint& ptCursor, uint iKeyFlags) { // Find which tab was selected. for(int i=0; i < m_iNumPages; i++) { // Get tab position. CRect rcTab = TabPos(i); // Selected? if (ptCursor.InRect(rcTab)) break; } // Hit a different tab? if ( (i < m_iNumPages) && (i != m_iActivePage) ) ActivatePage(i); }
// CDlgControl 消息处理程序 void CDlgControl::FullScreen ( ) { RECT rectDesktop; WINDOWPLACEMENT wpNew; GetWindowPlacement ( &wpNew ); //Adjust RECT to new size of window ::GetWindowRect ( ::GetDesktopWindow(), &rectDesktop ); ::AdjustWindowRectEx( &rectDesktop, GetStyle(), TRUE, GetExStyle() ); // Remember this for OnGetMinMaxInfo() //m_FullScreenWindowRect = rectDesktop; wpNew.showCmd = SW_SHOWNORMAL; wpNew.rcNormalPosition = rectDesktop; //don't allow the toolbar to dock SetWindowPlacement ( &wpNew ); //SetWindowPos ( NULL, rectDesktop.left, rectDesktop.top, rectDesktop.right, rectDesktop.bottom, SWP_NOREPOSITION ); // 重新排列界面元素 m_iLeft = 0; m_iTop = 22; //m_iTop = 70; m_iRight = rectDesktop.right-rectDesktop.left; m_iBottom = rectDesktop.bottom-rectDesktop.top-150; m_tabCtrl.SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION ); if ( m_pDlgClient ) m_pDlgClient->SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION ); if ( m_pDlgPrePrinting ) m_pDlgPrePrinting->SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION ); if ( m_pDlgOperator ) m_pDlgOperator->SetWindowPos ( NULL, m_iLeft, m_iTop, m_iRight, m_iBottom, SWP_NOREPOSITION ); GetDlgItem ( IDOK )->SetWindowPos ( NULL, (m_iRight - m_iLeft) / 2 + m_iLeft + 100, m_iBottom + 50, 0, 0, SWP_NOSIZE ); ActivatePage( m_iCurrentItem ) ; }
void CNewWizDialog::OnWizardNext() { CNewWizPage* pPage = GetActivePage(); ASSERT(pPage); LRESULT lResult = pPage->OnWizardNext(); if (lResult == -1) return; // don't change pages if (lResult == 0) { POSITION Pos = m_PageList.Find(pPage); ASSERT(Pos); m_PageList.GetNext(Pos); if (Pos == NULL) return; // the current page was the last page pPage = (CNewWizPage*)m_PageList.GetAt(Pos); } else { pPage = GetPageByResourceID(lResult); if (pPage == NULL) return; } if (!ActivatePage(pPage)) return; // enable Back button; it will be enabled later on EnableBack(TRUE); // if we are on the last page, then disable the next button and enable the finish button if (pPage == GetLastPage()) { // DISABLE EVERYTHING FOR INSTALL PAGE EnableBack(FALSE); EnableNext(FALSE); EnableCancel(FALSE); EnableFinish(FALSE); } // if we are not on the last page disable finish button if (pPage != GetLastPage()) { EnableFinish(FALSE); } }
BOOL CDlgControl::OnInitDialog() { CDialog::OnInitDialog(); m_iCurrentItem = 0; m_tabCtrl.InsertItem ( 0, " 打 印 管 理 " ) ; m_tabCtrl.InsertItem ( 1, " 试 打 管 理 " ) ; m_tabCtrl.InsertItem ( 2, " 机 器 管 理 " ) ; m_tabCtrl.InsertItem ( 3, " 墨 水 管 理 " ) ; // m_tabCtrl.DeleteItem ( 1 ) ; if ( NULL == m_pDlgOperator ) { m_pDlgOperator = new CDlgOperator ( this ); m_pDlgOperator->SetScoreDlg ( (CDlgManager*)m_pParent ); m_pDlgOperator->Create ( IDD_DLG_OPERATOR ); // m_pDlgOperator->ShowInfo ( ) ; } if ( NULL == m_pDlgPrePrinting ) { m_pDlgPrePrinting = new CDlgPrePrinting( this ); m_pDlgPrePrinting->Create ( IDD_DLG_PREPRINTING ); } if ( NULL == m_pDlgClient ) { m_pDlgClient = new CcontrolClientDlg( this ); m_pDlgClient->Create ( IDD_CONTROLCLIENT_DIALOG ); } //m_pDlgOperator->ShowWindow(SW_RESTORE) ; //m_pDlgOperator->ShowInfo ( ) ; ActivatePage ( 0 ); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
// Set first page as active page BOOL CNewWizDialog::SetFirstPage() { CNewWizPage* pPage = GetFirstPage(); if (!DeactivatePage()) return FALSE; EnableBack(FALSE); if (m_PageList.GetCount() > 1) { EnableFinish(FALSE); EnableNext(TRUE); } else // wizard has only one page { EnableFinish(TRUE); EnableNext(FALSE); } if (ActivatePage(pPage)) return TRUE; return FALSE; }
void CNewWizDialog::OnWizardBack() { CNewWizPage* pPage = GetActivePage(); ASSERT(pPage); LRESULT lResult = pPage->OnWizardBack(); if (lResult == -1) return; // don't change pages if (lResult == 0) { POSITION Pos = m_PageList.Find(pPage); ASSERT(Pos); m_PageList.GetPrev(Pos); if (Pos == NULL) return; // the current page was the first page pPage = (CNewWizPage*)m_PageList.GetAt(Pos); } else { pPage = GetPageByResourceID(lResult); if (pPage == NULL) return; } if (!ActivatePage(pPage)) return; // if we are on the first page, then disable the back button if (pPage == GetFirstPage()) { EnableBack(FALSE); } // if we are not on the last page disable finish button if (pPage != GetLastPage()) { EnableFinish(FALSE); } // enable the next button EnableNext(TRUE); }
BOOL CDlgControl::PreTranslateMessage(MSG* pMsg) { if ( WM_LBUTTONUP == pMsg->message ) { if ( pMsg->hwnd == m_tabCtrl.GetSafeHwnd() ) { CRect rcTab; CPoint ptPos ( LOWORD(pMsg->lParam), HIWORD(pMsg->lParam) ); m_tabCtrl.GetWindowRect ( rcTab ); ScreenToClient ( rcTab ); rcTab.top = 0; if ( rcTab.PtInRect(ptPos) ) { ActivatePage( m_iCurrentItem ) ; return TRUE; } } } return CDialog::PreTranslateMessage(pMsg); }
// 事件响应函数 short CHistoryQueryHook::MouseUp(CGeoPoint<short> &scrPoint) { short ctrlType = CAggHook::MouseUp(scrPoint); switch(m_downElementType) { //历史记录 标签 case ChkHistoryHook_HistoryRecord: { if (m_historyRecordCtrl.IsEnable()) { m_historyRecordCtrl.MouseUp(); ActivatePage(kPageHisRecord); } } break; //历史轨迹 标签 case ChkHistoryHook_HistoryRoute: { if (m_historyRouteCtrl.IsEnable()) { m_historyRouteCtrl.MouseUp(); ActivatePage(kPageHisRoute); } } break; //历史线路 标签 case ChkHistoryHook_HistoryTrajectory: { if (m_historyTrajectoryCtrl.IsEnable()) { m_historyTrajectoryCtrl.MouseUp(); ActivatePage(kPageHisTrajectory); } } break; //向下翻页 case ChkHistoryHook_PageDownBtn: case ChkHistoryHook_PageDownIcon: { if (m_nextPageCtrl.IsEnable()) { m_nextPageCtrl.MouseUp(); m_pageTurning.NextPage(); SetNavigatorStatus(); ShowHistoryData(m_avtivePageIndex); } } break; //向上翻页 case ChkHistoryHook_PageUpBtn: case ChkHistoryHook_PageUpIcon: { if (m_prevPageCtrl.IsEnable()) { m_prevPageCtrl.MouseUp(); m_pageTurning.PreviousPage(); SetNavigatorStatus(); ShowHistoryData(m_avtivePageIndex); } } break; //列表按钮 default: if (ctrlType>=ChkHistoryHook_List1LeftBtn && ctrlType<=ChkHistoryHook_List5RightBtn) { //选中了第几行 int idxOfSelectedRow = (ctrlType-ChkHistoryHook_List1LeftBtn)/3; //选中的元素在文件中对应的索引是多少 m_Itemidx = (m_pageTurning.GetCurrentPage()-1) * nQuantityOfOnePage + idxOfSelectedRow; if( m_listBtnCtrl[idxOfSelectedRow].IsEnable() ) { m_listBtnCtrl[idxOfSelectedRow].MouseUp(); selectARow(); break; } } else return CBackgroundHook::doMouseUp(ctrlType); } this->Refresh(); return ctrlType; }
void CFxistView::OnFileIndexing() { ActivatePage(2); }
BOOL COXCustomizeManager::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here // setup shortcut bar m_shb.SetBarStyle(SHBS_INFOTIP|SHBS_UNDERLINEHOTITEM|SHBS_SHOWACTIVEALWAYS| SHBS_BOLDEXPANDEDGROUP|SHBS_DISABLEDRAGDROPITEM|SHBS_DRAWHEADERDRAGIMAGE); // setup title m_title.SetTextColor(::GetSysColor(COLOR_CAPTIONTEXT)); m_title.SetBkColor(::GetSysColor(COLOR_BTNFACE)); m_title.SetBackgroundFillType(GRADIENT_LEFT); CFont fontTitle; VERIFY(fontTitle.CreatePointFont(120,_T("MS Sans Serif"))); m_title.SetTextFont(&fontTitle); // layout manager // if(m_LayoutManager.IsAttached()) m_LayoutManager.Detach(); m_LayoutManager.Attach(this); // shortcut bar control m_LayoutManager.TieChild(IDC_OX_SHB_PAGES,OX_LMS_TOP|OX_LMS_BOTTOM,OX_LMT_SAME); // title m_LayoutManager.TieChild(IDC_OX_STATIC_TITLE,OX_LMS_RIGHT|OX_LMS_LEFT,OX_LMT_SAME); // title separator m_LayoutManager.TieChild(IDC_OX_SEPARATOR_TITLE, OX_LMS_RIGHT|OX_LMS_LEFT,OX_LMT_SAME); // bottom separator m_LayoutManager.TieChild(IDC_OX_SEPARATOR_BOTTOM, OX_LMS_RIGHT|OX_LMS_LEFT|OX_LMS_BOTTOM,OX_LMT_SAME); // OK, Cancel, Apply buttons m_LayoutManager.TieChild(IDOK,OX_LMS_BOTTOM|OX_LMS_RIGHT,OX_LMT_SAME); m_LayoutManager.TieChild(IDCANCEL,OX_LMS_BOTTOM|OX_LMS_RIGHT,OX_LMT_SAME); m_LayoutManager.TieChild(IDC_OX_BUTTON_APPLY,OX_LMS_BOTTOM|OX_LMS_RIGHT,OX_LMT_SAME); ////////////////////////////////////// // populate the manager with standard and user defined pages PopulatePages(); for(int nIndex=0; nIndex<m_shb.GetGroupCount(); nIndex++) { HSHBGROUP hGroup=m_shb.FindGroupByOrder(nIndex); ASSERT(hGroup!=NULL); m_shb.SortLCItems(hGroup); } #ifdef OX_CUSTOMIZE_WORKSPACE_STATE ASSERT(GetWorkspaceStatePage()!=NULL); // go through all pages and check if it should be displayed POSITION pos=m_mapPages.GetStartPosition(); while(pos!=NULL) { DWORD dwID=NULL; COXCustomizePage* pCustomizePage=NULL; m_mapPages.GetNextAssoc(pos,pCustomizePage,dwID); ASSERT(pCustomizePage!=NULL && dwID!=NULL); if(!GetWorkspaceStatePage()->IsViewablePage(pCustomizePage)) VERIFY(DeletePage(pCustomizePage)); } #endif // OX_CUSTOMIZE_WORKSPACE_STATE // activate first page HSHBGROUP hGroup=m_shb.FindGroupByOrder(0); ASSERT(hGroup!=NULL); COXCustomizePage* pCustomizePage=GetPageByLocation(hGroup,0); ASSERT(pCustomizePage!=NULL); VERIFY(ActivatePage(pCustomizePage)); // calculate the position of the active page window RecalcPageRect(); // adjust the position of the current active page if(m_pActivePage!=NULL) m_pActivePage->MoveWindow(GetPageRect()); // mark the dialog as initialized m_bInitialized=TRUE; return FALSE; }
void Gui::ActivatePrevPage() { ActivatePage(GetLastPageName(), 0.25); }
void Gui::ActivatePage(const std::string & pagename) { ActivatePage(pagename, 0.25); }
BOOL CNewWizDialog::SetActivePage(CNewWizPage* pPage) { ActivatePage(pPage); return TRUE; }