list_various_view - yamaumima/hello.github.io GitHub Wiki



// BotView.cpp : implementation file
//

#include "stdafx.h"
#include "ss.h"
#include "BotView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBotView

IMPLEMENT_DYNCREATE(CBotView, CHtmlView)

CBotView::CBotView()
{
	theApp.m_pBotView = this;
	//{{AFX_DATA_INIT(CBotView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

CBotView::~CBotView()
{
}

void CBotView::DoDataExchange(CDataExchange* pDX)
{
	CHtmlView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBotView)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBotView, CHtmlView)
	//{{AFX_MSG_MAP(CBotView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBotView diagnostics

#ifdef _DEBUG
void CBotView::AssertValid() const
{
	CHtmlView::AssertValid();
}

void CBotView::Dump(CDumpContext& dc) const
{
	CHtmlView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CBotView message handlers

void CBotView::OnInitialUpdate() 
{
	static int i = 0;
	if(i++)return;
	Navigate2(_T("about:blank"),NULL,NULL);
}

BOOL CBotView::PreCreateWindow(CREATESTRUCT& cs) 
{
	CHtmlView::PreCreateWindow(cs);
	cs.dwExStyle = 0;
	return TRUE;
}

// LeftView.cpp : implementation file
//

#include "stdafx.h"
#include "ss.h"
#include "LeftView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLeftView

IMPLEMENT_DYNCREATE(CLeftView, CTreeView)

CLeftView::CLeftView():m_tree(GetTreeCtrl())
{
	theApp.m_pLeftView = this;
}

CLeftView::~CLeftView()
{
}


BEGIN_MESSAGE_MAP(CLeftView, CTreeView)
	//{{AFX_MSG_MAP(CLeftView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLeftView drawing

void CLeftView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CLeftView diagnostics

#ifdef _DEBUG
void CLeftView::AssertValid() const
{
	CTreeView::AssertValid();
}

void CLeftView::Dump(CDumpContext& dc) const
{
	CTreeView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CLeftView message handlers

void CLeftView::OnInitialUpdate() 
{
	CTreeView::OnInitialUpdate();
	static int i = 0;
	if(i++)
		return;

	m_tree.ModifyStyle(0,TVS_HASLINES|TVS_HASBUTTONS|TVS_SHOWSELALWAYS|
		TVS_EDITLABELS|TVS_SHOWSELALWAYS |TVS_LINESATROOT);
	HTREEITEM hItem = m_tree.InsertItem("本地文件夹");
	m_tree.InsertItem("收件箱",hItem);	
	m_tree.InsertItem("发件箱",hItem);	
	m_tree.InsertItem("已发邮件",hItem);	
	m_tree.InsertItem("已删邮件",hItem);	
	m_tree.InsertItem("草稿",hItem);	
	m_tree.Expand(hItem,TVE_EXPAND);

}
// RightFrame.cpp : implementation file
//

#include "stdafx.h"
#include "ss.h"
#include "RightFrame.h"
#include "TopView.h"
#include "BotView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CRightFrame

IMPLEMENT_DYNCREATE(CRightFrame, CFrameWnd)

CRightFrame::CRightFrame()
{
}

CRightFrame::~CRightFrame()
{
}


BEGIN_MESSAGE_MAP(CRightFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CRightFrame)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRightFrame message handlers

BOOL CRightFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	m_split.CreateStatic(this,2,1);
	m_split.CreateView(0,0,RUNTIME_CLASS(CTopView),CSize(0,250),NULL);
	m_split.CreateView(1,0,RUNTIME_CLASS(CBotView),CSize(0,0),NULL);
	return TRUE;
}

BOOL CRightFrame::PreCreateWindow(CREATESTRUCT& cs) 
{
	CFrameWnd::PreCreateWindow(cs);	
	cs.dwExStyle = 0;
	return TRUE;
}

int CRightFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	DWORD dw = GetExStyle();
	
	return 0;
}
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "ss.h"
#include "LeftView.h"
#include "RightFrame.h"
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	ON_WM_CREATE()
	ON_WM_SETFOCUS()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
	
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
	cs.lpszClass = AfxRegisterWndClass(0);
	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnSetFocus(CWnd* pOldWnd)
{
	// forward focus to the view window
//	m_wndView.SetFocus();
}

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
	// let the view have first crack at the command
//	if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
//		return TRUE;

	// otherwise, do default handling
	return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}


BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	m_split.CreateStatic(this,1,2);
	m_split.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize(180,0),NULL);
	m_split.CreateView(0,1,RUNTIME_CLASS(CRightFrame),CSize(0,0),NULL);
	return TRUE;
}
// TopView.cpp : implementation file
//

#include "stdafx.h"
#include "ss.h"
#include "TopView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTopView

IMPLEMENT_DYNCREATE(CTopView, CListView)

CTopView::CTopView():m_list(GetListCtrl())
{
	theApp.m_pTopView = this;
}

CTopView::~CTopView()
{
}


BEGIN_MESSAGE_MAP(CTopView, CListView)
	//{{AFX_MSG_MAP(CTopView)
	ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnItemchanged)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTopView drawing

void CTopView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CTopView diagnostics

#ifdef _DEBUG
void CTopView::AssertValid() const
{
	CListView::AssertValid();
}

void CTopView::Dump(CDumpContext& dc) const
{
	CListView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CTopView message handlers

void CTopView::OnInitialUpdate() 
{
	CListView::OnInitialUpdate();
	static int i = 0;
	if(i++)return;
	DWORD dw = GetExStyle();
	m_list.ModifyStyle(0,LVS_REPORT|LVS_SHOWSELALWAYS);	
	m_list.InsertColumn(0,"发件人",0,180);
	m_list.InsertColumn(1,"主题",0,280);
	m_list.InsertColumn(2,"收件时间",0,180);
	m_list.InsertItem(0,"Microsoft 开发组");
}

BOOL CTopView::PreCreateWindow(CREATESTRUCT& cs) 
{
	CListView::PreCreateWindow(cs);
	cs.dwExStyle = 0;

	return TRUE;
}

void CTopView::OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* p = (NM_LISTVIEW*)pNMHDR;
	theApp.m_pBotView ->Navigate2("www.baojy.com");
	
	*pResult = 0;
}