// SpeedTestView.cpp : implementation of the CSpeedTestView class
//
#include "stdafx.h"
#include "SpeedTest.h"
#include "SpeedTestDoc.h"
#include "SpeedTestView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSpeedTestView
IMPLEMENT_DYNCREATE(CSpeedTestView, CView)
BEGIN_MESSAGE_MAP(CSpeedTestView, CView)
//{{AFX_MSG_MAP(CSpeedTestView)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
ON_COMMAND(ID_THEMES_NONE, OnThemesNone)
ON_UPDATE_COMMAND_UI(ID_THEMES_NONE, OnUpdateThemesNone)
ON_COMMAND(ID_THEMES_STYLE1, OnThemesStyle1)
ON_UPDATE_COMMAND_UI(ID_THEMES_STYLE1, OnUpdateThemesStyle1)
ON_COMMAND(ID_THEMES_STYLE2, OnThemesStyle2)
ON_UPDATE_COMMAND_UI(ID_THEMES_STYLE2, OnUpdateThemesStyle2)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSpeedTestView construction/destruction
CSpeedTestView::CSpeedTestView()
{
// TODO: add construction code here
}
CSpeedTestView::~CSpeedTestView()
{
}
BOOL CSpeedTestView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CSpeedTestView drawing
void CSpeedTestView::OnDraw(CDC* pDC)
{
CSpeedTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CSpeedTestView printing
BOOL CSpeedTestView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CSpeedTestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CSpeedTestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CSpeedTestView diagnostics
#ifdef _DEBUG
void CSpeedTestView::AssertValid() const
{
CView::AssertValid();
}
void CSpeedTestView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CSpeedTestDoc* CSpeedTestView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSpeedTestDoc)));
return (CSpeedTestDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSpeedTestView message handlers
int CSpeedTestView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
m_grid.CreateGrid( WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this, 323332 );
return 0;
}
void CSpeedTestView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
m_grid.MoveWindow( 0, 0, cx, cy );
}
BOOL CSpeedTestView::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return FALSE;
//return CView::OnEraseBkgnd(pDC);
}
void CSpeedTestView::OnThemesNone()
{
UGXPThemes::UseThemes(false);
Invalidate(FALSE);
}
void CSpeedTestView::OnUpdateThemesNone(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(!UGXPThemes::UseThemes());
}
void CSpeedTestView::OnThemesStyle1()
{
UGXPThemes::UseThemes(true);
UGXPThemes::SetGridStyle(Style1);
Invalidate(FALSE);
}
void CSpeedTestView::OnUpdateThemesStyle1(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(UGXPThemes::UseThemes() && UGXPThemes::GetGridStyle() == Style1);
}
void CSpeedTestView::OnThemesStyle2()
{
UGXPThemes::UseThemes(true);
UGXPThemes::SetGridStyle(Style2);
Invalidate(FALSE);
}
void CSpeedTestView::OnUpdateThemesStyle2(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck(UGXPThemes::UseThemes() && UGXPThemes::GetGridStyle() == Style2);
}