|
// BridgeView.cpp : implementation of the CBridgeView class
//
#include "stdafx.h"
#include "Bridge.h"
#include "BridgeDoc.h"
#include "BridgeView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBridgeView
IMPLEMENT_DYNCREATE(CBridgeView, CScrollView)
BEGIN_MESSAGE_MAP(CBridgeView, CScrollView)
//{{AFX_MSG_MAP(CBridgeView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBridgeView construction/destruction
CBridgeView::CBridgeView()
{
// TODO: add construction code here
}
CBridgeView::~CBridgeView()
{
}
BOOL CBridgeView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CBridgeView drawing
void CBridgeView::OnDraw(CDC* pDC)
{
CBridgeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CImage * pImage = pDoc->m_pImage;
if( pImage != NULL )
{
CRect Rect( 0, 0, pImage->GetImageWidth(), pImage->GetImageHeight() );
pImage->Show( this, ( WPARAM ) & Rect );
}
}
/////////////////////////////////////////////////////////////////////////////
// CBridgeView diagnostics
#ifdef _DEBUG
void CBridgeView::AssertValid() const
{
CScrollView::AssertValid();
}
void CBridgeView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CBridgeDoc* CBridgeView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBridgeDoc)));
return (CBridgeDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CBridgeView message handlers
void CBridgeView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CSize sizeTotal( 1, 1 );
CImage * pImage = GetDocument()->m_pImage;
// Step 1 - Set scroll size
if( pImage != NULL )
{
sizeTotal.cx = pImage->GetImageWidth();
sizeTotal.cy = pImage->GetImageHeight();
}
SetScrollSizes( MM_TEXT, sizeTotal );
// Step 2 - Refresh view
Invalidate();
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Kulathu Sarma is working as a Technology Manager for GoldAvenue, a company based in Geneva, Switzerland and responsible for supporting e-business initiatives of GoldAvenue in B2B and B2C Sectors. He has been programming in C/C++ for 9 years and actively working on Patterns for the past 5 years.