MainFrm.cpp
上传用户:yatsl7111
上传日期:2007-01-08
资源大小:1433k
文件大小:4k
- // MainFrm.cpp : implementation of the CMainFrame class
- //
- #include "stdafx.h"
- #include "ISeeExplorer.h"
- #include "MainFrm.h"
- #include "ISeeExplorerDoc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame
- IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
- BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- ON_COMMAND(ID_C_A_LICON, OnCALicon)
- ON_COMMAND(ID_C_B_SICON, OnCBSicon)
- ON_COMMAND(ID_C_C_LIST, OnCCList)
- ON_COMMAND(ID_C_D_REPORT, OnCDReport)
- ON_COMMAND(ID_C_E_THUM, OnCEThum)
- //}}AFX_MSG_MAP
- ON_MESSAGE( WM_ISEE_UPDATE_IMAGE , OnISeeUpdateImage )
- 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) ||
- !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
- {
- TRACE0("Failed to create main toolbarn");
- return -1; // fail to create
- }
- if (!m_wndTBIP.CreateEx(this) ||
- !m_wndTBIP.LoadToolBar(IDR_TB2_IP))
- {
- TRACE0("Failed to create IP toolbarn");
- return -1; // fail to create
- }
- if (!m_wndReBar.Create(this) ||
- !m_wndReBar.AddBar(&m_wndToolBar) ||
- !m_wndReBar.AddBar(&m_wndTBIP))
- {
- TRACE0("Failed to create rebarn");
- return -1; // fail to create
- }
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status barn");
- return -1; // fail to create
- }
- // TODO: Remove this if you don't want tool tips
- m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
- CBRS_TOOLTIPS | CBRS_FLYBY);
- m_wndTBIP.SetBarStyle(m_wndTBIP.GetBarStyle() |
- CBRS_TOOLTIPS | CBRS_FLYBY);
-
- m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
- m_wndTBIP.EnableDocking(CBRS_ALIGN_ANY);
- EnableDocking(CBRS_ALIGN_ANY);
- CISeeExplorerDoc *pDoc = (CISeeExplorerDoc*)((CCreateContext*)(lpCreateStruct->lpCreateParams))->m_pCurrentDoc;
- ASSERT((pDoc)&&(pDoc->IsKindOf(RUNTIME_CLASS(CISeeExplorerDoc))));
- if (pDoc->m_FileServer.CreateVisualComponents(this, (CCreateContext*)(lpCreateStruct->lpCreateParams)))
- {
- TRACE0("Failed to create file servern");
- return -1; // fail to create
- }
- m_pDoc = pDoc;
- 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
- 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::OnCALicon()
- {
- // TODO: Add your command handler code here
- m_pDoc->m_FileServer.SetListViewType( LVS_ICON );
-
- }
- void CMainFrame::OnCBSicon()
- {
- // TODO: Add your command handler code here
- m_pDoc->m_FileServer.SetListViewType( LVS_SMALLICON );
-
- }
- void CMainFrame::OnCCList()
- {
- // TODO: Add your command handler code here
- m_pDoc->m_FileServer.SetListViewType( LVS_LIST );
-
- }
- void CMainFrame::OnCDReport()
- {
- // TODO: Add your command handler code here
- m_pDoc->m_FileServer.SetListViewType( LVS_REPORT );
-
- }
- void CMainFrame::OnCEThum()
- {
- // TODO: Add your command handler code here
- m_pDoc->m_FileServer.SetListViewType( LVS_ICON );
-
- }
- void CMainFrame::OnISeeUpdateImage(WPARAM wParam, LPARAM lParam)
- {
- m_pDoc->SelChanged( (CReturnReceipt *) lParam );
- }