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

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgUICameraMainWnd.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgUICameraMainWnd.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "LgUICameraMainWnd.h"
  16. #include "LgUICameraEngine.h"
  17. #include "..\LgAux.h"
  18. CLgUICameraMainWnd::CLgUICameraMainWnd()
  19. {
  20. }
  21. CLgUICameraMainWnd::~CLgUICameraMainWnd()
  22. {
  23. DestroyWindow();
  24. }
  25. BEGIN_MESSAGE_MAP(CLgUICameraMainWnd, CWnd)
  26. //{{AFX_MSG_MAP(CLgUICameraMainWnd)
  27. ON_WM_SIZE()
  28. //}}AFX_MSG_MAP
  29. END_MESSAGE_MAP()
  30. BOOL CLgUICameraMainWnd::Create( CWnd *pParentWnd, int x, int y, int nWidth, int nHeight )
  31. {
  32. DestroyWindow();
  33. CString strClassName = ::AfxRegisterWndClass( CS_HREDRAW | CS_VREDRAW, ::LoadCursor( NULL, IDC_ARROW ), (HBRUSH)COLOR_WINDOW, NULL );
  34. CRect rect( x, y, x + nWidth, y + nHeight );
  35. if( !CWnd::Create( strClassName, "", WS_CHILD | WS_DLGFRAME | WS_CLIPSIBLINGS, rect, pParentWnd, 0 ) )
  36. return FALSE;
  37. return TRUE;
  38. }
  39. BOOL CLgUICameraMainWnd::DestroyWindow()
  40. {
  41. CLgLink<CLgUICameraMainWnd,CLgUICameraVideoWnd>::Unlink();
  42. return CWnd::DestroyWindow();
  43. }
  44. void CLgUICameraMainWnd::OnSize(UINT nType, int cx, int cy)
  45. {
  46. CWnd::OnSize( nType, cx, cy );
  47. Reposition();
  48. }
  49. BOOL CLgUICameraMainWnd::Link( CLgLink<CLgUICameraVideoWnd,CLgUICameraMainWnd>* pVideoWnd )
  50. {
  51. if( !CLgLink<CLgUICameraMainWnd,CLgUICameraVideoWnd>::Link( pVideoWnd ) )
  52. return FALSE;
  53. pVideoWnd->GetThis()->SetParent( this );
  54. Reposition();
  55. pVideoWnd->GetThis()->ShowWindow( SW_SHOW );
  56. return TRUE;
  57. }
  58. void CLgUICameraMainWnd::Reposition()
  59. {
  60. CLgUICameraVideoWnd *pVideoWnd = *this;
  61. if( !pVideoWnd )
  62. return;
  63. if( !GetSafeHwnd() )
  64. return;
  65. CRect clientRect;
  66. GetClientRect( clientRect );
  67. CRect frameRect;
  68. FitRectWithAspect( &clientRect, &frameRect, 4.0/3.0 );
  69. pVideoWnd->MoveWindow( &frameRect, TRUE );
  70. }