DirFrm.cpp
上传用户:gzboli
上传日期:2013-04-10
资源大小:471k
文件大小:3k
- // DirFrm.cpp : implementation of the CDirFrame class
- //
- #include "stdafx.h"
- #include "QuickImage.h"
- #include "DirFrm.h"
- #include "DirView.h"
- #include "Quickview.h"
- #include "FileView.h"
- #include "MainFrm.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDirFrame
- IMPLEMENT_DYNCREATE(CDirFrame, CMDIChildWnd)
- BEGIN_MESSAGE_MAP(CDirFrame, CMDIChildWnd)
- //{{AFX_MSG_MAP(CDirFrame)
- ON_WM_SIZE()
- ON_WM_MDIACTIVATE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDirFrame construction/destruction
- CDirFrame::CDirFrame()
- {
- // TODO: add member initialization code here
- m_bReSize = false;
- }
- CDirFrame::~CDirFrame()
- {
- }
- BOOL CDirFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- // cs.style &= WS_CHILD | WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE | WS_MAXIMIZE;
- if( !CMDIChildWnd::PreCreateWindow(cs) )
- return FALSE;
- // cs.style &= WS_MAXIMIZE;
- ((CMDIFrameWnd*)AfxGetMainWnd())->MDIMaximize(this);
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CDirFrame diagnostics
- #ifdef _DEBUG
- void CDirFrame::AssertValid() const
- {
- CMDIChildWnd::AssertValid();
- }
- void CDirFrame::Dump(CDumpContext& dc) const
- {
- CMDIChildWnd::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CDirFrame message handlers
- BOOL CDirFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
- {
- CRect rc;
- GetClientRect(&rc);
- WORD wd=rc.Width() / 3;
- if(!m_wndSplitV.CreateStatic(this, 1, 2))
- return FALSE;
- m_wndSplitV.SetColumnInfo(0, wd, 0);
- if(!m_wndSplitH.CreateStatic(&m_wndSplitV, 2, 1, WS_CHILD|WS_VISIBLE,
- m_wndSplitV.IdFromRowCol(0, 0)))
- return FALSE;
- m_wndSplitH.SetRowInfo(1, wd, 0);
- m_wndSplitH.CreateView(0, 0, RUNTIME_CLASS(CDirView),
- CSize(wd, rc.Height() - wd), pContext);
- m_wndSplitH.CreateView(1, 0, RUNTIME_CLASS(CQuickView), CSize(wd, wd), pContext);
- m_wndSplitV.CreateView(0, 1, RUNTIME_CLASS(CFileView),
- CSize(rc.Width() - wd, 100), pContext);
- m_bReSize = true;
- return TRUE;
- return CMDIChildWnd::OnCreateClient(lpcs, pContext);
- }
- void CDirFrame::OnSize(UINT nType, int cx, int cy)
- {
- if(m_bReSize)
- {
- CRect rcQuickView;
- CWnd *pWnd = m_wndSplitH.GetPane(1, 0);
- ASSERT(IsWindow(pWnd->GetSafeHwnd()));
- pWnd->GetClientRect(&rcQuickView);
-
- m_wndSplitH.SetRowInfo(0, cy - rcQuickView.Height() - 10, 0);
- }
- CMDIChildWnd::OnSize(nType, cx, cy);
- }
- void CDirFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
- {
- CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
-
- // if(bActivate || NULL == pActivateWnd)
- // ((CMainFrame*)AfxGetMainWnd())->UpdateUIs(bActivate, pActivateWnd, pDeactivateWnd);
- }