Files
HLStock/StockServer/DialogBarUtil.cpp
2013-07-20 23:20:34 +00:00

87 lines
2.1 KiB
C++

// DialogBarUtil.cpp: implementation of the MyDialogBar class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "StockServer.h"
#include "DialogBarUtil.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#define REBAR_HEIGTH 27
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CMyDialogBar
CDialogBarUtil::CDialogBarUtil()
{
m_pApp = (CStockServerApp*)AfxGetApp();
}
CDialogBarUtil::~CDialogBarUtil()
{
}
BEGIN_MESSAGE_MAP(CDialogBarUtil, CDialogBarEx)
//{{AFX_MSG_MAP(CDialogBarUtil)
ON_WM_MOVE()
ON_WM_DESTROY()
//}}AFX_MSG_MAP
// ON_BN_CLICKED(IDC_CHECK_CLIENTS, OnCheckClients)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialogBarUtil message handlers
void CDialogBarUtil::DoDataExchange(CDataExchange* pDX)
{
// TODO: Add your specialized code here and/or call the base class
DDX_Control(pDX, IDC_EDIT_PORT, m_edtPort);
DDX_Control(pDX, IDC_SPIN_PORT, m_ctrlSpinPort);
CDialogBarEx::DoDataExchange(pDX);
}
void CDialogBarUtil::OnInitDialogBar()
{
m_ctrlSpinPort.SetRange32(DEFAULT_MIN_PORT_NUMBER, DEFAULT_MAX_PORT_NUMBER);
m_ctrlSpinPort.SetPos(m_pApp->GetProfileInt("Settings", "PortNumber", DEFAULT_MIN_PORT_NUMBER));
}
void CDialogBarUtil::OnMove(int x, int y)
{
CDialogBarEx::OnMove(x, y);
CRect rc;
GetClientRect(rc);
SetWindowPos(NULL, 0, 0, rc.Width()-3, REBAR_HEIGTH, SWP_NOMOVE);
}
void CDialogBarUtil::OnDestroy()
{
CDialogBarEx::OnDestroy();
m_pApp->WriteProfileInt("Settings", "PortNumber", m_ctrlSpinPort.GetPos());
}
int CDialogBarUtil::GetPort()
{
return m_ctrlSpinPort.GetPos();
}
void CDialogBarUtil::BlockConrols(BOOL bNotEnable)
{
m_edtPort.EnableWindow(!bNotEnable);
m_ctrlSpinPort.EnableWindow(!bNotEnable);
}