Skip to content

Commit

Permalink
Merge pull request qdtroy#60 from liuzhyun/master
Browse files Browse the repository at this point in the history
树控件添加子节点时修改判断条件以便继承CTreeNodeUI后可以复用
  • Loading branch information
qdtroy authored Oct 15, 2017
2 parents 2f7be92 + 6103f1e commit 7165b75
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions DuiLib/Control/UITreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace DuiLib
//************************************
bool CTreeNodeUI::Add( CControlUI* _pTreeNodeUI )
{
if (_tcsicmp(_pTreeNodeUI->GetClass(), _T("TreeNodeUI")) == 0)
if (NULL != static_cast<CTreeNodeUI*>(_pTreeNodeUI->GetInterface(_T("TreeNode"))))
return AddChildNode((CTreeNodeUI*)_pTreeNodeUI);

return CListContainerElementUI::Add(_pTreeNodeUI);
Expand Down Expand Up @@ -354,7 +354,7 @@ namespace DuiLib
if (!_pTreeNodeUI)
return FALSE;

if (_tcsicmp(_pTreeNodeUI->GetClass(), _T("TreeNodeUI")) != 0)
if (NULL == static_cast<CTreeNodeUI*>(_pTreeNodeUI->GetInterface(_T("TreeNode"))))
return FALSE;

_pTreeNodeUI = CalLocation(_pTreeNodeUI);
Expand Down Expand Up @@ -787,7 +787,7 @@ namespace DuiLib
bool CTreeViewUI::Add( CTreeNodeUI* pControl )
{
if (!pControl) return false;
if (_tcsicmp(pControl->GetClass(), _T("TreeNodeUI")) != 0) return false;
if (NULL == static_cast<CTreeNodeUI*>(pControl->GetInterface(_T("TreeNode")))) return false;

pControl->OnNotify += MakeDelegate(this,&CTreeViewUI::OnDBClickItem);
pControl->GetFolderButton()->OnNotify += MakeDelegate(this,&CTreeViewUI::OnFolderChanged);
Expand Down Expand Up @@ -822,7 +822,7 @@ namespace DuiLib
long CTreeViewUI::AddAt( CTreeNodeUI* pControl, int iIndex )
{
if (!pControl) return -1;
if (_tcsicmp(pControl->GetClass(), _T("TreeNodeUI")) != 0) return -1;
if (NULL == static_cast<CTreeNodeUI*>(pControl->GetInterface(_T("TreeNode")))) return -1;
pControl->OnNotify += MakeDelegate(this,&CTreeViewUI::OnDBClickItem);
pControl->GetFolderButton()->OnNotify += MakeDelegate(this,&CTreeViewUI::OnFolderChanged);
pControl->GetCheckBox()->OnNotify += MakeDelegate(this,&CTreeViewUI::OnCheckBoxChanged);
Expand Down

0 comments on commit 7165b75

Please sign in to comment.