TaxExpertView.cpp
上传用户:szcysw
上传日期:2013-03-11
资源大小:6752k
文件大小:5k
- // TaxExpertView.cpp : implementation of the CTaxExpertView class
- //
- #include "stdafx.h"
- #include "TaxExpert.h"
- #include "top1.h"
- #include "TaxExpertDoc.h"
- #include "TaxExpertView.h"
- #include "ContainerView.h"
- #include "FolderListView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CTaxExpertView
- IMPLEMENT_DYNCREATE(CTaxExpertView, CView)
- BEGIN_MESSAGE_MAP(CTaxExpertView, CView)
- //{{AFX_MSG_MAP(CTaxExpertView)
- ON_WM_CREATE()
- ON_WM_SIZE()
- //}}AFX_MSG_MAP
- // Standard printing commands
- ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
- ON_MESSAGE(FM_CLOSEFOLDERLISTVIEW, OnCloseFolderListView)
- ON_MESSAGE(CM_ONPUSHPINBUTTON, OnPushPinButton)
- ON_MESSAGE(CM_ONPUSHPINCANCEL, OnPushPinCancel)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CTaxExpertView construction/destruction
- CTaxExpertView::CTaxExpertView()
- {
-
- current_sel_main=_T("");
- current_sel_sub=_T("");
- // define the caption font.
- NONCLIENTMETRICS ncm;
- memset(&ncm, 0, sizeof(NONCLIENTMETRICS));
- ncm.cbSize = sizeof(NONCLIENTMETRICS);
- VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
- sizeof(NONCLIENTMETRICS), &ncm, 0));
- ncm.lfMessageFont.lfWeight = 700;
- ncm.lfMessageFont.lfHeight = 20;
- strcpy(ncm.lfMessageFont.lfFaceName, "Arial");
- m_CaptionFont.CreateFontIndirect(&ncm.lfMessageFont);
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
- CTaxExpertView::~CTaxExpertView()
- {
- }
- BOOL CTaxExpertView::PreCreateWindow(CREATESTRUCT& cs)
- {
- if( !CView::PreCreateWindow(cs) )
- return FALSE;
- cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
- cs.dwExStyle |= WS_EX_STATICEDGE;
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CTaxExpertView drawing
- void CTaxExpertView::OnDraw(CDC* pDC)
- {
- CTaxExpertDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- }
- void CTaxExpertView::OnInitialUpdate()
- {
- CView::OnInitialUpdate();
-
-
- // TODO: This code navigates to a popular spot on the web.
- // change the code to go where you'd like.
- }
- /////////////////////////////////////////////////////////////////////////////
- // CTaxExpertView printing
- /////////////////////////////////////////////////////////////////////////////
- // CTaxExpertView diagnostics
- #ifdef _DEBUG
- void CTaxExpertView::AssertValid() const
- {
- CView::AssertValid();
- }
- void CTaxExpertView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CTaxExpertDoc* CTaxExpertView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTaxExpertDoc)));
- return (CTaxExpertDoc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CTaxExpertView message handlers
- int CTaxExpertView::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CView::OnCreate(lpCreateStruct) == -1)
- return -1;
- if (!m_Caption.Create(this, _T("Inbox")))
- {
- TRACE0(_T("Failed to caption window.n"));
- return -1;
- }
- //设置标题栏背景色
- m_Caption.SetCaptionColors( ::GetSysColor(COLOR_BTNFACE),
- ::GetSysColor(COLOR_BTNSHADOW), ::GetSysColor(COLOR_WINDOW));
- //设置标题属性
- m_Caption.ModifyCaptionStyle( 4, &m_CaptionFont, NULL, m_hIcon);
- // 对CTaxExpertView进行切分
- CCreateContext *pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;
- // 将视图切分成两个窗口
- if (!m_wndSplitter.CreateStatic(this, 1, 2))
- {
- TRACE0("Failed to create splitter windown");
- return FALSE;
- }
- //第一列的窗口使用树形视图
- if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CFolderListView),
- CSize(175, 0), pContext))
- {
- m_wndSplitter.DestroyWindow();
- return -1;
- }
- // 对除树形树图的另一个窗口进行切分:两列
- if (!m_wndSplitter2.CreateStatic(&m_wndSplitter,
- 2, 1,
- WS_CHILD | WS_VISIBLE | WS_BORDER,
- m_wndSplitter.IdFromRowCol(0, 1)))
- {
- TRACE0("Failed to create nested splittern");
- return FALSE;
- }
- // 第二行窗口使用CTop:列表视图
- if (!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CTop),
- CSize(0, 200), pContext))
- {
- m_wndSplitter2.DestroyWindow();
- return FALSE;
- }
- // 第二行窗口使用CContainerView:显示HTML文档
- if (!m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CContainerView),
- CSize(0, 300), pContext))
- {
- m_wndSplitter2.DestroyWindow();
- return FALSE;
- }
- return 0;
- }
- void CTaxExpertView::OnSize(UINT nType, int cx, int cy)
- {
- CView::OnSize(nType, cx, cy);
-
- if( m_wndSplitter.GetSafeHwnd())
- {
- int nCX = ::GetSystemMetrics( SM_CXEDGE );
- int nCY = ::GetSystemMetrics( SM_CYEDGE );
-
- // move and grow view to clip border
- m_wndSplitter.MoveWindow(-nCX, 30, cx+(nCX*2), cy+(nCY*2)-34);
- }
- if( m_Caption.GetSafeHwnd()) {
- m_Caption.MoveWindow(0,0,cx,31);
- }
- }
- void CTaxExpertView::OnCloseFolderListView(UINT lParam, LONG wParam)
- {
- m_Caption.SetChildWindow( &CFolderListView::m_TreeCtrl, this );
- m_wndSplitter.HideColumn(0);
- }
- void CTaxExpertView::OnPushPinButton(UINT lParam, LONG wParam)
- {
- m_wndSplitter.ShowColumn();
- }
- void CTaxExpertView::OnPushPinCancel(UINT lParam, LONG wParam)
- {
- // TODO: Add your message handler code here and/or call default
-
- }
- CCJTreeCtrl* CTaxExpertView::GetFolderTreeCtrl()
- {
- return &CFolderListView::m_TreeCtrl;
- }