/****************************************************************************** Function Name : vDisplayWarningLineNumber Input(s) : eMESSAGEFROM eMsgFrom, UINT unLineNo Output : - Functionality : Scrolls to the line number spaecified and highlights the same. Member of : CFileView Friend of : - Author(s) : Date Created : ******************************************************************************/ void CFileView::vDisplayWarningLineNumber( eMESSAGEFROM eMsgFrom, UINT unLineNo) { // Get document CFunctionEditorDoc* pomSrcFileDoc = omGetDocument(); // Doc is valid if(pomSrcFileDoc != nullptr) { // Main frame is valid and // function called from COutWnd class if (eMsgFrom == OUTWND) { // Get child window, active may be // "COutWnd" CFrameWnd* pMainFrame = (CFrameWnd*)CWnd::FromHandle(CGlobalObj::sm_hWndMDIParentFrame); CMDIChildWnd* pChild = ( CMDIChildWnd*) pMainFrame->GetActiveFrame(); CString omStrText = ""; BOOL bInLoop = TRUE; do { // Get next window pChild = (CEditFrameWnd*) pChild->GetWindow(GW_HWNDNEXT); if(pChild != nullptr ) { // Get Window caption pChild->GetWindowText(omStrText); // check the title of child window, // if matches, activate my window it if (omStrText == omGetDocument()->GetTitle()) { bInLoop = FALSE; } } else { bInLoop = FALSE; } } while (bInLoop); if (pChild != nullptr) { pChild->MDIActivate(); } } // Update document with the line no pomSrcFileDoc->m_lCurrentWarningLineNum = unLineNo; // Scroll to the line specified vGoToLine( unLineNo ); // refresh the view Invalidate(TRUE); } // end of if(pomSrcFileDoc) }
BOOL CXTPMDIWndTab::Install(CMDIFrameWnd* pMDIFrameWnd, DWORD dwStyle/*= TCS_BOTTOM | TCS_HOTTRACK*/, BOOL bNoIcons/*= FALSE*/) { ASSERT_VALID(pMDIFrameWnd); // must be valid. ASSERT_KINDOF(CMDIFrameWnd, pMDIFrameWnd); // must be MDI frame window. m_bNoIcons = bNoIcons; m_pMDIFrameWnd = pMDIFrameWnd; m_iBorderGap = m_pTheme->GetThemeStyle() != xtpControlThemeOffice2000 ? 1 : 5; dwStyle |= WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN; if (!Create(dwStyle, CRect(0, 0, 0, 0), m_pMDIFrameWnd, AFX_IDC_TAB_CONTROL)) { TRACE0("Unable to create CXTPMDIWndTab control.\n"); return FALSE; } m_pMDIClientWnd = new CXTPMDIClientWnd(this); ASSERT(m_pMDIClientWnd != NULL); if (!m_pMDIClientWnd->SubclassWindow(m_pMDIFrameWnd->m_hWndMDIClient)) return FALSE; // Retrieve the current active MDI child window. CMDIChildWnd* pActiveChild = (CMDIChildWnd*)m_pMDIFrameWnd->MDIGetActive(); if (pActiveChild != NULL) { // Get the first top-level window in the list. CMDIChildWnd* pChildFrame = (CMDIChildWnd*)pActiveChild->GetWindow(GW_HWNDLAST); while (pChildFrame != NULL) { // Insert the tab and get the next frame on the window manager's list InsertTabWnd(pChildFrame, FALSE); pChildFrame = (CMDIChildWnd*)pChildFrame->GetWindow(GW_HWNDPREV); } } // Force parent frame to re-adjust layout. m_pMDIFrameWnd->RecalcLayout(); return TRUE; }
void CExtMdiWindowsListDlg::_FillMDIWindowList() { m_ListWindows.SetRedraw(FALSE); m_ListWindows.ResetContent(); CMDIChildWnd* pActiveChild = (CMDIChildWnd*)m_pMDIFrameWnd->MDIGetActive(); if (pActiveChild != NULL) { CMDIChildWnd* pChildFrame = (CMDIChildWnd*)pActiveChild->GetWindow(GW_HWNDLAST); while (pChildFrame != NULL) { HWND hChildFrame = pChildFrame->GetSafeHwnd(); CString strWindowText; pChildFrame->GetWindowText( strWindowText ); if( strWindowText.IsEmpty() ) { CWnd* pMDIChildWnd = pChildFrame->GetWindow(GW_CHILD); while( pMDIChildWnd ) { if( pMDIChildWnd->IsKindOf(RUNTIME_CLASS(CView)) ) { CDocument* pDocument = ((CView*)pMDIChildWnd)->GetDocument(); if (pDocument == NULL) strWindowText = _T(""); strWindowText = pDocument->GetTitle(); pChildFrame->SetWindowText( strWindowText ); } // if( pMDIChildWnd->IsKindOf(RUNTIME_CLASS(CView)) ) pMDIChildWnd = pMDIChildWnd->GetWindow(GW_HWNDNEXT); } // while( pMDIChildWnd ) } // if( strWindowText.IsEmpty() ) int iIndex = m_ListWindows.AddString(strWindowText); m_ListWindows.SetItemData(iIndex, (DWORD)hChildFrame); pChildFrame = (CMDIChildWnd*)pChildFrame->GetWindow(GW_HWNDPREV); } // while (pChildFrame != NULL) } // if (pActiveChild != NULL) m_ListWindows.SetRedraw(TRUE); }
CString CXTPMDIWndTab::GetChildWndText(HWND hWnd) const { // Check to see if the user has defined a label for the tab first. CString strTitle; if (m_mapTabLabels.Lookup(hWnd, strTitle)) { return strTitle; } // Get a pointer to the frame window. CMDIChildWnd* pChildFrame = (CMDIChildWnd*)CWnd::FromHandle(hWnd); if (!::IsWindow(pChildFrame->GetSafeHwnd())) { return _T(""); } // Get the window text for the frame and use it for the tab label. pChildFrame->GetWindowText(strTitle); // If the string is empty the document's title. if (strTitle.IsEmpty()) { CWnd* pChildWnd = pChildFrame->GetWindow(GW_CHILD); while (pChildWnd) { if (pChildWnd->IsKindOf(RUNTIME_CLASS(CView))) { // Get a pointer to the view's document. CDocument* pDoc = ((CView*)pChildWnd)->GetDocument(); if (pDoc == NULL) { return _T(""); } // Set the return string value strTitle = pDoc->GetTitle(); // Reset the frames title pChildFrame->SetWindowText(strTitle); // Return the document title. return strTitle; } pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT); } } // Return the MDI frame window's title. return strTitle; }