ChildFrm.cpp
上传用户:hngjqc
上传日期:2007-01-02
资源大小:25k
文件大小:3k
- // ChildFrm.cpp : implementation of the CChildFrame class
- //
- #include "stdafx.h"
- #include "OverWrite.h"
- #include "ChildFrm.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame
- static UINT Indicators[] =
- {
- ID_SEPARATOR, // status line indicator
- ID_SEPARATOR,
- ID_INDICATOR_OVERWRITE,
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM,
- ID_SEPARATOR,
- };
- IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
- BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
- //{{AFX_MSG_MAP(CChildFrame)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code !
- ON_UPDATE_COMMAND_UI(ID_INDICATOR_OVERWRITE, OnUpdateOverwrite)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame construction/destruction
- CChildFrame::CChildFrame()
- {
- m_bOverwrite = FALSE;
- }
- CChildFrame::~CChildFrame()
- {
- }
- BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- if( !CMDIChildWnd::PreCreateWindow(cs) )
- return FALSE;
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame diagnostics
- #ifdef _DEBUG
- void CChildFrame::AssertValid() const
- {
- CMDIChildWnd::AssertValid();
- }
- void CChildFrame::Dump(CDumpContext& dc) const
- {
- CMDIChildWnd::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame message handlers
- BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
- {
- if (!m_wndStatus.CreateEx(this,SBT_TOOLTIPS ,
- WS_CHILD | WS_VISIBLE | CBRS_BOTTOM ,IDS_STATUS))
- {
- TRACE0("Failed to create status bar in child framen");
- return CMDIChildWnd::OnCreateClient(lpcs, pContext);
- }
- m_wndStatus.SetIndicators(Indicators,sizeof(Indicators)/sizeof(UINT));
- // Setting the pane infos
- m_wndStatus.SetPaneInfo(0, m_wndStatus.GetItemID( 0 ),SBPS_STRETCH, NULL );
- m_wndStatus.SetPaneInfo(1, m_wndStatus.GetItemID( 1 ),SBPS_STRETCH, NULL );
- m_wndStatus.SetPaneInfo(2, m_wndStatus.GetItemID( 2 ),SBT_OWNERDRAW, 19 );
- m_wndStatus.SetPaneInfo(3, m_wndStatus.GetItemID( 3 ),SBT_OWNERDRAW, 18 );
- m_wndStatus.SetPaneInfo(4, m_wndStatus.GetItemID( 4 ),SBT_OWNERDRAW, 22 );
- m_wndStatus.SetPaneInfo(5, m_wndStatus.GetItemID( 5 ),SBPS_NOBORDERS, 14 );
-
- m_wndStatus.GetStatusBarCtrl().SetTipText(5, "Doubleclick for Info");
- m_wndStatus.SetStatusBarFlag(0);
-
- return CMDIChildWnd::OnCreateClient(lpcs, pContext);
- }
- //////////////////////////////////////////////////////////////////
- //
- // Method: OnUpdateOverwrite()
- //
- // Function: Updating the status line, if view is in overwrite mode
- //
- // Parameter: CCmdUI *pCmdUI
- //
- // Return: void
- //
- void CChildFrame::OnUpdateOverwrite(CCmdUI* /*pCmdUI */)
- {
- CRect cPaneRect;
- m_wndStatus.GetItemRect(2, &cPaneRect);
- m_wndStatus.InvalidateRect(cPaneRect, FALSE);
- }