Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
// Returns the old/replaced CView*
CView* CSplitterWndEx::ReplaceView(CView *pView, int row, int col)
{
int paneID, oldID, newID;
ASSERT( pView);
ASSERT(::IsWindow( pView->m_hWnd));
CWnd* pWnd = CSplitterWnd::GetPane(row,col);
ASSERT(pWnd && pWnd->GetRuntimeClass()->IsDerivedFrom( RUNTIME_CLASS(CView)));
// make sure all views are stored
_views.SetAt( pView->GetRuntimeClass()->m_lpszClassName, pView);
_views.SetAt( pWnd->GetRuntimeClass()->m_lpszClassName, (CView*)pWnd);
paneID = CSplitterWnd::IdFromRowCol( row, col);
oldID = pWnd->GetDlgCtrlID();
newID = pView->GetDlgCtrlID();
// Do not replace if it is the same view !
if ( paneID != newID){
pView->SetDlgCtrlID( paneID);
pWnd->SetDlgCtrlID( newID);
pWnd->ShowWindow(SW_HIDE);
pView->ShowWindow(SW_SHOW);
CSplitterWnd::RecalcLayout();
pView->Invalidate();
}
return (CView*)pWnd;
}
CTypedPtrMap<CMapStringToPtr, CString, CView*> _views;
// Returns the already stored view or dynamically creates one stores it
// and returns it
CView* CSplitterWndEx::getStoredView(CRuntimeClass *pRTC, CDocument *pDoc)
{
ASSERT( pRTC && pDoc);
CView* pView = NULL;
BOOL bFound = _views.Lookup( pRTC->m_lpszClassName, pView);
if ( !bFound){
// create the view and add it to the map
pView = (CView*)pRTC->CreateObject();
ASSERT(pView);
CCreateContext cc;
ZeroMemory(&cc, sizeof(cc));
cc.m_pCurrentDoc = pDoc;
if (pView->Create(NULL, "", WS_CHILD, CRect(0,0,0,0), this,
_nNextCtrlID++, &cc) ){
pView->OnInitialUpdate();
// views are mapped by their class name
_views.SetAt( pRTC->m_lpszClassName, pView);
}
}
ASSERT( pView);
return pView;
}