📄 multibrowserview.cpp
字号:
// MultiBrowserView.cpp : implementation of the
// CMultiBrowserView class
//
#include "stdafx.h"
#include "MultiBrowser.h"
#include "MultiBrowserDoc.h"
#include "MultiBrowserView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static int nCounter = 0;
static CMultiBrowserView *pView[4] =
{ NULL, NULL, NULL, NULL };
/////////////////////////////////////////////////////////////////////////////
// CMultiBrowserView
IMPLEMENT_DYNCREATE(CMultiBrowserView, CHtmlView)
BEGIN_MESSAGE_MAP(CMultiBrowserView, CHtmlView)
//{{AFX_MSG_MAP(CMultiBrowserView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMultiBrowserView construction/destruction
CMultiBrowserView::CMultiBrowserView()
{
m_nMyCount = nCounter;
m_nLastUpdated = 1;
m_bInitialUpdate = TRUE;
if( nCounter < 4 )
pView[nCounter++] = this;
}
CMultiBrowserView::~CMultiBrowserView()
{
}
BOOL CMultiBrowserView::PreCreateWindow(CREATESTRUCT& cs)
{
return CHtmlView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMultiBrowserView drawing
void CMultiBrowserView::OnDraw(CDC* pDC)
{
CMultiBrowserDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
}
void CMultiBrowserView::OnInitialUpdate()
{
CHtmlView::OnInitialUpdate();
// We'll only go the the search
// engine if this is the first view window.
if( m_nMyCount == 0 )
Navigate2(_T("http://www.excite.com/"),
NULL,NULL);
}
/////////////////////////////////////////////////////////////////////////////
// CMultiBrowserView diagnostics
#ifdef _DEBUG
void CMultiBrowserView::AssertValid() const
{
CHtmlView::AssertValid();
}
void CMultiBrowserView::Dump(CDumpContext& dc) const
{
CHtmlView::Dump(dc);
}
CMultiBrowserDoc* CMultiBrowserView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMultiBrowserDoc)));
return (CMultiBrowserDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMultiBrowserView message handlers
void CMultiBrowserView::OnBeforeNavigate2(
LPCTSTR lpszURL,
DWORD nFlags, LPCTSTR lpszTargetFrameName,
CByteArray& baPostedData, LPCTSTR lpszHeaders,
BOOL* pbCancel )
{
// Skip this is this is the initial update.
// Make sure we only do this code if this
// is the first view window. Also, make sure
// the URL doesn't have a '?' character. The
// '?' indicates a parameter and shows that
// the user is navigating the search engine.
if( !m_bInitialUpdate &&
m_nMyCount == 0 &&
strstr( lpszURL, "?" ) == NULL ){
// If the view class pointer isn't NULL,
// make it navigate to the URL.
if( pView[m_nLastUpdated] != NULL )
pView[m_nLastUpdated]->Navigate2( lpszURL );
// Increment our counter index so that we'll
// update the remaining three windows in
// sequential order.
m_nLastUpdated++;
if( m_nLastUpdated > 3 )
m_nLastUpdated = 1;
// Cancel the navigation of the
// search window.
*pbCancel = TRUE;
}
// Set our flag so we know this isn't the
// initial update.
m_bInitialUpdate = FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -