www.pudn.com > CraftFTP_gb.rar > ConnectBar.cpp
// ConnectBar.cpp : implementation file
//
#include "stdafx.h"
#include "globals.h"
#include "CraftFTP.h"
#include "ConnectBar.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CConnectBar dialog
const DWORD CConnectBar::m_nHelpIDs[] =
{
IDC_EDIT_HOSTNAME, HIDC_EDIT_HOSTNAME,
IDC_EDIT_USERNAME, HIDC_EDIT_USERNAME,
IDC_EDIT_PASSWORD, HIDC_EDIT_PASSWORD,
IDC_EDIT_FTPPORT, HIDC_EDIT_FTPPORT,
IDC_SPIN_FTPPORT, HIDC_SPIN_FTPPORT,
0 , 0
};
CConnectBar::CConnectBar()
{
//{{AFX_DATA_INIT(CConnectBar)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CConnectBar::DoDataExchange(CDataExchange* pDX)
{
CDialogBar::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConnectBar)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConnectBar, CDialogBar)
//{{AFX_MSG_MAP(CConnectBar)
ON_WM_HELPINFO()
ON_WM_CONTEXTMENU()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConnectBar message handlers
BOOL CConnectBar::Create(CWnd* pParentWnd, UINT nStyle, UINT nID)
{
return CDialogBar::Create(pParentWnd, IDD, nStyle, nID);
}
BOOL CConnectBar::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
{
if(pMsg->wParam == VK_TAB) //Tab¼ü
{
CWnd * pCtrl = GetFocus();
CWnd * pCtrl1 = GetDlgItem(IDC_EDIT_HOSTNAME);
CWnd * pCtrl2 = GetDlgItem(IDC_EDIT_USERNAME);
CWnd * pCtrl3 = GetDlgItem(IDC_EDIT_PASSWORD);
CWnd * pCtrl4 = GetDlgItem(IDC_EDIT_FTPPORT);
CWnd * pCtrl5 = GetDlgItem(IDOK);
if(pCtrl && pCtrl1 && pCtrl2 && pCtrl3 && pCtrl4 && pCtrl5)
{
if(pCtrl == pCtrl1)
pCtrl2->SetFocus();
else
if(pCtrl == pCtrl2)
pCtrl3->SetFocus();
else
if(pCtrl == pCtrl3)
pCtrl4->SetFocus();
else
if(pCtrl == pCtrl4)
{
if(pCtrl5->IsWindowEnabled())
pCtrl5->SetFocus();
else
pCtrl1->SetFocus();
}
else
if(pCtrl == pCtrl5)
pCtrl1->SetFocus();
return TRUE;
}
}
}
return CDialogBar::PreTranslateMessage(pMsg);
}
BOOL CConnectBar::OnHelpInfo(HELPINFO* pHelpInfo)
{
// TODO: Add your message handler code here and/or call default
CCraftFTPApp * theApp = (CCraftFTPApp*)AfxGetApp();
ASSERT_VALID(theApp);
::WinHelp((HWND)pHelpInfo->hItemHandle, theApp->m_szWinHelpFile,
HELP_WM_HELP, (DWORD)(LPVOID)GetHelpIDs());
return 0;
}
void CConnectBar::OnContextMenu(CWnd* pWnd, CPoint point)
{
// TODO: Add your message handler code here
CCraftFTPApp * theApp = (CCraftFTPApp*)AfxGetApp();
ASSERT_VALID(theApp);
::WinHelp((HWND)*pWnd, theApp->m_szWinHelpFile,
HELP_CONTEXTMENU, (DWORD)(LPVOID)GetHelpIDs());
}
int CConnectBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialogBar::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
SetFont(&globalData.fontRegular);
return 0;
}