Old fashion design for PC-104
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.
 
 
 
 
 

91 lines
2.2 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: LgUICameraMainWnd.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of LgUICameraMainWnd.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "LgUICameraMainWnd.h"
#include "LgUICameraEngine.h"
#include "..\LgAux.h"
CLgUICameraMainWnd::CLgUICameraMainWnd()
{
}
CLgUICameraMainWnd::~CLgUICameraMainWnd()
{
DestroyWindow();
}
BEGIN_MESSAGE_MAP(CLgUICameraMainWnd, CWnd)
//{{AFX_MSG_MAP(CLgUICameraMainWnd)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CLgUICameraMainWnd::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, "", WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) )
return FALSE;
return TRUE;
}
BOOL CLgUICameraMainWnd::DestroyWindow()
{
CLgLink<CLgUICameraMainWnd,CLgUICameraVideoWnd>::Unlink();
return CWnd::DestroyWindow();
}
void CLgUICameraMainWnd::OnSize(UINT nType, int cx, int cy)
{
CWnd::OnSize( nType, cx, cy );
Reposition();
}
BOOL CLgUICameraMainWnd::Link( CLgLink<CLgUICameraVideoWnd,CLgUICameraMainWnd>* pVideoWnd )
{
if( !CLgLink<CLgUICameraMainWnd,CLgUICameraVideoWnd>::Link( pVideoWnd ) )
return FALSE;
pVideoWnd->GetThis()->SetParent( this );
Reposition();
pVideoWnd->GetThis()->ShowWindow( SW_SHOW );
return TRUE;
}
void CLgUICameraMainWnd::Reposition()
{
CLgUICameraVideoWnd *pVideoWnd = *this;
if( !pVideoWnd )
return;
if( !GetSafeHwnd() )
return;
CRect clientRect;
GetClientRect( clientRect );
CRect frameRect;
FitRectWithAspect( &clientRect, &frameRect, 4.0/3.0 );
pVideoWnd->MoveWindow( &frameRect, TRUE );
}