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


C++ CButton::ClearState方法代码示例

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


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

示例1: StartPauseMenu

void CMainDialog::StartPauseMenu()
{
    CWindow*    pw;
    CButton*    pb;
    Math::Point     pos, dim;
    std::string name;

    StartDialog(Math::Point(0.3f, 0.8f), true);
    m_dialogType = DialogType::PauseMenu;

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

    pos.x = 0.35f;
    pos.y = 0.60f;
    dim.x = 0.30f;
    dim.y = 0.30f;
    pw->CreateGroup(pos, dim, 5, EVENT_INTERFACE_GLINTl);  // orange corner
    pos.x = 0.35f;
    pos.y = 0.10f;
    dim.x = 0.30f;
    dim.y = 0.30f;
    pw->CreateGroup(pos, dim, 4, EVENT_INTERFACE_GLINTr);  // blue corner

    pos.x = 0.40f;
    dim.x = 0.20f;
    dim.y = 32.0f/480.0f;

    pos.y = 0.74f;
    pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_CANCEL);
    pb->SetState(STATE_SHADOW);
    GetResource(RES_TEXT, RT_DIALOG_CONTINUE, name);
    pb->SetName(name);

    if ( (m_main->GetLevelCategory() == LevelCategory::Missions    ||  // missions ?
         m_main->GetLevelCategory() == LevelCategory::FreeGame     ||  // free games?
         m_main->GetLevelCategory() == LevelCategory::CustomLevels ) &&   // user ?
         m_main->GetMissionType() != MISSION_CODE_BATTLE             )
    {
        pos.y = 0.62f;
        pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_WRITE);
        pb->SetState(STATE_SHADOW);
        if ( m_main->IOIsBusy() )  // current task?
        {
            pb->ClearState(STATE_ENABLE);
        }

        pos.y = 0.53f;
        pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_READ);
        pb->SetState(STATE_SHADOW);
        if ( !m_main->GetPlayerProfile()->HasAnySavedScene() )  // no file to read?
        {
            pb->ClearState(STATE_ENABLE);
        }
        pb->SetState(STATE_WARNING);
    }

    pos.y = 0.39f;
    pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_SETUP);
    pb->SetState(STATE_SHADOW);

    pos.y = 0.25f;
    pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_AGAIN);
    pb->SetState(STATE_SHADOW);
    pb->SetState(STATE_WARNING);

    pos.y = 0.16f;
    pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK);
    pb->SetState(STATE_SHADOW);
    pb->SetState(STATE_WARNING);
    GetResource(RES_TEXT, RT_DIALOG_ABORT, name);
    pb->SetName(name);
}
开发者ID:colobot,项目名称:colobot,代码行数:73,代码来源:maindialog.cpp

示例2: CreateInterface


//.........这里部分代码省略.........
         m_category != LevelCategory::CustomLevels ) // Don't show completion marks in free game, code battles and userlevels
    {
        pli->SetState(STATE_EXTEND);
    }
    pos = pli->GetPos();
    ddim = pli->GetDim();

    // Displays the summary:
    pos.x = ox+sx*3;
    pos.y = oy+sy*5.4f;
    ddim.x = dim.x*6.5f;
    ddim.y = dim.y*0.6f;
    GetResource(RES_TEXT, RT_PLAY_RESUME, name);
    pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL13, name);
    pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);

    pos.x = ox+sx*3;
    pos.y = oy+sy*3.6f;
    ddim.x = dim.x*13.4f;
    ddim.y = dim.y*1.9f;
    pe = pw->CreateEdit(pos, ddim, 0, EVENT_INTERFACE_RESUME);
    pe->SetState(STATE_SHADOW);
    pe->SetMaxChar(500);
    pe->SetEditCap(false);  // just to see
    pe->SetHighlightCap(false);

    // Button displays the "soluce":
    if ( m_category != LevelCategory::Exercises &&
         m_category != LevelCategory::FreeGame   )
    {
        pos.x = ox+sx*9.5f;
        pos.y = oy+sy*5.8f;
        ddim.x = dim.x*6.5f;
        ddim.y = dim.y*0.5f;
        pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOLUCE);
        pc->SetState(STATE_SHADOW);
        pc->ClearState(STATE_CHECK);
    }
    m_sceneSoluce = false;

    UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);

    if ( m_category == LevelCategory::Missions    ||
         m_category == LevelCategory::FreeGame    ||
         m_category == LevelCategory::CustomLevels )
    {
        pos.x = ox+sx*9.5f;
        pos.y = oy+sy*2;
        ddim.x = dim.x*3.7f;
        ddim.y = dim.y*1;
        pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PLAY);
        pb->SetState(STATE_SHADOW);
        if ( m_maxList == 0 )
        {
            pb->ClearState(STATE_ENABLE);
        }

        pos.x += dim.x*4.0f;
        ddim.x = dim.x*2.5f;
        pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_READ);
        pb->SetState(STATE_SHADOW);
        if ( !m_main->GetPlayerProfile()->HasAnySavedScene() )  // no file to read?
        {
            pb->ClearState(STATE_ENABLE);
        }
    }
    else
    {
        pos.x = ox+sx*9.5f;
        pos.y = oy+sy*2;
        ddim.x = dim.x*6.5f;
        ddim.y = dim.y*1;
        pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PLAY);
        pb->SetState(STATE_SHADOW);
        if ( m_maxList == 0 )
        {
            pb->ClearState(STATE_ENABLE);
        }
    }

    pos.x = ox+sx*3;
    ddim.x = dim.x*4;
    pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
    pb->SetState(STATE_SHADOW);

    SetBackground("textures/interface/interface.png");
    CreateVersionDisplay();

    if (m_category == LevelCategory::CustomLevels)
    {
        if(m_customLevelList.size() == 0)
        {
            m_main->ChangePhase(PHASE_MAIN_MENU);
            std::string title, text;
            GetResource(RES_TEXT, RT_DIALOG_NOUSRLVL_TITLE, title);
            GetResource(RES_TEXT, RT_DIALOG_NOUSRLVL_TEXT, text);
            m_dialog->StartInformation(title, title, text);
        }
    }
}
开发者ID:CHmSID,项目名称:colobot,代码行数:101,代码来源:screen_level_list.cpp


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