当前位置: 首页>>代码示例>>C++>>正文


C++ CList::GetSelect方法代码示例

本文整理汇总了C++中CList::GetSelect方法的典型用法代码示例。如果您正苦于以下问题:C++ CList::GetSelect方法的具体用法?C++ CList::GetSelect怎么用?C++ CList::GetSelect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CList的用法示例。


在下文中一共展示了CList::GetSelect方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EventProcess

bool CScreenLevelList::EventProcess(const Event &event)
{
    CWindow* pw;
    CList* pl;
    CButton* pb;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return false;

    if ( event.type == pw->GetEventTypeClose() ||
         event.type == EVENT_INTERFACE_BACK    ||
         (event.type == EVENT_KEY_DOWN && event.GetData<KeyEventData>()->key == KEY(ESCAPE)) )
    {
        m_main->ChangePhase(PHASE_MAIN_MENU);
        return false;
    }

    switch( event.type )
    {
        case EVENT_INTERFACE_CHAP:
            pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_CHAP));
            if ( pl == nullptr )  break;
            m_chap[m_category] = pl->GetSelect();
            m_main->GetPlayerProfile()->SetSelectedChap(m_category, m_chap[m_category]+1);
            UpdateSceneList(m_chap[m_category], m_sel[m_category]);
            UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);
            break;

        case EVENT_INTERFACE_LIST:
            pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LIST));
            if ( pl == nullptr )  break;
            m_sel[m_category] = pl->GetSelect();
            m_main->GetPlayerProfile()->SetSelectedRank(m_category, m_sel[m_category]+1);
            UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);
            break;

        case EVENT_INTERFACE_SOLUCE:
            pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE));
            if ( pb == nullptr )  break;
            m_sceneSoluce = !m_sceneSoluce;
            pb->SetState(STATE_CHECK, m_sceneSoluce);
            break;

        case EVENT_INTERFACE_PLAY:
            m_main->SetLevel(m_category, m_chap[m_category]+1, m_sel[m_category]+1);
            m_main->ChangePhase(PHASE_SIMUL);
            break;

        case EVENT_INTERFACE_READ:
            m_main->ChangePhase(PHASE_READ);
            break;

        default:
            return true;
    }
    return false;
}
开发者ID:CHmSID,项目名称:colobot,代码行数:57,代码来源:screen_level_list.cpp

示例2: ChangeSetupButtons

void CScreenSetupGame::ChangeSetupButtons()
{
    CWindow*    pw;
    CSlider*    ps;
    CList*      pli;
    float       value;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;

    ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_INTERVAL));
    if ( ps != nullptr )
    {
        value = ps->GetVisibleValue();
        m_main->SetAutosaveInterval(static_cast<int>(round(value)));
    }

    ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_SLOTS));
    if ( ps != nullptr )
    {
        value = ps->GetVisibleValue();
        m_main->SetAutosaveSlots(static_cast<int>(round(value)));
    }

    pli = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LANGUAGE));
    if ( pli != nullptr )
    {
        m_settings->SetLanguage(static_cast<Language>(pli->GetSelect()-1));
        // TODO: A really ugly way to apply the change immediately
        m_main->ChangePhase(m_main->GetPhase());
    }
}
开发者ID:2asoft,项目名称:colobot,代码行数:32,代码来源:screen_setup_game.cpp

示例3: NameDelete

void CScreenPlayerSelect::NameDelete()
{
    CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if (pw == nullptr) return;
    CList* pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
    if (pl == nullptr) return;

    int sel = pl->GetSelect();
    if (sel == -1)
    {
        m_sound->Play(SOUND_TZOING);
        return;
    }

    std::string gamer = pl->GetItemName(sel);

    m_main->SelectPlayer(gamer);
    if (!m_main->GetPlayerProfile()->Delete())
    {
        m_sound->Play(SOUND_TZOING);
        return;
    }

    pl->SetSelect(-1);
    CEdit* pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
    if (pe != nullptr)
    {
        pe->SetText("");
    }

    ReadNameList();
    UpdateNameList();
    UpdateNameControl();
}
开发者ID:2asoft,项目名称:colobot,代码行数:34,代码来源:screen_player_select.cpp

示例4: NameSelect

void CScreenPlayerSelect::NameSelect()
{
    CWindow*    pw;
    CList*      pl;
    CEdit*      pe;
    std::string name;
    int         sel;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;
    pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
    if ( pl == nullptr )  return;
    pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
    if ( pe == nullptr )  return;

    name = pe->GetText(100);
    sel  = pl->GetSelect();

    if ( sel == -1 )
    {
        NameCreate();
    }
    else
    {
        m_main->SelectPlayer(pl->GetItemName(sel));
    }

    m_main->ChangePhase(PHASE_MAIN_MENU);
}
开发者ID:2asoft,项目名称:colobot,代码行数:29,代码来源:screen_player_select.cpp

示例5: UpdateNameEdit

void CScreenPlayerSelect::UpdateNameEdit()
{
    CWindow*    pw;
    CList*      pl;
    CEdit*      pe;
    std::string name;
    int         sel;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;
    pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
    if ( pl == nullptr )  return;
    pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
    if ( pe == nullptr )  return;

    sel = pl->GetSelect();
    if ( sel == -1 )
    {
        pe->SetText("");
        pe->SetCursor(0, 0);
    }
    else
    {
        name = pl->GetItemName(sel);
        pe->SetText(name.c_str());
        pe->SetCursor(name.length(), 0);
    }

    UpdateNameControl();
}
开发者ID:2asoft,项目名称:colobot,代码行数:30,代码来源:screen_player_select.cpp

示例6: IOWriteScene

// Writes the scene.
void CScreenIO::IOWriteScene()
{
    CWindow*    pw;
    CList*      pl;
    CEdit*      pe;
    char        info[100];

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;
    pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
    if ( pl == nullptr )  return;
    pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_IONAME));
    if ( pe == nullptr )  return;

    int sel = pl->GetSelect();
    if ( sel == -1 ) return;

    pe->GetText(info, 100);

    m_interface->DeleteControl(EVENT_WINDOW5);

    std::string dir;
    if (static_cast<unsigned int>(sel) >= m_saveList.size())
    {
        dir = m_main->GetPlayerProfile()->GetSaveFile("save"+clearName(info));
    }
    else
    {
        dir = m_saveList.at(sel);
    }

    m_main->GetPlayerProfile()->SaveScene(dir, info);
}
开发者ID:Grunaka,项目名称:colobot,代码行数:34,代码来源:screen_io.cpp

示例7: EventProcess

bool CScreenPlayerSelect::EventProcess(const Event &event)
{
    CWindow* pw;
    CList*   pl;
    std::string name;
    std::string gamer;

    switch( event.type )
    {
        case EVENT_KEY_DOWN:
        {
            auto data = event.GetData<KeyEventData>();
            if (data->key == KEY(RETURN) || data->key == KEY(ESCAPE))
            {
                NameSelect();
            }
            break;
        }

        case EVENT_INTERFACE_NEDIT:
            UpdateNameList();
            UpdateNameControl();
            break;

        case EVENT_INTERFACE_NLIST:
            UpdateNameEdit();
            break;

        case EVENT_INTERFACE_NOK:
            NameSelect();
            break;

        case EVENT_INTERFACE_PERSO:
            NameSelect();
            m_main->ChangePhase(PHASE_APPERANCE);
            break;

        case EVENT_INTERFACE_NDELETE:
            pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
            if ( pw == nullptr )  break;
            pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
            if ( pl == nullptr )  break;

            GetResource(RES_TEXT, RT_DIALOG_DELGAME, name);
            gamer = pl->GetItemName(pl->GetSelect());
            m_dialog->StartQuestion(
                StrUtils::Format(name.c_str(), gamer.c_str()), true, false, false,
                [&]()
                {
                    NameDelete();
                }
            );
            break;

        default:
            return true;
    }
    return false;
}
开发者ID:2asoft,项目名称:colobot,代码行数:59,代码来源:screen_player_select.cpp

示例8: IOReadScene

void CScreenIO::IOReadScene()
{
    CWindow*    pw;
    CList*      pl;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;
    pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
    if ( pl == nullptr )  return;

    int sel = pl->GetSelect();
    if (sel < 0 || sel >= static_cast<int>(m_saveList.size())) return;

    m_main->GetPlayerProfile()->LoadScene(m_saveList.at(sel));

    m_screenLevelList->SetSelection(m_main->GetLevelCategory(), m_main->GetLevelChap()-1, m_main->GetLevelRank()-1);
}
开发者ID:Grunaka,项目名称:colobot,代码行数:17,代码来源:screen_io.cpp

示例9: IOUpdateList

void CScreenIO::IOUpdateList(bool isWrite)
{
    CWindow*    pw;
    CList*      pl;
    CButton*    pb;
    CImage*     pi;
    int         sel, max;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;
    pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
    if ( pl == nullptr )  return;
    pi = static_cast<CImage*>(pw->SearchControl(EVENT_INTERFACE_IOIMAGE));
    if ( pi == nullptr )  return;

    sel = pl->GetSelect();
    max = pl->GetTotal();

    if (m_saveList.size() <= static_cast<unsigned int>(sel))
        return;

    std::string filename = m_saveList.at(sel) + "/screen.png";
    if ( isWrite )
    {
        if ( sel < max-1 )
        {
            pi->SetFilenameImage(filename.c_str());
        }
        else
        {
            pi->SetFilenameImage("");
        }

        pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_IODELETE));
        if ( pb != nullptr )
        {
            pb->SetState(STATE_ENABLE, sel < max-1);
        }
    }
    else
    {
        pi->SetFilenameImage(filename.c_str());
    }
}
开发者ID:Grunaka,项目名称:colobot,代码行数:44,代码来源:screen_io.cpp

示例10: IODeleteScene

void CScreenIO::IODeleteScene()
{
    CWindow* pw;
    CList*   pl;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;
    pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
    if ( pl == nullptr )  return;

    int sel = pl->GetSelect();
    if (sel < 0 || sel >= static_cast<int>(m_saveList.size())) return;

    if (!m_main->GetPlayerProfile()->DeleteScene(m_saveList.at(sel)))
    {
        m_sound->Play(SOUND_TZOING);
        return;
    }
}
开发者ID:Grunaka,项目名称:colobot,代码行数:19,代码来源:screen_io.cpp

示例11: UpdateNameControl

void CScreenPlayerSelect::UpdateNameControl()
{
    CWindow*    pw;
    CList*      pl;
    CButton*    pb;
    CEdit*      pe;
    std::string name;
    int         total, sel;

    pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
    if ( pw == nullptr )  return;
    pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
    if ( pl == nullptr )  return;
    pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
    if ( pe == nullptr )  return;

    total = pl->GetTotal();
    sel   = pl->GetSelect();
    name = pe->GetText(100);

    pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NDELETE));
    if ( pb != nullptr )
    {
        pb->SetState(STATE_ENABLE, total>0 && sel!=-1);
    }

    pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NOK));
    if ( pb != nullptr )
    {
        pb->SetState(STATE_ENABLE, !name.empty() || sel!=-1);
    }

    pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_PERSO));
    if ( pb != nullptr )
    {
        pb->SetState(STATE_ENABLE, !name.empty() || sel!=-1);
    }
}
开发者ID:2asoft,项目名称:colobot,代码行数:38,代码来源:screen_player_select.cpp


注:本文中的CList::GetSelect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。