You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
108 lines
2.6 KiB
108 lines
2.6 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgUISiteSensorWnd.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgUISiteSensorWnd.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LgUISiteSensorWnd.h"
|
|
#include "LgUISiteSensor.h"
|
|
#include "LgUISiteEngine.h"
|
|
#include "LgUISiteCamera.h"
|
|
#include "..\UICamera\LgUICamera.h"
|
|
#include "..\UICamera\LgUICameraVideoWnd.h"
|
|
|
|
CLgUISiteSensorWnd::CLgUISiteSensorWnd()
|
|
{
|
|
}
|
|
|
|
CLgUISiteSensorWnd::~CLgUISiteSensorWnd()
|
|
{
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CLgUISiteSensorWnd, CWnd)
|
|
//{{AFX_MSG_MAP(CLgUISiteSensorWnd)
|
|
ON_WM_PAINT()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
BOOL CLgUISiteSensorWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight )
|
|
{
|
|
DestroyWindow();
|
|
|
|
CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_ARROW ), (HBRUSH)COLOR_WINDOW, NULL );
|
|
|
|
CRect rect( x, y, x + nWidth, y + nHeight );
|
|
|
|
if( !CWnd::Create( strClassName, NULL, WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) )
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgUISiteSensorWnd::DestroyWindow()
|
|
{
|
|
// Unlink sensor
|
|
CLgLink<CLgUISiteSensorWnd,CLgUISiteSensor>::Unlink();
|
|
return CWnd::DestroyWindow();
|
|
}
|
|
|
|
BOOL CLgUISiteSensorWnd::Link( CLgLink<CLgUISiteSensor, CLgUISiteSensorWnd> *pSensor )
|
|
{
|
|
// Unlink old sensor
|
|
CLgUISiteSensor *pOldSensor = *this;
|
|
if( pOldSensor && pOldSensor != pSensor )
|
|
Unlink( pOldSensor );
|
|
|
|
if( !CLgLink<CLgUISiteSensorWnd,CLgUISiteSensor>::Link( pSensor ) )
|
|
return FALSE;
|
|
|
|
// update drawing
|
|
if( GetSafeHwnd() )
|
|
InvalidateRect( NULL );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgUISiteSensorWnd::Unlink( CLgLink<CLgUISiteSensor, CLgUISiteSensorWnd> *pSensor )
|
|
{
|
|
if( !CLgLink<CLgUISiteSensorWnd,CLgUISiteSensor>::Unlink( pSensor ) )
|
|
return FALSE;
|
|
|
|
// update drawing
|
|
if( GetSafeHwnd() )
|
|
InvalidateRect( NULL );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CLgUISiteSensorWnd::OnDraw( CDC *pDC )
|
|
{
|
|
CRect rect;
|
|
GetClientRect( &rect );
|
|
|
|
pDC->Rectangle( &rect );
|
|
|
|
CLgUISiteSensor *pSensor = *this;
|
|
if( pSensor )
|
|
{
|
|
CString str;
|
|
str.Format( "Sensor %p", pSensor );
|
|
pDC->DrawText( str, &rect, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
|
|
}
|
|
}
|
|
|
|
void CLgUISiteSensorWnd::OnPaint()
|
|
{
|
|
CPaintDC dc( this );
|
|
|
|
OnDraw( &dc );
|
|
}
|