void CActivityView::OnSize(UINT nType, int cx, int cy) { CScrollView::OnSize(nType, cx, cy); CDocument *pDoc = GetDocument(); ASSERT(pDoc); pDoc->UpdateAllViews(NULL); }
BOOL CPlayerFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct) { CDocTemplate* pTemplate = NULL; POSITION pos; CDocument* pDocument = NULL; pos = AfxGetApp()->GetFirstDocTemplatePosition(); pTemplate = AfxGetApp()->GetNextDocTemplate( pos ); if ( pCopyDataStruct->dwData == 0 && pCopyDataStruct->lpData ) { if ( pTemplate ) { POSITION docpos = pTemplate->GetFirstDocPosition( ); // Loop through documents in this template while ( docpos ) { VERIFY( pDocument = pTemplate->GetNextDoc(docpos) ); // update all view attached to this document pDocument->UpdateAllViews( NULL, WM_PLAYER_ADD_FILE, (CObject*)pCopyDataStruct->lpData ); } } } return CMainFrame::OnCopyData(pWnd, pCopyDataStruct); }
void SECEditView::UpdateViews(CWnd* pSender, LPARAM lHint, CObject* pHint) { // This is declared in SECEditCore.h because many OE functions // Update the view. The default implementation does nothing // and is called for SECEditCtrl derivatives. This is called // for SECEditView derivatives CDocument* pDoc = GetDocument(); if (pDoc) pDoc->UpdateAllViews((CView*)pSender, lHint, pHint); }
void CXTPShellListView::OnDblclk(NMHDR* /*pNMHDR*/, LRESULT* pResult) { int iIndex = GetDoubleClickedItem(); if (iIndex >= 0) { CDocument* pDoc = GetDocument(); pDoc->UpdateAllViews(this, SHN_XTP_SELECTCHILD, (CObject*)GetListCtrl().GetItemData(iIndex)); } *pResult = 0; }
void CXTPShellTreeView::SelectionChanged(HTREEITEM hItem, CString strFolderPath) { if (hItem != NULL && !m_bTunneling) { CDocument* pDoc = GetDocument(); if (pDoc != NULL) { pDoc->UpdateAllViews(this, SHN_XTP_TREESELCHANGE, (CObject*)GetTreeCtrl().GetItemData(hItem)); } } CXTPShellTreeBase::SelectionChanged(hItem, strFolderPath); }
void CXTPShellListView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar == VK_RETURN) { int iIndex = GetListCtrl().GetNextItem(-1, LVNI_FOCUSED); if (iIndex >= 0) { CDocument* pDoc = GetDocument(); pDoc->UpdateAllViews(this, SHN_XTP_SELECTCHILD, (CObject*)GetListCtrl().GetItemData(iIndex)); } } CXTPShellListViewBase::OnKeyDown(nChar, nRepCnt, nFlags); }
UINT CPaletteApp::RealizeAppPalette(CDC* pDC) { // PERFORMANCE static CPalette* pLastApp = NULL; ASSERT(pDC); #ifdef _DEBUGRARE // Note that this may be called often since every OnPaint() // or other DC drawing done by the app should realize this palette // into the DC before drawing. // TRACE("CPaletteApp::RealizeAppPalette() called\n"); #endif // _DEBUGRARE CPalette* pAppPalette = GetAppPalette(); UINT uChanged = 0; if (pAppPalette) { pDC->SelectPalette(pAppPalette, FALSE); uChanged = pDC->RealizePalette(); if (uChanged || pAppPalette != pLastApp) { // Cause all windows to repaint with new palette. // REVIEW: This only affects views of the current document. // if (m_pMainWnd && m_pMainWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd))) { CDocument* pDoc = ((CFrameWnd*)m_pMainWnd)->GetActiveDocument(); if (pDoc) pDoc->UpdateAllViews(NULL); } pLastApp = pAppPalette; uChanged = 256; } } return uChanged; }
CDocument* CWedApp::OpenDocumentFile(LPCTSTR lpszFileName) { CDocument* ret = NULL; ret = CWinApp::OpenDocumentFile(lpszFileName); if(!ret) return ret; // See if window creation failed if( ((CWedDoc*)ret)->ssel.m_err) { //Close this one pDocTemplate->RemoveDocument(ret); //Close some more POSITION pos = pDocTemplate->GetFirstDocPosition(); pDocTemplate->RemoveDocument(pDocTemplate->GetNextDoc(pos)); pDocTemplate->RemoveDocument(pDocTemplate->GetNextDoc(pos)); pDocTemplate->RemoveDocument(pDocTemplate->GetNextDoc(pos)); AfxMessageBox("Windows ran out of windows", MB_ICONSTOP); ret = NULL; } // Maximize it // Open up in demonstration/full screen mode: POSITION pos = ret->GetFirstViewPosition(); CView *pView = ret->GetNextView(pos); if (pView) { pView->GetParent()->ShowWindow(SW_SHOWMAXIMIZED); ret->UpdateAllViews(NULL); } return ret; }
void CXTPShellTreeView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* pHint) { switch (lHint) { // Update selection of tree view to the case SHN_XTP_SELECTCHILD: { XTP_LVITEMDATA* lplvid = (XTP_LVITEMDATA*)pHint; ASSERT(lplvid != NULL); if (!FindTreeItem(GetTreeCtrl().GetSelectedItem(), lplvid, FALSE)) { // The folder was not found so we send back a message // to the listview to execute the itemid CDocument* pDoc = GetDocument(); pDoc->UpdateAllViews(this, SHN_XTP_NOFOLDER, (CObject*)lplvid); } } break; default: break; } }
// @pymethod |PyCDocument|UpdateAllViews|Informs each view when a document changes. static PyObject * ui_doc_update_all_views(PyObject *self, PyObject *args) { PyObject *obSender; PyObject *obHint = Py_None; CDocument *pDoc; if (!(pDoc=PyCDocument::GetDoc(self))) return NULL; if (!PyArg_ParseTuple(args, "O|O:UpdateAllViews", &obSender, // @pyparm <o PyCView>|sender||The view who initiated the update &obHint)) // @pyparm object|hint|None|A hint for the update. return NULL; CView *pView = NULL; if (obSender!=Py_None) { if (!(pView=PyCView::GetViewPtr(obSender))) return NULL; } if (obHint==Py_None) obHint = NULL; GUI_BGN_SAVE; pDoc->UpdateAllViews(pView, (LPARAM)obHint);// @pyseemfc CDocument|UpdateAllViews GUI_END_SAVE; RETURN_NONE; }
void CMainFrame::OnLanguageSelection( UINT nID ) { CDocTemplate* pTemplate = NULL; POSITION pos; CDocument* pDocument = NULL; int nLanguageSelection = nID - ID_LANGUAGE_START; if ( 0 == nLanguageSelection ) { WORD nLanguage; CHyperLink myLink; CUString strVersions; // FIXME strVersions.Format( _W("cdexversion=1.70&beta=8&cdexdir=%s" ), (LPCWSTR)g_config.GetAppPath() ); for ( nLanguage=0; nLanguage < g_language.GetNumLanguageStrings(); nLanguage++) { CUString strLangName( g_language.GetLanguageString( nLanguage ) ); CUString strLangVersion; strLangVersion.Format( _W("%s=%s"), (LPCWSTR)strLangName, (LPCWSTR)g_language.GetRevisionLevel( strLangName ) ); strVersions += _W( "&" ) + strLangVersion; } // myLink.GotoURL( _T("www.cdex.n3.net/lang/langcheck.php?") + strVersions , SW_SHOW ); myLink.GotoURL( _T("cdexos.sourceforge.net/lang/cdex_v1.70"), SW_SHOW ); } else { // nLanguageSelection--; // Switch to selected language CString strMenu; m_pPopupMenu->GetMenuString( nLanguageSelection, strMenu, MF_BYPOSITION ); g_language.SetLanguage( CUString( strMenu ) ); // get document template pos = AfxGetApp()->GetFirstDocTemplatePosition(); pTemplate = AfxGetApp()->GetNextDocTemplate( pos ); POSITION docpos = pTemplate->GetFirstDocPosition( ); // Loop through documents in this template while ( docpos ) { VERIFY( pDocument = pTemplate->GetNextDoc(docpos) ); // update all view attached to this document pDocument->UpdateAllViews( NULL,WM_CDEX_INITIAL_UPDATE, NULL ); } g_config.SetLanguage( g_language.GetLanguage() ); g_config.Save(); SetLanguageMenu( ); } }