void CFlowChartViewChildFrame::OnClose() { CMenu mainMenu; mainMenu.LoadMenu(IDR_MAINFRAME); GetMDIFrame()->MDISetMenu(&mainMenu,NULL); ((CMainFrame *)GetMDIFrame())->m_wndFlowChartView=NULL; CMDIChildWnd::OnClose(); }
void CAfficheMesPol::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd); (((CMainFrame*) GetMDIFrame())->bar.GetToolBarCtrl()).SetOwner((CWnd*)this ); ((CMainFrame*) GetMDIFrame())->bar.OnUpdateCmdUI( (CFrameWnd*) GetMDIFrame(), FALSE); }
void CDormantChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { if(bActivate==TRUE) { ((CMainFrame *)GetMDIFrame())->SetNewMenu(IDR_DORMANT); } GetMDIFrame()->RecalcLayout(); GetMDIFrame()->DrawMenuBar(); }
void CFlowChartViewChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { if(bActivate==TRUE) { ((CMainFrame *)GetMDIFrame())->SetNewMenu(IDR_FLOWCHARTVIEW); } GetMDIFrame()->ShowControlBar(&m_LocalToolbar,bActivate,TRUE); GetMDIFrame()->RecalcLayout(); GetMDIFrame()->DrawMenuBar(); }
void CInheritanceViewChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { if(bActivate==TRUE) { ((CMainFrame *)GetMDIFrame())->SetNewMenu(IDR_INHERITANCEVIEW); } GetMDIFrame()->ShowControlBar(&m_LocalToolbar,bActivate,TRUE); GetMDIFrame()->RecalcLayout(); GetMDIFrame()->DrawMenuBar(); }
void CImpactChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { if(bActivate==TRUE) ((CMainFrame *)GetMDIFrame())->SetNewMenu(IDR_IMPACT); GetMDIFrame()->ShowControlBar(&m_ImpactTools,bActivate,TRUE); GetMDIFrame()->RecalcLayout(); GetMDIFrame()->DrawMenuBar(); CMDIChildWnd::OnMDIActivate(bActivate,pActivateWnd,pDeactivateWnd); }
void CQAChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { if(bActivate==TRUE) { ((CMainFrame *)GetMDIFrame())->SetNewMenu(IDR_QA); GetMDIFrame()->DrawMenuBar(); } GetMDIFrame()->ShowControlBar(&m_QATools,bActivate,TRUE); GetMDIFrame()->RecalcLayout(); GetMDIFrame()->DrawMenuBar(); }
BOOL CAfficheMesPol::DestroyWindow() { OnWindowClosegraphics(); CToolBarCtrl& pToolBarCtrl=(&((CMainFrame*) GetMDIFrame())->bar)->GetToolBarCtrl(); pToolBarCtrl.HideButton(ID_VISUALISATION_CHOIXDESPARAMETRES,TRUE); pToolBarCtrl.HideButton(ID_VISUALISATION_VISUALISERLESPOLYTOPES,TRUE); pToolBarCtrl.HideButton(ID_PARZEN,TRUE); ((CMainFrame*)GetMDIFrame())->RecalcLayout(); return CMDIChildWnd::DestroyWindow(); }
void CQAChildFrame::OnClose() { ((CMainFrame *)GetMDIFrame())->m_wndQA=NULL; ((CMainFrame *)GetMDIFrame())->SetNewMenu(IDR_MAINFRAME); if(m_wndSplitter.IsWindowVisible()) { CQATree* p=(CQATree*)m_wndSplitter.GetPane(0,0); p->SendMessage(WM_CLOSE); CQAParams* pr=(CQAParams*)m_wndSplitter.GetPane(0,1); pr->SendMessage(WM_CLOSE); } CMDIChildWnd::OnClose(); }
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle) //---------------------------------------------------- { // update our parent window first GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle); if ((GetStyle() & FWS_ADDTOTITLE) == 0) { return; // leave child window alone! } CDocument* pDocument = GetActiveDocument(); if (bAddToTitle) { TCHAR szText[256+_MAX_PATH]; if (pDocument == NULL) { lstrcpy(szText, m_strTitle); } else { lstrcpy(szText, pDocument->GetTitle()); if (pDocument->IsModified()) lstrcat(szText, "*"); } if (m_nWindow > 0) { wsprintf(szText + lstrlen(szText), _T(":%d"), m_nWindow); } // set title if changed, but don't remove completely AfxSetWindowText(m_hWnd, szText); } }
CWnd *CMDIChildWnd::GetMessageBar() /*********************************/ { CMDIFrameWnd *pFrame = GetMDIFrame(); ASSERT( pFrame != NULL ); return( pFrame->GetMessageBar() ); }
CMainWnd* CChildWnd::GetMainWnd() { if ( ! m_pMainWndCache ) m_pMainWndCache = (CMainWnd*)GetMDIFrame(); return m_pMainWndCache; }
void CMDIChildWnd::OnUpdateFrameTitle(BOOL bAddToTitle) { // update our parent window first GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle); if ((GetStyle() & FWS_ADDTOTITLE) == 0) return; // leave child window alone! CDocument* pDocument = GetActiveDocument(); if (bAddToTitle) { TCHAR szText[256+_MAX_PATH]; if (pDocument == NULL) Checked::tcsncpy_s(szText, _countof(szText), m_strTitle, _TRUNCATE); else Checked::tcsncpy_s(szText, _countof(szText), pDocument->GetTitle(), _TRUNCATE); if (m_nWindow > 0) { TCHAR szWinNumber[16+1]; _stprintf_s(szWinNumber, _countof(szWinNumber), _T(":%d"), m_nWindow); if( lstrlen(szText) + lstrlen(szWinNumber) < _countof(szText) ) { Checked::tcscat_s( szText, _countof(szText), szWinNumber ); } } // set title if changed, but don't remove completely AfxSetWindowText(m_hWnd, szText); } }
void CMergeEditFrame::ActivateFrame(int nCmdShow) { // load docking positions and sizes CDockState pDockState; pDockState.LoadState(_T("Settings")); if (EnsureValidDockState(pDockState)) // checks for valid so won't ASSERT SetDockState(pDockState); // for the dimensions of the diff and location pane, use the CSizingControlBar loader m_wndLocationBar.LoadState(_T("Settings")); m_wndDetailBar.LoadState(_T("Settings")); if (!m_bActivated) { m_bActivated = true; // get the active child frame, and a flag whether it is maximized BOOL bMaximized = FALSE; CMDIChildWnd * oldActiveFrame = GetMDIFrame()->MDIGetActive(&bMaximized); if (oldActiveFrame == nullptr) // for the first frame, get the restored/maximized state from the registry bMaximized = GetOptionsMgr()->GetBool(OPT_ACTIVE_FRAME_MAX); if (bMaximized) nCmdShow = SW_SHOWMAXIMIZED; else nCmdShow = SW_SHOWNORMAL; } CMDIChildWnd::ActivateFrame(nCmdShow); }
BOOL CMDIChildWnd::UpdateClientEdge(LPRECT lpRect) { CMDIFrameWnd* pFrameWnd=GetMDIFrame(); HWND hChild=pFrameWnd->MDIGetActive(); if (hChild==NULL || hChild==m_hWnd) { DWORD dwStyle=::GetWindowLong(pFrameWnd->m_hWndMDIClient,GWL_EXSTYLE); DWORD dwNewStyle=dwStyle; if (hChild!=NULL && !(GetExStyle()&WS_EX_CLIENTEDGE) && (GetStyle()&WS_MAXIMIZE)) dwNewStyle&=~(WS_EX_CLIENTEDGE); else dwNewStyle|=WS_EX_CLIENTEDGE; if (dwStyle!=dwNewStyle) { ::RedrawWindow(pFrameWnd->m_hWndMDIClient,NULL,NULL,RDW_INVALIDATE|RDW_ALLCHILDREN); ::SetWindowLong(pFrameWnd->m_hWndMDIClient,GWL_EXSTYLE,dwNewStyle); ::SetWindowPos(pFrameWnd->m_hWndMDIClient,NULL,0,0,0,0,SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); if (lpRect!=NULL) ::GetClientRect(pFrameWnd->m_hWndMDIClient,lpRect); return TRUE; } } return FALSE; }
void CMDIChildWnd::OnSize(UINT nType, int cx, int cy) { CFrameWnd::OnSize(nType, cx, cy); // update our parent frame - in case we are now maximized or not GetMDIFrame()->OnUpdateFrameTitle(TRUE); }
BOOL CQAChildFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CMDIFrameWnd* pParentWnd, CCreateContext* pContext) { if(CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, pContext)==-1) return -1; if (!m_QATools.Create(GetMDIFrame()) || !m_QATools.LoadToolBar(IDR_QA)) { TRACE0("Failed to create task flow toolbar\n"); } m_QATools.SetBarStyle(m_QATools.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_QATools.EnableDocking(CBRS_ALIGN_ANY); m_QATools.EnableDocking(CBRS_ALIGN_ANY); GetMDIFrame()->DockControlBar(&m_QATools); GetMDIFrame()->RecalcLayout(); return 0; }
int CImpactChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_ImpactTools.Create(GetMDIFrame()) || !m_ImpactTools.LoadToolBar(IDR_IMPACT)) { TRACE0("Failed to create task flow toolbar\n"); } m_ImpactTools.SetBarStyle(m_ImpactTools.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_ImpactTools.EnableDocking(CBRS_ALIGN_ANY); m_ImpactTools.EnableDocking(CBRS_ALIGN_ANY); GetMDIFrame()->DockControlBar(&m_ImpactTools); GetMDIFrame()->RecalcLayout(); return 0; }
int CInheritanceViewChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; // Creating the dockable toolbar which will be visible only when in the datachart // window if (!m_LocalToolbar.Create(GetMDIFrame()) || !m_LocalToolbar.LoadToolBar(IDR_INHERITANCETOOLS)) { TRACE0("Failed to create inheritance view toolbar\n"); } m_LocalToolbar.SetBarStyle(m_LocalToolbar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_LocalToolbar.EnableDocking(CBRS_ALIGN_ANY); GetMDIFrame()->DockControlBar(&m_LocalToolbar); GetMDIFrame()->RecalcLayout(); return 0; }
//最初化するところ void CChildFrame::OnShowWindow(BOOL bShow, UINT nStatus) { CMDIChildWnd::OnShowWindow(bShow, nStatus); // TODO: ここにメッセージ ハンドラ コードを追加します。 CMainFrame * pMain = (CMainFrame *)GetMDIFrame( ); //ラン状態のOFFを設置 CMenu * pMainMenu = pMain->GetMenu(); CMenu * pSubMenu = pMainMenu->GetSubMenu(3); CMenu * pSSubMenu = pSubMenu->GetSubMenu(5); pSSubMenu->CheckMenuRadioItem(ID_STATE_ONLINE,ID_STATE_OFFLINE,ID_STATE_OFFLINE,MF_BYCOMMAND); }
/** * @brief Reflect comparison result in window's icon. * @param nResult [in] Last comparison result which the application returns. */ void CChildFrame::SetLastCompareResult(int nResult) { HICON hCurrent = GetIcon(FALSE); HICON hReplace = (nResult == 0) ? m_hIdentical : m_hDifferent; if (hCurrent != hReplace) { SetIcon(hReplace, TRUE); BOOL bMaximized; GetMDIFrame()->MDIGetActive(&bMaximized); // When MDI maximized the window icon is drawn on the menu bar, so we // need to notify it that our icon has changed. if (bMaximized) { GetMDIFrame()->DrawMenuBar(); } } theApp.SetLastCompareResult(nResult); }
BOOL CMDIChildWnd::DestroyWindow() { if (m_hWnd==NULL) return FALSE; HWND hWndFrame=*GetMDIFrame(); DWORD dwStyle=::SetWindowLong(hWndFrame,GWL_STYLE,::GetWindowLong(hWndFrame,GWL_STYLE)); MDIDestroy(); if (::IsWindow(hWndFrame)) ::SetWindowLong(hWndFrame,GWL_STYLE,dwStyle); return TRUE; }
void CClientChildFrame::OnDestroy() { CMainFrame*pMain = (CMainFrame*) GetMDIFrame(); ASSERT(pMain); if (pMain) { pMain->CloseChildFrm(this); } CBCGPMDIChildWnd::OnDestroy(); // TODO: 在此处添加消息处理程序代码 }
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: ここに特定な作成コードを追加してください。 CMainFrame * pMain = (CMainFrame *)GetMDIFrame( ); CString title; title.Format("%s%d","Tab",pMain->m_iCurrWndCnt); m_tabTitle = pMain->m_iCurrWndCnt == 1 ? "自分" : title ; return 0; }
void CMDIChildWnd::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd*) { m_bPseudoInactive = FALSE; // must be happening for real // make sure MDI client window has correct client edge UpdateClientEdge(); // send deactivate notification to active view CView* pActiveView = GetActiveView(); if (!bActivate && pActiveView != NULL) pActiveView->OnActivateView(FALSE, pActiveView, pActiveView); // allow hook to short circuit normal activation BOOL bHooked = FALSE; #ifndef _AFX_NO_OLE_SUPPORT if (m_pNotifyHook != NULL && m_pNotifyHook->OnDocActivate(bActivate)) bHooked = TRUE; #endif // update titles (don't AddToTitle if deactivate last) if (!bHooked) OnUpdateFrameTitle(bActivate || (pActivateWnd != NULL)); // re-activate the appropriate view if (bActivate) { if (pActiveView != NULL && GetMDIFrame() == GetActiveWindow()) pActiveView->OnActivateView(TRUE, pActiveView, pActiveView); } // update menus if (!bHooked) { OnUpdateFrameMenu(bActivate, pActivateWnd, NULL); GetMDIFrame()->DrawMenuBar(); } }
int CMDIChildWnd::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) { int nResult = CFrameWnd::OnMouseActivate(pDesktopWnd, nHitTest, message); if (nResult == MA_NOACTIVATE || nResult == MA_NOACTIVATEANDEAT) return nResult; // frame does not want to activate // activate this window if necessary CMDIFrameWnd* pFrameWnd = GetMDIFrame(); ENSURE_VALID(pFrameWnd); CMDIChildWnd* pActive = pFrameWnd->MDIGetActive(); if (pActive != this) MDIActivate(); return nResult; }
BOOL CMDIChildWnd::UpdateClientEdge(LPRECT lpRect) { // only adjust for active MDI child window CMDIFrameWnd* pFrameWnd = GetMDIFrame(); CMDIChildWnd* pChild = pFrameWnd->MDIGetActive(); // Only adjust for regular MDI child windows, not tabbed windows. Attempting to set WS_EX_CLIENTEDGE on the tabbed // MDI client area window is subverted by CMDIClientAreaWnd::OnStyleChanging, so we always try to reset the style and // always repaint, none of which is necessary since the tabbed MDI children never change from maximized to restored. //CMDIChildWndEx* pChildEx = (pChild == NULL) ? NULL : DYNAMIC_DOWNCAST(CMDIChildWndEx, pChild); //BOOL bIsTabbedMDIChild = (pChildEx == NULL) ? FALSE : pChildEx->GetMDIFrameWndEx() != NULL && pChildEx->GetMDIFrameWndEx()->AreMDITabs(); if ((pChild == NULL || pChild == this) /*&& !bIsTabbedMDIChild*/) { // need to adjust the client edge style as max/restore happens DWORD dwStyle = ::GetWindowLong(pFrameWnd->m_hWndMDIClient, GWL_EXSTYLE); DWORD dwNewStyle = dwStyle; if (pChild != NULL && !(GetExStyle() & WS_EX_CLIENTEDGE) && (GetStyle() & WS_MAXIMIZE)) { dwNewStyle &= ~(WS_EX_CLIENTEDGE); } else { dwNewStyle |= WS_EX_CLIENTEDGE; } if (dwStyle != dwNewStyle) { // SetWindowPos will not move invalid bits ::RedrawWindow(pFrameWnd->m_hWndMDIClient, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); // remove/add WS_EX_CLIENTEDGE to MDI client area ::SetWindowLong(pFrameWnd->m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle); ::SetWindowPos(pFrameWnd->m_hWndMDIClient, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOCOPYBITS); // return new client area if (lpRect != NULL) { ::GetClientRect(pFrameWnd->m_hWndMDIClient, lpRect); } return TRUE; } } return FALSE; }
void CMDIChildWnd::OnUpdateFrameMenu( BOOL bActive, CWnd *pActivateWnd, HMENU hMenuAlt ) /**************************************************************************************/ { CMDIFrameWnd *pFrame = GetMDIFrame(); ASSERT( pFrame != NULL ); if( hMenuAlt == NULL ) { hMenuAlt = m_hMenuShared; } if( bActive ) { ::SendMessage( pFrame->m_hWndMDIClient, WM_MDISETMENU, (WPARAM)hMenuAlt, (LPARAM)pFrame->GetWindowMenuPopup( hMenuAlt ) ); } else if( pActivateWnd == NULL ) { ::SendMessage( pFrame->m_hWndMDIClient, WM_MDISETMENU, (WPARAM)pFrame->m_hMenuDefault, NULL ); } }
BOOL CChildFrame::DestroyWindow() { // TODO: ここに特定なコードを追加するか、もしくは基本クラスを呼び出してください。 CMainFrame * pMain = (CMainFrame *)GetMDIFrame( ); pMain->m_iCurrWndCnt--; if(pMain->m_bSlided ){ if(m_LeftRelatedSliderBar || m_RightRelatedSliderBar) pMain->RemoveSlider(m_LeftRelatedSliderBar == NULL ? (long)m_RightRelatedSliderBar : (long)m_LeftRelatedSliderBar,this); } else{ if(pMain->m_iCurrWndCnt >= 1){ pMain->MDINext(); CChildFrame* pChild = ((CChildFrame * ) pMain->MDIGetActive()); pChild->m_bLeftMost = TRUE; } } return CMDIChildWnd::DestroyWindow(); }
void CMDIChildWnd::OnMDIActivate( BOOL bActivate, CWnd *pActivateWnd, CWnd *pDeactivateWnd ) /******************************************************/ { UNUSED_ALWAYS( pDeactivateWnd ); CView *pView = GetActiveView(); if( pView != NULL ) { if( !bActivate ) { pView->OnActivateView( FALSE, pView, pView ); } else { pView->OnActivateView( TRUE, pView, pView ); } } OnUpdateFrameMenu( bActivate, pActivateWnd, NULL ); CMDIFrameWnd *pFrame = GetMDIFrame(); ASSERT( pFrame != NULL ); pFrame->DrawMenuBar(); }