-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseDialogSettingSimulateSource.cpp
More file actions
65 lines (52 loc) · 2.11 KB
/
BaseDialogSettingSimulateSource.cpp
File metadata and controls
65 lines (52 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "stdafx.h"
#include "BaseDialogSettingSimulateSource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
BaseDialogSettingSimulateSource::BaseDialogSettingSimulateSource(TakionMainWnd* mainWnd, TakionSettingTabDialog* parentTab, const char* label):
BaseDialogSettingSimulateSymbolMap(mainWnd, parentTab, label),
m_ComboBoxSource(false),
m_source(ST_MARKET_DATA)
{
m_ComboBoxSource.SetNoSelectionColor(m_visualBase->GetWarningColor());
m_bottomControl += vgap;
int sideWidth = 32;
int controlWidth = m_xc + m_firstColumnWidth + hgap;
AddComboBoxIndirect(nullptr, WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL, 0, m_xc, m_bottomControl, m_firstColumnWidth, 50, comboBoxSourceId);
AddStaticIndirect("Source", WS_VISIBLE | SS_NOPREFIX, 0, controlWidth, m_bottomControl + (comboBoxHeight - staticHeight) / 2, sideWidth, staticHeight, staticSourceId);
m_bottomControl += comboBoxHeight;
controlWidth += sideWidth;
if(m_maxControlWidth < controlWidth)m_maxControlWidth = controlWidth;
}
BOOL BaseDialogSettingSimulateSource::OnInitDialog()
{
m_source = ST_MARKET_DATA;
BOOL ret = BaseDialogSettingSimulateSymbolMap::OnInitDialog();
m_ComboBoxSource.AddString("MarketData");
m_ComboBoxSource.AddString("MarketSorter");
m_ComboBoxSource.SetCurSel(0);
OnSelchangeSource();
return ret;
}
void BaseDialogSettingSimulateSource::DoDataExchange(CDataExchange* pDX)
{
BaseDialogSettingSimulateSymbolMap::DoDataExchange(pDX);
DDX_Control(pDX, comboBoxSourceId, m_ComboBoxSource);
}
BEGIN_MESSAGE_MAP(BaseDialogSettingSimulateSource, BaseDialogSettingSimulateSymbolMap)
ON_CBN_SELCHANGE(comboBoxSourceId, OnSelchangeSource)
END_MESSAGE_MAP()
void BaseDialogSettingSimulateSource::OnSelchangeSource()
{
int sel = m_ComboBoxSource.GetCurSel();
if(sel < 0)sel = ST_MARKET_DATA;
// else if(sel >= ST_Count)sel = ST_Count - 1;
else if(sel >= 0xFF)sel = 0xFF;
const unsigned char source = GetValidSource((unsigned char)sel);
// const unsigned char source = (unsigned char)sel;
if(source != m_source)
{
m_source = source;
m_modified = true;
}
}