Exemple #1
0
void Control::GetClass(RCFile &rcFile)
{
    if (rcFile.IsString())
    {
        std::wstring str = rcFile.GetString();
        std::wstring str1 = str;
        for (int i=0; i < str1.size(); i++)
            str1[i] = tolower(str1[i]);
        if (str1 == L"button")
            cls.SetId(Button);
        else if (str1 == L"edit")
            cls.SetId(Edit);
        else if (str1 == L"static")
            cls.SetId(Static);
        else if (str1 == L"listbox")
            cls.SetId(Listbox);
        else if (str1 == L"scrollbar")
            cls.SetId(Scrollbar);
        else if (str1 == L"combobox")
            cls.SetId(Combobox);
        else
        {
            cls.SetName(str);
        }
    }
    else switch (rcFile.GetTokenId())
    {
        case Lexer::AUTO3STATE:
        case Lexer::AUTOCHECKBOX:
        case Lexer::AUTORADIOBUTTON:
        case Lexer::CHECKBOX:
        case Lexer::PUSHBUTTON:
        case Lexer::RADIOBUTTON:
        case Lexer::DEFPUSHBUTTON:
        case Lexer::STATE3:
        case Lexer::GROUPBOX:
            cls.SetId(Button);
            break;
        case Lexer::COMBOBOX:
            cls.SetId(Combobox);
            break;
        case Lexer::CTEXT:
        case Lexer::LTEXT:
        case Lexer::RTEXT:
        case Lexer::ICON:
            cls.SetId(Static);
            break;
        case Lexer::EDITTEXT:
            cls.SetId(Edit);
            break;
        case Lexer::LISTBOX:
            cls.SetId(Listbox);
            break;
        case Lexer::SCROLLBAR:
            cls.SetId(Scrollbar);
            break;
        default:
            throw new std::runtime_error("Unknown dialog control class");
    }
}
Exemple #2
0
void DlgInclude::ReadRC(RCFile &rcFile)
{
    resInfo.SetFlags(resInfo.GetFlags() | ResourceInfo::Pure);
    resInfo.ReadRC(rcFile, false);
    if (!rcFile.IsString())
        throw new std::runtime_error("Expected quoted string");
    std::wstring wname = rcFile.GetString();
    std::string name = rcFile.CvtString(wname);
    data = new ResourceData((unsigned char *)name.c_str(), name.size() + 1);
}
Exemple #3
0
void Accelerators::ReadRC(RCFile &rcFile)
{
    resInfo.SetFlags( (resInfo.GetFlags() &~ResourceInfo::Discardable) | ResourceInfo::Pure);
    resInfo.ReadRC(rcFile, true);
    rcFile.NeedBegin();
    while (rcFile.IsString() || rcFile.IsNumber())
    {
        //int done;
        Key key;
        key.ReadRC(rcFile);
        keys.push_back(key);
    }
    rcFile.NeedEnd();
}
Exemple #4
0
void Accelerators::Key::ReadRC(RCFile &rcFile)
{
    if (rcFile.IsString())
    {
        std::wstring str = rcFile.GetString();
        if (str[0] == '^')
        {
            if (str.size() != 2)
                throw new std::runtime_error("Invalid key sequence");
            if (str[1] == '^')
                key = '^';
            else
                key = str[1] & 0x1f;
        }
        else
        {
            if (str.size() != 1)
                throw new std::runtime_error("Invalid key sequence");
            key = str[0];
        }
    }
    else
    {
        key = rcFile.GetNumber();
    }
    rcFile.SkipComma();
    id = rcFile.GetNumber();
    rcFile.SkipComma();
    bool done = false;
    while (rcFile.IsKeyword() && !done)
    {
        switch (rcFile.GetToken()->GetKeyword())
        {
            case Lexer::ASCII:
                flags &= ~Virtkey;
                break;
            case Lexer::VIRTKEY:
                flags |= Virtkey;
                break;
            case Lexer::NOINVERT:
                flags |= NoInvert;
                break;
            case Lexer::SHIFT:
                flags |= Shift;
                break;
            case Lexer::CONTROL:
                flags |= Control;
                break;
            case Lexer::ALT:
                flags |= Alt;
                break;
            default:
                done = true;
                break;
        }
        if (!done)
        {
            rcFile.NextToken();
            rcFile.SkipComma();
        }
    }
    rcFile.NeedEol();
}