?? maindlg.h
字號:
//-----------------------------------------------------------------------------
// (c) 2002 by Basler Vision Technologies
// Section: Vision Components
// Project: BCAM
// $Header: maindlg.h, 10, 24.01.2003 10:15:56, Happe, A.$
//-----------------------------------------------------------------------------
/**
\file maindlg.h
*
\brief declaration of main dialog of the BcamTopologyViewer
*
*
*/
//-----------------------------------------------------------------------------
// maindlg.h : interface of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINDLG_H__A70445E7_6325_4D08_851F_6C100428865A__INCLUDED_)
#define AFX_MAINDLG_H__A70445E7_6325_4D08_851F_6C100428865A__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <atlddx.h>
#include <htmlhelp.h>
// step 1 import the BcamTopologyView.tlb
#pragma warning(disable:4192) // Automatically excluding 'symbols' from tlb files.
#import "..\BcamTopologyView.tlb" no_namespace, named_guids
#pragma warning(default:4192) // Automatically excluding 'symbols' from tlb files.
#define fromDialog TRUE
#define toDialog FALSE
#define ID_TIMER1 2001
//------------------------------------------------------------------------------
// class CMainDlg
// Author: Margret Albrecht
// Date: 30.08.2002
//------------------------------------------------------------------------------
/**
* \brief main dialog of the BcamTopologyViewer
*
* the dialog shows a BcamTopologyView control and some command buttons to
* manipulate the control
*
*
* \see CBcamTopologyViewCtl
*
*/
//------------------------------------------------------------------------------
// step 4 if AppWiz70 has generated this file you have to correct the following
// line to inherit from CAxDialogImpl<CMainDlg> instead of CDialogImpl<CMainDlg>
class CMainDlg : public CAxDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>,
public CMessageFilter, public CIdleHandler,
public CWinDataExchange<CMainDlg>
{
public:
enum { IDD = IDD_MAINDLG };
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
return IsDialogMessage(pMsg);
}
virtual BOOL OnIdle()
{
return FALSE;
}
BEGIN_MSG_MAP(CMainDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
COMMAND_ID_HANDLER(IDOK, OnOK)
// step 5 remove the Cancel button from the dialog and remove the message handler here
// add message handlers for WM_CLOSE and WM_SIZE
MESSAGE_HANDLER(WM_CLOSE, OnClose)
MESSAGE_HANDLER(WM_SIZE, OnSize)
// step 6 add a buttons to reset the bus and to update and a check box
// for switching view of details and insert command handlers here
COMMAND_ID_HANDLER(IDUPDATE, OnUpdate)
COMMAND_HANDLER(IDC_RESETBUS, BN_CLICKED, OnClickedResetbus)
COMMAND_HANDLER(IDC_DETAILS, BN_CLICKED, OnClickedDetails)
COMMAND_HANDLER(IDC_STAY_TOP, BN_CLICKED, OnClickedStayTop)
COMMAND_HANDLER(IDC_BUTTON_HELP, BN_CLICKED, OnClickedHelp)
MESSAGE_HANDLER(WM_HELP, OnHelp)
END_MSG_MAP()
BEGIN_UPDATE_UI_MAP(CMainDlg)
END_UPDATE_UI_MAP()
//------------------------------------------------------------------------------
// LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// Author:
// Date: 30.08.2002
//------------------------------------------------------------------------------
/**
* initialize the dialog
*
* \return TRUE
*
*/
//------------------------------------------------------------------------------
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
// center the dialog on the screen
CenterWindow();
// set icons
HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
SetIcon(hIcon, TRUE);
HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
SetIcon(hIconSmall, FALSE);
// register object for message filtering and idle updates
CMessageLoop* pLoop = _Module.GetMessageLoop();
ATLASSERT(pLoop != NULL);
pLoop->AddMessageFilter(this);
pLoop->AddIdleHandler(this);
UIAddChildWindowContainer(m_hWnd);
// Step 3 Initialize m_TopologyWnd and m_ptrToplogyView
m_TopologyWnd = GetDlgItem( IDC_BCAMTOPOLOGYVIEWCTL );
// get the control
IBcamTopologyViewCtl * pTopologyView = NULL;
if (m_TopologyWnd != NULL)
{
CComPtr<IUnknown> spUnk;
HRESULT hr = AtlAxGetControl(m_TopologyWnd, &spUnk);
if (SUCCEEDED(hr))
{
hr = spUnk->QueryInterface(__uuidof(IBcamTopologyViewCtl), (void**)(&pTopologyView));
}
}
m_ptrToplogyView = pTopologyView;
m_CheckBoxDetails = 0;
m_CheckBoxStayTop = 1;
::SetWindowPos(m_hWnd,HWND_TOPMOST,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
DDX_Check(IDC_STAY_TOP, m_CheckBoxStayTop, toDialog);
return TRUE;
}
//------------------------------------------------------------------------------
// void MoveItems()
// Author:
// Date: 30.08.2002
//------------------------------------------------------------------------------
/**
* Resize the BcamTopolagyViewCtl and move the buttos, such that they are on the right side of the dialog window
*
*/
//------------------------------------------------------------------------------
void MoveItems()
{
RECT client; GetClientRect(&client);
if(::IsWindow(m_TopologyWnd))
{ // Fit control box to ClientSize of the Dialog leaving space for the buttons
::MoveWindow(m_TopologyWnd,client.left,client.top,client.right-client.left - 100,client.bottom-client.top,TRUE);
}
HWND ok = GetDlgItem( IDOK );
if(::IsWindow(ok))
{
::MoveWindow(ok,client.right-85,client.top +30,70,20,TRUE);
}
HWND update = GetDlgItem( IDUPDATE );
if(::IsWindow(update))
{
::MoveWindow(update,client.right-85,client.top +60,70,20,TRUE);
}
HWND busreset = GetDlgItem( IDC_RESETBUS );
if(::IsWindow(busreset))
{
::MoveWindow(busreset,client.right-85,client.top +90,70,20,TRUE);
}
HWND details = GetDlgItem( IDC_DETAILS );
if(::IsWindow(details))
{ long top = client.bottom - 120;
if (top < client.top + 120) top = client.top + 120;
::MoveWindow(details,client.right-85,top,70,20,TRUE);
}
HWND about = GetDlgItem( ID_APP_ABOUT );
if(::IsWindow(about))
{ long top = client.bottom - 100;
if (top < client.top + 150) top = client.top + 150;
::MoveWindow(about,client.right-85,top,70,20,TRUE);
}
HWND help = GetDlgItem( IDC_BUTTON_HELP );
if(::IsWindow(help))
{ long top = client.bottom - 70;
if (top < client.top + 150) top = client.top + 150;
::MoveWindow(help,client.right-85,top,70,20,TRUE);
}
HWND staytop = GetDlgItem( IDC_STAY_TOP );
if(::IsWindow(staytop))
{ long top = client.bottom - 40;
if (top < client.top + 150) top = client.top + 150;
::MoveWindow(staytop,client.right-85,top,80,20,TRUE);
}
}
//------------------------------------------------------------------------------
// LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// Author:
// Date: 30.08.2002
//------------------------------------------------------------------------------
/**
* show the about dialog
*
* \return 0
*
*/
//------------------------------------------------------------------------------
LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CAboutDlg dlg;
dlg.DoModal();
return 0;
}
//------------------------------------------------------------------------------
// LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// Author:
// Date: 30.08.2002
//------------------------------------------------------------------------------
/**
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -