Exemplo n.º 1
0
void CMainDialog::StartInformation(const std::string& title, const std::string& text, const std::string& details, bool warning, bool fireParticles, DialogCallback ok)
{
    CWindow*    pw;
    CButton*    pb;
    CLabel*     pl;
    Math::Point pos, dim, ddim;
    std::string name;

    dim.x = 0.7f;
    dim.y = 0.3f;

    StartDialog(dim, fireParticles);
    m_dialogType = DialogType::Question;
    m_callbackYes = ok;

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

    if(!title.empty())
        pw->SetName(title);

    pos.x = 0.00f;
    pos.y = 0.50f;
    ddim.x = 1.00f;
    ddim.y = 0.05f;
    pl = pw->CreateLabel(pos, ddim, -1, EVENT_DIALOG_LABEL, text);
    pl->SetFontType(Gfx::FONT_COMMON_BOLD);
    //TODO: Add \n support in CLabel
    pos.y -= ddim.y;
    pl = pw->CreateLabel(pos, ddim, -1, EVENT_DIALOG_LABEL1, details);
    pl->SetFontSize(10.0f);

    pos.x  = 0.50f-0.075f;
    pos.y  = 0.50f-dim.y/2.0f+0.03f;
    ddim.x = 0.15f;
    ddim.y = 0.06f;
    pb = pw->CreateButton(pos, ddim, -1, EVENT_DIALOG_OK);
    pb->SetState(STATE_SHADOW);
    GetResource(RES_TEXT, RT_DIALOG_OK, name);
    pb->SetName(name);
    if (warning)
    {
        pb->SetState(STATE_WARNING);
    }
}
Exemplo n.º 2
0
void CScreenQuit::CreateInterface()
{
    CWindow*        pw;
    CEdit*          pe;
    CLabel*         pl;
    CButton*        pb;
    Math::Point     pos, ddim;
    std::string     name;

    pos.x  = 0.0f;
    pos.y  = 0.0f;
    ddim.x = 0.0f;
    ddim.y = 0.0f;
    pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);

    pos.x  =  80.0f/640.0f;
    pos.y  = 190.0f/480.0f;
    ddim.x = 490.0f/640.0f;
    ddim.y = 160.0f/480.0f;
    pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
    pe->SetGenericMode(true);
    pe->SetEditCap(false);
    pe->SetHighlightCap(false);
    pe->SetFontType(Gfx::FONT_STUDIO);
    pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
    pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt"));

    pos.x  =  40.0f/640.0f;
    pos.y  =  83.0f/480.0f;
    ddim.x = 246.0f/640.0f;
    ddim.y =  16.0f/480.0f;
    GetResource(RES_TEXT, RT_GENERIC_DEV1, name);
    pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
    pl->SetFontType(Gfx::FONT_STUDIO);
    pl->SetFontSize(Gfx::FONT_SIZE_SMALL);

    pos.y  =  13.0f/480.0f;
    GetResource(RES_TEXT, RT_GENERIC_DEV2, name);
    pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
    pl->SetFontType(Gfx::FONT_STUDIO);
    pl->SetFontSize(Gfx::FONT_SIZE_SMALL);

    pos.x  = 355.0f/640.0f;
    pos.y  =  83.0f/480.0f;
    ddim.x = 246.0f/640.0f;
    ddim.y =  16.0f/480.0f;
    GetResource(RES_TEXT, RT_GENERIC_EDIT1, name);
    pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL3, name);
    pl->SetFontType(Gfx::FONT_STUDIO);
    pl->SetFontSize(Gfx::FONT_SIZE_SMALL);

    pos.y  =  13.0f/480.0f;
    GetResource(RES_TEXT, RT_GENERIC_EDIT2, name);
    pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name);
    pl->SetFontType(Gfx::FONT_STUDIO);
    pl->SetFontSize(Gfx::FONT_SIZE_SMALL);

    pos.x  = 306.0f/640.0f;
    pos.y  =  17.0f/480.0f;
    ddim.x =  30.0f/640.0f;
    ddim.y =  30.0f/480.0f;
    pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
    pb->SetState(STATE_SHADOW);

    SetBackground("textures/interface/generico.png");
}