OUTPUTREPORT.CPP
上传用户:lvjun8202
上传日期:2013-04-30
资源大小:797k
文件大小:3k
- // OutputReport.cpp : implementation file
- //
- #include "stdafx.h"
- #include "oam.h"
- #include "OutputReport.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // COutputReport
- COutputReport::COutputReport()
- {
- m_nHasAlert = 0;
- m_nSplashCnt = 0;
- m_nChildID = 0;
- }
- COutputReport::~COutputReport()
- {
- }
- BEGIN_MESSAGE_MAP(COutputReport, TOutputWnd)
- //{{AFX_MSG_MAP(COutputReport)
- ON_WM_CONTEXTMENU()
- ON_COMMAND(ID_CLEAR_REPORT, OnClear)
- ON_COMMAND(ID_HIDE_REPORT, OnHideReport)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // COutputReport message handlers
- void COutputReport::UpdateHScroll()
- {
- if( m_bWordWrap ) return; // No need for word-wrapped output windows
- CRect clientRc; GetClientRect( &clientRc );
- int nMax = m_nMaxWidth - clientRc.Width();
- // m_wndSheet.ShowScrollBar(bShow);
- // if (bShow)
- // {
- // CRect rect; GetClientRect(rect);
- // m_wndSheet.GetScrollBar().SetScrollRange(0, SumWidthColumns() - rect.Width());
- // }
- if( nMax <= 0 )
- //InActivateHScrollBar
- {
- m_nXOffset = 0;
- }
- else
- //ActivateHScrollBar
- {
- }
- }
- int COutputReport::GetHScrollRange()
- {
- if( m_bWordWrap ) return 0; // No need for word-wrapped output windows
- CRect clientRc; GetClientRect( &clientRc );
- int nMax = m_nMaxWidth - clientRc.Width();
- if( nMax <= 0 )
- m_nXOffset = 0;
- return max(0,nMax);
- }
- void COutputReport::OnContextMenu(CWnd* pWnd, CPoint point)
- {
- // TODO: Add your message handler code here
- // TODO: Add your message handler code here
- if (point.x == -1 && point.y == -1){
- //keystroke invocation
- CRect rect;
- GetClientRect(rect);
- ClientToScreen(rect);
-
- point = rect.TopLeft();
- point.Offset(5, 5);
- }
-
- CMenu menu;
- VERIFY(menu.LoadMenu(IDR_MENU_LISTBOX));
-
- CMenu* pPopup = menu.GetSubMenu(0);
- ASSERT(pPopup != NULL);
- CWnd* pWndPopupOwner = this;
-
- // while (pWndPopupOwner->GetStyle() & WS_CHILD)
- // pWndPopupOwner = pWndPopupOwner->GetParent();
-
- pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
- pWndPopupOwner);
-
- }
- void COutputReport::OnClear()
- {
- // TODO: Add your command handler code here
- ClearBuffer();
- }
- void COutputReport::OnHideReport()
- {
- // TODO: Add your command handler code here
- CWnd * pWnd = AfxGetMainWnd();
- if(pWnd)
- pWnd->SendMessage(WM_COMMAND,ID_VIEW_OUTPUT,0);
- }