Example #1
0
void CWndMoveOrPasteTo::Notify( TNotifyUI &msg )
{
		__super::Notify(msg);

		if (msg.sType == DUI_MSGTYPE_CLICK)
		{
			if (msg.pSender->GetName() == _T("btn_Cancel"))
			{
				Close(0);
			}
			else if (msg.pSender->GetName() == _T("btn_ok"))
			{
				CTreeViewUI *pTreeView = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("tree_file")));
				int nIndex = pTreeView->GetCurSel();

				CTreeNodeUI *pCurItem = static_cast<CTreeNodeUI*>(pTreeView->GetItemAt(nIndex));
				if (pCurItem == NULL)
				{
					CWndMessageBox *pMsgBox = new CWndMessageBox;
					pMsgBox->Create(m_hWnd, NULL, UI_WNDSTYLE_DIALOG, NULL);
					pMsgBox->SetTitleAndTip(_T("提示"), _T("请您选择一个目录!"));
					pMsgBox->CenterWindow();
					pMsgBox->ShowModal();
					return;
				}

				CFileHandle *pFileHandle = (CFileHandle*)(pCurItem->GetTag());

				m_WndMain->SetMoveOrCopyTo(pFileHandle);

				Close(1);
			}
		}
}
Example #2
0
	//************************************
	// 函数名称: RemoveAt
	// 返回类型: bool
	// 参数信息: int iIndex
	// 函数说明: iIndex 索引以及下的所有节点将被一并移除
	//************************************
	bool CTreeViewUI::RemoveAt( int iIndex )
	{
		CTreeNodeUI* pItem = (CTreeNodeUI*)GetItemAt(iIndex);
		if(pItem->GetCountChild())
			Remove(pItem);
		return true;
	}
Example #3
0
// 【建议】直接在播放列表里嵌入一个listbox控件来存放文件路径,这样操作起来就方便多了。
// 由于没有Demo可以参考,所以为了让大家知道treeview的更多用法,这里用treeview作为示例。
void CDuiFrameWnd::GetPlaylistInfo(int &iIndexTreeStart, int &iFileCount)
{
    iIndexTreeStart = -1;
    iFileCount      = 0;

    // 查找路径文件的起始节点,目前为nodePlaylist第3个子节点
    CTreeNodeUI *pNodeTmp; 
    CTreeNodeUI *pNodePlaylist = static_cast<CTreeNodeUI*>(m_PaintManager.FindControl(_T("nodePlaylist")));
    int iNodeTotal = pNodePlaylist->GetCountChild();
    int i;

    for(i = 0; i < iNodeTotal; i++)
    {
        pNodeTmp = pNodePlaylist->GetChildNode(i);

        if (U_TAG_PLAYLIST == pNodeTmp->GetTag())
        {
            break;
        }
    }

    // 未找到U_TAG_PLAYLIST的子节点,说明没有文件加入
    if (i == iNodeTotal)
    {      
        return;
    }

    // 已找到起始节点,开始找上一个文件或下一个文件
    CTreeViewUI* pTree = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("treePlaylist")));
    if (pTree)
    {
        iIndexTreeStart = pTree->GetItemIndex(pNodeTmp); 
        iFileCount      = iNodeTotal - i;
    }
}
Example #4
0
void MainDialog::Init()
{
    m_pCloseBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("closebtn")));
    m_pMaxBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("maxbtn")));
    m_pRestoreBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("restorebtn")));
    m_pMinBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("minbtn")));
	m_pClose = static_cast<CButtonUI*>(m_pm.FindControl(_T("close")));
	CTreeViewUI* pTree = static_cast<CTreeViewUI*>(m_pm.FindControl(_T("tree")));

	DWORD dwDrvs = GetLogicalDrives();
	for (int i=0; i <26; i++)
	{
		int n = 0x00000001;
		if (dwDrvs & (1 << i))
		{
			TCHAR buff[] = _T("A:\\");
			buff[0] = 'A' + i;
			CTreeNodeUI* pNode = new CTreeNodeUI;
			pNode->SetAttribute(_T("folderattr"),_T("padding=\"0,1,0,0\" width=\"36\" height=\"16\" normalimage=\"file='treeview_b.png' source='0,0,36,16'\" hotimage=\"file='treeview_b.png' source='36,0,72,16'\" selectedimage=\"file='treeview_a.png' source='0,0,36,16' selectedhotimage=\"file='treeview_a.png' source='36,0,72,16'\""));
			pTree->Add(pNode);
			pNode->SetItemText(buff);
			pNode->SetUserData(buff);
			
		}
	}
}
Example #5
0
	//************************************
	// 函数名称: SetSelItemHotTextColor
	// 返回类型: void
	// 参数信息: DWORD _dwSelHotItemTextColor
	// 函数说明: 
	//************************************
	void CTreeViewUI::SetSelItemHotTextColor( DWORD _dwSelHotItemTextColor )
	{
		for(int nIndex = 0;nIndex < GetCount();nIndex++){
			CTreeNodeUI* pTreeNode = static_cast<CTreeNodeUI*>(GetItemAt(nIndex));
			if(pTreeNode)
				pTreeNode->SetSelItemHotTextColor(_dwSelHotItemTextColor);
		}
	}
Example #6
0
bool CMusicListUI::DeleteRadio(CMusicListItemUI* item)
{
	CTreeNodeUI *pGroup = static_cast<CTreeNodeUI*>(m_pManager->FindSubControlByName(this,kRadioGroup));
	if ( pGroup == NULL )
		return false;

	return pGroup->Remove(item);
}
Example #7
0
bool CMusicListUI::DeleteRadioAll()
{
	CTreeNodeUI *pGroup = static_cast<CTreeNodeUI*>(m_pManager->FindSubControlByName(this,kRadioGroup));
	if ( pGroup == NULL )
		return false;

	pGroup->RemoveAll();
	return true;
}
Example #8
0
	//************************************
	// 函数名称: SetVisibleCheckBtn
	// 返回类型: void
	// 参数信息: bool _IsVisibled
	// 函数说明: 
	//************************************
	void CTreeViewUI::SetVisibleCheckBtn( bool _IsVisibled )
	{
		m_bVisibleCheckBtn = _IsVisibled;
		int nCount = this->GetCount();
		for(int nIndex = 0; nIndex < nCount; nIndex++) {
			CTreeNodeUI* pItem = static_cast<CTreeNodeUI*>(this->GetItemAt(nIndex));
			pItem->GetCheckBox()->SetVisible(m_bVisibleCheckBtn);
		}
	}
Example #9
0
	//************************************
	// 函数名称: SetItemMinWidth
	// 返回类型: void
	// 参数信息: UINT _ItemMinWidth
	// 函数说明: 
	//************************************
	void CTreeViewUI::SetItemMinWidth( UINT _ItemMinWidth )
	{
		m_uItemMinWidth = _ItemMinWidth;

		for(int nIndex = 0;nIndex < GetCount();nIndex++){
			CTreeNodeUI* pTreeNode = static_cast<CTreeNodeUI*>(GetItemAt(nIndex));
			if(pTreeNode)
				pTreeNode->SetMinWidth(GetItemMinWidth());
		}
		Invalidate();
	}
Example #10
0
	//************************************
	// 函数名称: OnFolderChanged
	// 返回类型: bool
	// 参数信息: void * param
	// 函数说明: 
	//************************************
	bool CTreeViewUI::OnFolderChanged( void* param )
	{
		TNotifyUI* pMsg = (TNotifyUI*)param;
		if(pMsg->sType == DUI_MSGTYPE_SELECTCHANGED) {
			CCheckBoxUI* pFolder = (CCheckBoxUI*)pMsg->pSender;
			CTreeNodeUI* pItem = (CTreeNodeUI*)pFolder->GetParent()->GetParent();
			pItem->SetVisibleTag(!pFolder->GetCheck());
			SetItemExpand(!pFolder->GetCheck(),pItem);
			return TRUE;
		}
		return TRUE;
	}
Example #11
0
	//************************************
	// 函数名称: OnFolderChanged
	// 返回类型: bool
	// 参数信息: void * param
	// 函数说明: 
	//************************************
	bool CTreeViewUI::OnFolderChanged( void* param )
	{
		TNotifyUI* pMsg = (TNotifyUI*)param;
		if(pMsg->sType == _T("selectchanged"))
		{
			CCheckBoxUI* pFolder = (CCheckBoxUI*)pMsg->pSender;
			CTreeNodeUI* pItem = (CTreeNodeUI*)pFolder->GetParent()->GetParent();
			pItem->SetVisibleTag(!pFolder->GetCheck());
			SetItemExpand(!pFolder->GetCheck(),pItem);
			return true;
		}
		return true;
	}
Example #12
0
void CWndMoveOrPasteTo::Init()
{
	CTreeViewUI *pTreeView = static_cast<CTreeViewUI*>(m_PaintManager.FindControl(_T("tree_file")));
	CTreeNodeUI *pRoot = static_cast<CTreeNodeUI*>(pTreeView->GetItemAt(0));

	CFileHandle *pFileRoot = CFileHandleManager::GetSingleInstance()->GetFileHandleTree();
	pRoot->SetAttribute(_T("checkboxattr"), _T("width=\"20\" height=\"20\" enabled=\"false\" bkimage=\"file='dir_icon_small' dest='4,2,20,18'\""));
	pRoot->SetTag((UINT_PTR)pFileRoot);

	EnumFileHandleTreeAddToTree(pRoot);

	pTreeView->ExpandItem(0,false);
}
Example #13
0
	//************************************
	// 函数名称: OnDBClickItem
	// 返回类型: bool
	// 参数信息: void * param
	// 函数说明:
	//************************************
	bool CTreeViewUI::OnDBClickItem( void* param )
	{
		TNotifyUI* pMsg = (TNotifyUI*)param;
		if(_tcsicmp(pMsg->sType, DUI_MSGTYPE_TREEITEMDBCLICK) == 0) {
			CTreeNodeUI* pItem		= static_cast<CTreeNodeUI*>(pMsg->pSender);
			CCheckBoxUI* pFolder	= pItem->GetFolderButton();
			pFolder->Selected(!pFolder->IsSelected());
			pItem->SetVisibleTag(!pFolder->GetCheck());
			SetItemExpand(!pFolder->GetCheck(),pItem);
			return TRUE;
		}
		return FALSE;
	}
Example #14
0
	//************************************
	// 函数名称: OnDBClickItem
	// 返回类型: bool
	// 参数信息: void * param
	// 函数说明:
	//************************************
	bool CTreeViewUI::OnDBClickItem( void* param )
	{
		TNotifyUI* pMsg = (TNotifyUI*)param;
		if(pMsg->sType == _T("itemdbclick"))
		{
			CTreeNodeUI* pItem		= static_cast<CTreeNodeUI*>(pMsg->pSender);
			CCheckBoxUI* pFolder	= pItem->GetFolderButton();
			pFolder->Selected(!pFolder->IsSelected());
			pItem->SetVisibleTag(!pFolder->GetCheck());
			SetItemExpand(!pFolder->GetCheck(),pItem);
			return true;
		}
		return false;
	}
Example #15
0
	//************************************
	// 函数名称: SetItemExpand
	// 返回类型: void
	// 参数信息: bool _Expanded
	// 参数信息: CTreeNodeUI * _TreeNode
	// 函数说明: 
	//************************************
	void CTreeViewUI::SetItemExpand( bool _Expanded,CTreeNodeUI* _TreeNode /*= NULL*/ )
	{
		if(_TreeNode)
		{
			if(_TreeNode->GetCountChild() > 0)
			{
				int nCount = _TreeNode->GetCountChild();
				for(int nIndex = 0;nIndex < nCount;nIndex++)
				{
					CTreeNodeUI* pItem = _TreeNode->GetChildNode(nIndex);
					pItem->SetVisible(_Expanded);

					if(pItem->GetCountChild() && !pItem->GetFolderButton()->IsSelected())
						SetItemExpand(_Expanded,pItem);
				}
			}
		}
		else
		{
			int nIndex = 0;
			int nCount = GetCount();
			while(nIndex < nCount)
			{
				CTreeNodeUI* pItem = (CTreeNodeUI*)GetItemAt(nIndex);

				pItem->SetVisible(_Expanded);

				if(pItem->GetCountChild() && !pItem->GetFolderButton()->IsSelected())
					SetItemExpand(_Expanded,pItem);

				nIndex++;
			}
		}
	}
Example #16
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, IsHasChild)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			lua_pushboolean(l,self->IsHasChild() ? 1: 0);
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::IsHasChild"));
			return 0;
		}
	}
Example #17
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, GetCountChild)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			lua_pushinteger(l,self->GetCountChild());
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::GetCountChild"));
			return 0;
		}
	}
Example #18
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, GetSelItemHotTextColor)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			LuaStatic::WriteRGBA2Lua(l, self->GetSelItemHotTextColor());
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::GetSelItemHotTextColor"));
			return 0;
		}
	}
Example #19
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, CheckBoxSelected)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			self->CheckBoxSelected(lua_toboolean(l,2) != 0);
			return 0;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::CheckBoxSelected"));
			return 0;
		}
	}
Example #20
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, GetVisibleTag)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			lua_pushboolean(l,self->GetVisibleTag() ? 1: 0);
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::GetVisibleTag"));
			return 0;
		}
	}
Example #21
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, SetVisibleCheckBtn)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			self->SetVisibleCheckBtn(lua_toboolean(l,2) != 0);
			return 0;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::SetVisibleCheckBtn"));
			return 0;
		}
	}
Example #22
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, GetTreeLevel)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));	
			long nLevel = self->GetTreeLevel();
			lua_pushnumber(l, (lua_Number)nLevel);
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::GetTreeLevel"));
			return 0;
		}
	}
Example #23
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, SetSelItemHotTextColor)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			DWORD dwCor = LuaStatic::ReadRGBAFromLua(l, 2);
			self->SetSelItemHotTextColor(dwCor);
			return 0;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::SetSelItemHotTextColor"));
			return 0;
		}
	}
Example #24
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, GetItemText)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			CDuiString pstrText = self->GetItemText();

			lua_op_t<CDuiString>::push_stack(l, pstrText);
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::GetItemText"));
			return 0;
		}
	}
Example #25
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, SetTreeView)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			CTreeViewUI* pTreeUI;
			pTreeUI = static_cast<CTreeViewUI*>(LuaStatic::CheckUserData(l, 2));
			self->SetTreeView(pTreeUI);
			return 0;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::SetTreeView"));
			return 0;
		}
	}
Example #26
0
	//************************************
	// 函数名称: RemoveAt
	// 返回类型: bool
	// 参数信息: CTreeNodeUI * _pTreeNodeUI
	// 函数说明: 
	//************************************
	bool CTreeNodeUI::RemoveAt( CTreeNodeUI* _pTreeNodeUI )
	{
		int nIndex = mTreeNodes.Find(_pTreeNodeUI);
		CTreeNodeUI* pNode = static_cast<CTreeNodeUI*>(mTreeNodes.GetAt(nIndex));
		if(pNode && pNode == _pTreeNodeUI)
		{
			while(pNode->IsHasChild())
				pNode->RemoveAt(static_cast<CTreeNodeUI*>(pNode->mTreeNodes.GetAt(0)));

			mTreeNodes.Remove(nIndex);

			if(pTreeView)
				pTreeView->Remove(_pTreeNodeUI);

			return true;
		}
		return false;
	}
Example #27
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, SetItemText)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			CDuiString pstrText;
			lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText);

			self->SetItemText(pstrText);
			return 0;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::SetItemText"));
			return 0;
		}
	}
Example #28
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, GetTreeView)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			CTreeViewUI* pTreeUI = self->GetTreeView();
			if (pTreeUI)
				LuaStatic::AddObject2Lua(l, pTreeUI, METATABLE_NAME(pTreeUI));
			else
				lua_pushnil(l);
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::GetTreeView"));
			return 0;
		}
	}
Example #29
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, GetChildNode)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			int iIndex = lua_tointeger(l,2);
			CTreeNodeUI* pTreeNodeUI = self->GetChildNode(iIndex);
			if (pTreeNodeUI)
				LuaStatic::AddObject2Lua(l, pTreeNodeUI, METATABLE_NAME(pTreeNodeUI));
			else
				lua_pushnil(l);
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::GetChildNode"));
			return 0;
		}
	}
Example #30
0
	IMPL_LUA_FUNC(LuaCTreeNodeUI, AddChildNode)
	{
		try
		{
			CTreeNodeUI* self;
			self = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 1));
			CTreeNodeUI* pTreeNodeUI;
			pTreeNodeUI = static_cast<CTreeNodeUI*>(LuaStatic::CheckUserData(l, 2));
			if(self->AddChildNode(pTreeNodeUI))
				lua_pushboolean(l,1);
			else
				lua_pushboolean(l,0);
			return 1;
		}
		catch (...)
		{
			DuiException(_T("LuaCTreeNodeUI::AddChildNode"));
			return 0;
		}
	}