|
|
//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright � 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: PropertySensorWnd.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of PropertySensorWnd.cpp
//----------------------------------------------------------------------------
// PropertySensorWnd.cpp : implementation file
//
#include "stdafx.h"
#include "chicago.h"
#include "PropertySensorWnd.h"
#include "..\..\LgLib\Version.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;#endif
/////////////////////////////////////////////////////////////////////////////
// CPropertySensorWnd
CPropertySensorWnd::CPropertySensorWnd(){ m_bOddUpdate = FALSE; m_pSensor = NULL; m_OSVersionInfo.dwOSVersionInfoSize = sizeof( m_OSVersionInfo ); ::GetVersionEx( &m_OSVersionInfo );
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::CPropertySensorWnd") );}
CPropertySensorWnd::~CPropertySensorWnd(){ LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::~CPropertySensorWnd") );}
BEGIN_MESSAGE_MAP(CPropertySensorWnd, CWnd) //{{AFX_MSG_MAP(CPropertySensorWnd)
ON_WM_PAINT() ON_WM_SIZE() //}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropertySensorWnd message handlers
BOOL CPropertySensorWnd::Create(CWnd *pParentWnd, int x, int y, int cx, int cy){ CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_CROSS ), (HBRUSH)GetSysColorBrush( COLOR_BTNFACE ), NULL ); CRect rect( x, y, x + cx, y + cy ); if( !CWnd::Create( strClassName, "", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD | WS_VISIBLE, rect, pParentWnd, 0 ) ) { LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CPropertySensorWnd::Create"), _T("CWnd::Create failed") ); return FALSE; } LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::Create"), _T("Succeeded") ); return TRUE;}
void CPropertySensorWnd::OnPaint() { LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::OnPaint"), _T("Started...") );
CPaintDC dc(this);
CRect rect; GetClientRect( &rect );
OnDraw( &m_MemoryDC );
dc.BitBlt( rect.left, rect.top, rect.Width(), rect.Height(), &m_MemoryDC, 0, 0, SRCCOPY );
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CPropertySensorWnd::OnPaint"), _T("Done") );}
void CPropertySensorWnd::OnDraw( CDC *pDC ){ CRect rect; GetClientRect( &rect ); pDC->FillSolidRect( &rect, RGB(0,0,0) ); pDC->DrawText( _T("Without visible representation"), &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );}
void CPropertySensorWnd::SetSensor(CSensor *pSensor){ // disconnect old one
if( m_pSensor ) m_pSensor->SetSensorPropertyWnd( NULL );
m_pSensor = pSensor;
// connect new one
if( m_pSensor ) m_pSensor->SetSensorPropertyWnd( this );
if( GetSafeHwnd() && IsWindowVisible() ) InvalidateRect( NULL, FALSE );}
void CPropertySensorWnd::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize( nType, cx, cy ); m_MemoryDC.Create( cx, cy, ::GetSysColor( COLOR_BTNFACE ) );}
void CPropertySensorWnd::UpdateInfo( BOOL bOddUpdate ){ m_bOddUpdate = bOddUpdate;
if( GetSafeHwnd() && IsWindowVisible() ) InvalidateRect( NULL, FALSE );}
void CPropertySensorWnd::FitRect( CRect ParentRect, CRect &ChildRect ){ FitRectWithAspect( &ParentRect, &ChildRect, 1.0 );}
void CPropertySensorWnd::OnUpdateSensorProperty(){
}
|