-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInputListBox.cpp
executable file
·59 lines (48 loc) · 1.25 KB
/
InputListBox.cpp
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
// InputListBox.cpp : implementation file
//
#include "stdafx.h"
#include "InputListBox.h"
#include "Widgets.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInputListBox
CInputListBox::CInputListBox()
{
}
CInputListBox::~CInputListBox()
{
}
BEGIN_MESSAGE_MAP(CInputListBox, CListBox)
//{{AFX_MSG_MAP(CInputListBox)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CInputListBox::Add(const CInput* pInput)
{
assert(this);
int idx = AddString(pInput->Name().c_str());
if(idx != LB_ERR && idx != LB_ERRSPACE)
SetItemDataPtr(idx,const_cast<CInput*>(pInput));
}
void CInputListBox::Update(const CWidget& widget)
{
assert(this);
ResetContent();
for(int i=0; i<widget.InputCount(); ++i)
Add(&widget.Input(i));
}
const CInput* CInputListBox::Selected()
{
assert(this);
int idx = GetCurSel();
if(idx != LB_ERR)
return static_cast<CInput*>(GetItemDataPtr(idx));
else
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CInputListBox message handlers