Пример #1
0
void OUGUIObject::UpdateGUI(float fDeltaTime, float fX, float fY)
{
    OUGUIObject* pControl;
    float fDX;
    float fDY;
    OUPOINT pt;

    //for(GUIMap::iterator it = m_pControlList.begin(); it != m_pControlList.end(); it++)
    //{
    //    pControl = it->second->m_pObject;
    //    
    //    pt = pControl->GetRelativePos();
    //    fDX = fX - pt.m_fX;
    //    fDY = fY - pt.m_fY;
    //    pControl->UpdateGUI(fDeltaTime, fDX, fDY);
    //}

    pt = GetRelativePos();
    for(GUIList::reverse_iterator it = m_pControlList.rbegin(); it != m_pControlList.rend(); it++)
    {
        pControl = (*it)->m_pObject;

        if(!pControl->GetShowMode()) continue;

        fDX = fX - pt.m_fX;
        fDY = fY - pt.m_fY;
        pControl->UpdateGUI(fDeltaTime, fDX, fDY);
    }

    /** 更新自身 */
    UpdateSelf(fDeltaTime, fX, fY);

    /** 查看焦点控件 */
    OUGUIObject* pFocus = OUGUIObject::GetFocusControl();
    //if(pFocus)
    //{
    //    /** 若自身或者有子控件是焦点,则将其移至父控件的链表尾 */
    //    if(this == pFocus || this->IsChild(pFocus))
    //    {
    //        if(m_pParent) m_pParent->MoveToTail(this);
    //    }
    //}
    for(GUIList::iterator it = m_pControlList.begin(); it != m_pControlList.end(); it++)
    {
        pControl = (*it)->m_pObject;
        if(pFocus == pControl || pControl->IsChild(pFocus))
        {
            MoveToTail(pControl);
            break;
        }
    }
}
Пример #2
0
void CPlaylist::SortByPath()
{
    CAtlArray<plsort2_t> a;
    a.SetCount(GetCount());
    POSITION pos = GetHeadPosition();
    for (int i = 0; pos; i++, GetNext(pos)) {
        a[i].str = GetAt(pos).m_fns.GetHead(), a[i].pos = pos;
    }
    qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
    for (size_t i = 0; i < a.GetCount(); i++) {
        MoveToTail(a[i].pos);
    }
}
Пример #3
0
void CPlaylist::Randomize()
{
    CAtlArray<plsort_t> a;
    a.SetCount(GetCount());
    srand((unsigned int)time(nullptr));
    POSITION pos = GetHeadPosition();
    for (int i = 0; pos; i++, GetNext(pos)) {
        a[i].n = rand(), a[i].pos = pos;
    }
    qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
    for (size_t i = 0; i < a.GetCount(); i++) {
        MoveToTail(a[i].pos);
    }
}
Пример #4
0
void CPlaylist::SortByName()
{
    CAtlArray<plsort2_t> a;
    a.SetCount(GetCount());
    POSITION pos = GetHeadPosition();
    for (int i = 0; pos; i++, GetNext(pos)) {
        CString& fn = GetAt(pos).m_fns.GetHead();
        a[i].str = (LPCTSTR)fn + std::max(fn.ReverseFind('/'), fn.ReverseFind('\\')) + 1;
        a[i].pos = pos;
    }
    qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
    for (size_t i = 0; i < a.GetCount(); i++) {
        MoveToTail(a[i].pos);
    }
}