Exemplo n.º 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);
			}
		}
}
Exemplo n.º 2
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;
    }
}