blob: 8776224299fc0526017de8aa892b601004a0fa37 (
plain)
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
|
#include "stdafx.h"
#include "optionsctrlimpl.h"
/*
* OptionsCtrlImpl::Check
*/
int OptionsCtrlImpl::Check::getStateImage()
{
return m_bEnabled ? (m_bChecked ? siCheckC : siCheckU) : (m_bChecked ? siCheckCG : siCheckUG);
}
bool OptionsCtrlImpl::Check::getChildEnable()
{
return
!m_bDisableChildsOnUncheck && m_bDisableChilds && m_bEnabled ||
m_bDisableChildsOnUncheck && m_bChecked && (!m_bDisableChilds || m_bEnabled);
}
void OptionsCtrlImpl::Check::updateItem()
{
m_pCtrl->setStateImage(m_hItem, m_bEnabled ? (m_bChecked ? siCheckC : siCheckU) : (m_bChecked ? siCheckCG : siCheckUG));
if (m_bDisableChilds || m_bDisableChildsOnUncheck)
enableChilds(getChildEnable());
}
OptionsCtrlImpl::Check::Check(OptionsCtrlImpl* pCtrl, Item* pParent, const wchar_t* szLabel, DWORD dwFlags, INT_PTR dwData) :
Item(pCtrl, itCheck, szLabel, dwFlags, dwData)
{
m_bChecked = bool_(dwFlags & OCF_CHECKED);
m_bDisableChildsOnUncheck = bool_(dwFlags & OCF_DISABLECHILDSONUNCHECK);
pCtrl->insertItem(pParent, this, szLabel, dwFlags, getStateImage());
if (pParent)
pParent->childAdded(this);
}
void OptionsCtrlImpl::Check::onToggle()
{
if (m_bEnabled) {
setChecked(!m_bChecked);
m_pCtrl->setModified(this);
}
}
void OptionsCtrlImpl::Check::childAdded(Item* pChild)
{
if (m_bDisableChilds || m_bDisableChildsOnUncheck)
pChild->setEnabled(getChildEnable());
}
|