LRESULT CDocSelector::OnSelChange(WPARAM wParam, LPARAM) { // Killing the timer, because timer can change the // selection in between the procedure... KillTimer( DS_TIMER_ID ); // Yogesh Jagota // sent when a button gets clicked CSwitcherButton* newsel = (CSwitcherButton*)wParam; // Yogesh Jagota CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd(); //CWnd* Window = (CWnd*)newsel->m_FrameWnd;//Y.Ivanov CWnd* Window = (CWnd*)newsel->m_AttachedView->GetParentFrame();//Yuriy Ivanov pFrame->MDIActivate( Window ); if(Window->IsIconic()) Window->ShowWindow(SW_SHOWNORMAL); pFrame->Invalidate(); // End Yogesh Jagota if (m_iSelectedButton > -1) GetButtonFromID(m_iSelectedButton)->Unselect(); m_iSelectedButton = newsel->m_iID; // Reactivate the timer... SetTimer( DS_TIMER_ID, 10, NULL ); // Yogesh Jagota return 1; }
LRESULT CDocSelector::OnSelChange(WPARAM wParam, LPARAM) { // Killing the timer, because timer can change the // selection in between the procedure... KillTimer( DS_TIMER_ID ); // Yogesh Jagota // sent when a button gets clicked CSwitcherButton* newsel = (CSwitcherButton*)wParam; // Yogesh Jagota CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd(); CWnd* Window = (CWnd*)newsel->m_FrameWnd; WINDOWPLACEMENT wndpl; Window->GetWindowPlacement( &wndpl); if(wndpl.showCmd == SW_SHOWMINIMIZED) Window->ShowWindow(SW_RESTORE); pFrame->MDIActivate( Window ); // End Yogesh Jagota if (m_iSelectedButton > -1) GetButtonFromID(m_iSelectedButton)->Unselect(); m_iSelectedButton = newsel->m_iID; // Reactivate the timer... SetTimer( DS_TIMER_ID, 10, NULL ); // Yogesh Jagota return 1; }
void mfc_term_view::recall_line() // bound to Enter in hist_view { CString txt = grab_line(); term_view->set_command(txt); long i = bol(0); // get first char of current line if (i == bol(1)) { // this line typed at end: send it term_view->send_or_copy(); i = eob(); } else if (term_view->is_visible) { CMDIFrameWnd *fw = (CMDIFrameWnd *)(the_boss.m_pMainWnd); fw->MDIActivate(term_view->GetParent()); } GetRichEditCtrl().SetSel(i, i); }
void CDocSelector::OnDocmenuActivate() { if(m_iRID >= 0) { CSwitcherButton* btn = GetButtonFromID(m_iRID); m_iRID = -1; if(btn) { CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd(); pFrame->MDIActivate(btn->m_FrameWnd); } } }
static void on_view(mfc_term_view *view) { if (view && IsWindow(view->m_hWnd)) { CMDIFrameWnd *fw = (CMDIFrameWnd *)(the_boss.m_pMainWnd); if (view->is_visible) { CMDIChildWnd *cw = (CMDIChildWnd *)fw->GetActiveFrame(); if (view == cw->GetActiveView()) fw->MDINext(); view->GetParent()->ShowWindow(SW_HIDE); } else { view->GetParent()->ShowWindow(SW_SHOW); fw->MDIActivate(view->GetParent()); } view->is_visible = !view->is_visible; SendMessage(fw->m_hWndMDIClient, WM_MDIREFRESHMENU, 0, 0); } }
LOCAL LPCMDLIST ProgActivateWindow(LPACTIVATEWINDOW_PARMS lpParms) /***********************************************************************/ { int iOffset, nDocs; CWnd *pActiveWnd, *pNextWnd, *pChild; CMDIFrameWnd *pMainWnd; pNextWnd = NULL; pMainWnd = (CMDIFrameWnd *)PictPubApp.m_pMainWnd; // first look for the filename CServerDoc *pDoc = PictPubApp.GetDocument(lpParms->szFileName); if (pDoc) { // ignore if we are in place if (pDoc->IsInPlaceActive()) return(NULL); POSITION ViewPos = pDoc->GetFirstViewPosition(); if (ViewPos) { CView* pView = pDoc->GetNextView( ViewPos ); if (pView) pNextWnd = pView->GetParent(); } } // if not found, try using windows offsets if (!pNextWnd && lpParms->iOffset) { nDocs = 0; pChild = pActiveWnd = pMainWnd->MDIGetActive(); while (pChild) { ++nDocs; pChild = pChild->GetWindow(GW_HWNDNEXT); } if (nDocs) { iOffset = lpParms->iOffset; pNextWnd = pActiveWnd; if (iOffset > 0) { if (iOffset >= nDocs) iOffset = nDocs - 1; while(pNextWnd && (--iOffset >= 0)) pNextWnd = pNextWnd->GetWindow(GW_HWNDNEXT); } else { if (iOffset <= (-nDocs)) iOffset = (-nDocs) + 1; while(pNextWnd && (++iOffset <= 0)) pNextWnd = pNextWnd->GetWindow(GW_HWNDPREV); } } } if (pNextWnd) { CPPMDIChildWnd *pMDIChild = (CPPMDIChildWnd *)pNextWnd; CServerView *pView = (CServerView*)pMDIChild->GetActiveView(); if (pView) { CServerDoc *pDoc = pView->GetDocument(); ASSERT(pDoc && pDoc->m_lpImage); if (pDoc && pDoc->m_lpImage && !pDoc->IsInPlaceActive()) { pMainWnd->MDIActivate(pNextWnd); return(pDoc->m_lpImage->lpCmdList); } } } return(NULL); }