//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 08/10/2003 // PROJECT: // SUBSYSTEM: // FILE: LgUICameraVideoWnd.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of LgUICameraVideoWnd.cpp //---------------------------------------------------------------------------- #include "stdafx.h" #include "LgUICameraVideoWnd.h" #include "LgUICameraEngine.h" #include "LgUICameraListWnd.h" #include "LgUICamera.h" CLgUICameraVideoWnd::CLgUICameraVideoWnd() { } CLgUICameraVideoWnd::~CLgUICameraVideoWnd() { DestroyWindow(); } BEGIN_MESSAGE_MAP(CLgUICameraVideoWnd, CWnd) //{{AFX_MSG_MAP(CLgUICameraVideoWnd) ON_WM_PAINT() ON_WM_LBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() BOOL CLgUICameraVideoWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight ) { 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, "", WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) ) return FALSE; return TRUE; } BOOL CLgUICameraVideoWnd::DestroyWindow() { CLgLink::Unlink(); CLgLink::Unlink(); return CWnd::DestroyWindow(); } void CLgUICameraVideoWnd::OnDraw( CDC *pDC ) { CRect rect; GetClientRect( &rect ); m_DIB.Draw( pDC->GetSafeHdc(), &rect ); } void CLgUICameraVideoWnd::OnPaint() { CPaintDC dc( this ); CLgUICamera *pCamera = GetVideoCamera(); if( pCamera ) pCamera->UICameraSampleGet(); CRect rect; GetClientRect( &rect ); dc.DrawText( "NO VIDEO", &rect, DT_SINGLELINE | DT_VCENTER | DT_CENTER); OnDraw( &dc ); } void CLgUICameraVideoWnd::OnLButtonDown( UINT nFlags, CPoint point ) { CLgUICameraListWnd *pListWnd = *this; if( pListWnd ) pListWnd->SetActiveVideo( this ); } void CLgUICameraVideoWnd::OnVideoStreamSample( CLgImageDIB *pDIB ) { m_DIB.Create( (LPBITMAPINFO)*pDIB, *pDIB ); CClientDC dc(this); OnDraw( &dc ); // ask for next sample CLgUICamera *pCamera = GetVideoCamera(); if( pCamera ) pCamera->UICameraSampleGet(); }