示例#1
0
void CPlayerPlaylistBar::DropItemOnList()
{
    m_ptDropPoint.y += 10;
    m_nDropIndex = m_list.HitTest(CPoint(10, m_ptDropPoint.y));

    TCHAR szLabel[_MAX_PATH];
    LV_ITEM lvi;
    ZeroMemory(&lvi, sizeof(LV_ITEM));
    lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
    lvi.stateMask = LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED;
    lvi.pszText = szLabel;
    lvi.iItem = m_nDragIndex;
    lvi.cchTextMax = _MAX_PATH;
    m_list.GetItem(&lvi);

    if (m_nDropIndex < 0) {
        m_nDropIndex = m_list.GetItemCount();
    }
    lvi.iItem = m_nDropIndex;
    m_list.InsertItem(&lvi);

    CHeaderCtrl* pHeader = (CHeaderCtrl*)m_list.GetDlgItem(0);
    int nColumnCount = pHeader->GetItemCount();
    lvi.mask = LVIF_TEXT;
    lvi.iItem = m_nDropIndex;
    //INDEX OF DRAGGED ITEM WILL CHANGE IF ITEM IS DROPPED ABOVE ITSELF
    if (m_nDropIndex < m_nDragIndex) {
        m_nDragIndex++;
    }
    for (int col = 1; col < nColumnCount; col++) {
        _tcscpy_s(lvi.pszText, _MAX_PATH, (LPCTSTR)(m_list.GetItemText(m_nDragIndex, col)));
        lvi.iSubItem = col;
        m_list.SetItem(&lvi);
    }

    m_list.DeleteItem(m_nDragIndex);

    CList<CPlaylistItem> tmp;
    UINT id = (UINT) - 1;
    for (int i = 0; i < m_list.GetItemCount(); i++) {
        POSITION pos = (POSITION)m_list.GetItemData(i);
        CPlaylistItem& pli = m_pl.GetAt(pos);
        tmp.AddTail(pli);
        if (pos == m_pl.GetPos()) {
            id = pli.m_id;
        }
    }
    m_pl.RemoveAll();
    POSITION pos = tmp.GetHeadPosition();
    for (int i = 0; pos; i++) {
        CPlaylistItem& pli = tmp.GetNext(pos);
        m_pl.AddTail(pli);
        if (pli.m_id == id) {
            m_pl.SetPos(m_pl.GetTailPosition());
        }
        m_list.SetItemData(i, (DWORD_PTR)m_pl.GetTailPosition());
    }

    ResizeListColumn();
}
示例#2
0
void CPlayerPlaylistBar::OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult)
{
    LPNMLVKEYDOWN pLVKeyDown = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);

    *pResult = FALSE;

    CList<int> items;
    POSITION pos = m_list.GetFirstSelectedItemPosition();
    while (pos) {
        items.AddHead(m_list.GetNextSelectedItem(pos));
    }

    if (pLVKeyDown->wVKey == VK_DELETE && items.GetCount() > 0) {
        pos = items.GetHeadPosition();
        while (pos) {
            int i = items.GetNext(pos);
            if (m_pl.RemoveAt(FindPos(i))) {
                ((CMainFrame*)AfxGetMainWnd())->CloseMedia();
            }
            m_list.DeleteItem(i);
        }

        m_list.SetItemState(-1, 0, LVIS_SELECTED);
        m_list.SetItemState(
            max(min(items.GetTail(), m_list.GetItemCount() - 1), 0),
            LVIS_SELECTED, LVIS_SELECTED);

        ResizeListColumn();

        *pResult = TRUE;
    } else if (pLVKeyDown->wVKey == VK_SPACE && items.GetCount() == 1) {
        m_pl.SetPos(FindPos(items.GetHead()));

        ((CMainFrame*)AfxGetMainWnd())->OpenCurPlaylistItem();

        AfxGetMainWnd()->SetFocus();

        *pResult = TRUE;
    }
}
示例#3
0
void CPlayerPlaylistBar::OnSize(UINT nType, int cx, int cy)
{
    CSizingControlBarG::OnSize(nType, cx, cy);

    ResizeListColumn();
}
示例#4
0
void CPlayerPlaylistBar::Refresh()
{
    SetupList();
    ResizeListColumn();
}
示例#5
0
void CWipeFree::OnSize(UINT nType, int cx, int cy) 
{
	CRect		rect;
	int			nWidth,nButtonHigh,nDelAndCle;
	int			nLabelR;
	CPropertyPage::OnSize(nType, cx, cy);
	
	if(m_WipeParList)
	{
		m_WipeParList.GetWindowRect (&rect);
		ScreenToClient (&rect);
		rect.right = cx - rect.left;
		nWidth	   = rect.left;
		m_WipeParList.MoveWindow (rect);
		ResizeListColumn(m_WipeParList.m_hWnd);
	}

	if(m_LabelMothed)
	{
		m_LabelMothed.GetClientRect(&rect);
		rect.left  = nWidth;
		rect.right = nWidth+rect.right;
		nLabelR	   = rect.right;
		rect.top   = cy - (rect.bottom + nWidth);
		rect.bottom= cy - nWidth;
		m_LabelMothed.MoveWindow (rect);
	}

	if(m_SelMothed)
	{
		m_SelMothed.GetClientRect(&rect);
		rect.left  = nLabelR + 1;
		rect.right = rect.left+rect.right;
		rect.top   = cy - (rect.bottom + nWidth) + 3;
		rect.bottom= cy - nWidth +3;
		m_SelMothed.MoveWindow (rect);
	}

	if(m_ButtonClear)
	{
		m_ButtonClear.GetClientRect(&rect);
		rect.left  = cx - (rect.right + nWidth );
		rect.right = cx - nWidth;
		rect.top   = cy - (rect.bottom + nWidth);
		rect.bottom= cy - nWidth;
		m_ButtonClear.MoveWindow (rect);
	}
	
	if(m_ButtonWipe)
	{
		nDelAndCle = 3*rect.Width ()/2;
		rect.left  -= nDelAndCle;
		rect.right -= nDelAndCle;
		m_ButtonWipe.MoveWindow (rect);
		nButtonHigh = rect.Height ();
	}

	if(m_BeepOff)
	{
		rect.left  -= nDelAndCle;
		rect.right -= nDelAndCle;
		m_BeepOff.MoveWindow (rect);
	}

	if(m_WipeParList)
	{
		m_WipeParList.GetWindowRect (&rect);
		ScreenToClient (&rect);
		rect.bottom = cy - nWidth - 2*nButtonHigh;
		m_WipeParList.MoveWindow (rect);
	}
	
}
示例#6
0
void CEditListEditor::OnSize(UINT nType, int cx, int cy)
{
    __super::OnSize(nType, cx, cy);

    ResizeListColumn();
}
示例#7
0
void CEditListEditor::OnSize(UINT nType, int cx, int cy)
{
    CSizingControlBarG::OnSize(nType, cx, cy);

    ResizeListColumn();
}