コード例 #1
0
ファイル: Dialog.cpp プロジェクト: doniexun/OrangeC
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");
    }
}
コード例 #2
0
ファイル: Dialog.cpp プロジェクト: doniexun/OrangeC
void Control::ReadRC(RCFile &rcFile, bool extended)
{
    switch (rcFile.GetTokenId())
    {
        case Lexer::AUTO3STATE:
            ReadStandard(rcFile, Button, BS_AUTO3STATE | WS_TABSTOP, extended, 1);
            break;
        case Lexer::AUTOCHECKBOX:
            ReadStandard(rcFile, Button, BS_AUTOCHECKBOX | WS_TABSTOP, extended, 1);
            break;
        case Lexer::AUTORADIOBUTTON:
            ReadStandard(rcFile, Button, BS_AUTORADIOBUTTON, extended, 1);
            break;
        case Lexer::CHECKBOX:
            ReadStandard(rcFile, Button, BS_CHECKBOX | WS_TABSTOP, extended, 1);
            break;
        case Lexer::COMBOBOX:
            ReadStandard(rcFile, Combobox, 0, extended, 0);
            if (!(style &3))
                style |= CBS_SIMPLE;
            break;
        case Lexer::CTEXT:
            ReadStandard(rcFile, Static, SS_CENTER | WS_GROUP, extended, 1);
            break;
        case Lexer::DEFPUSHBUTTON:
            ReadStandard(rcFile, Button, BS_DEFPUSHBUTTON | WS_TABSTOP, extended, 1);
            break;
        case Lexer::EDITTEXT:
            ReadStandard(rcFile, Edit, ES_LEFT | WS_BORDER | WS_TABSTOP, extended, 0);
            break;
        case Lexer::GROUPBOX:
            ReadStandard(rcFile, Button, BS_GROUPBOX, extended, 1);
            break;
        case Lexer::ICON:
            ReadStandard(rcFile, Static, SS_ICON, extended, 1);
            break;
        case Lexer::LISTBOX:
            ReadStandard(rcFile, Listbox, LBS_NOTIFY | WS_BORDER, extended, 0);
            break;
        case Lexer::LTEXT:
            ReadStandard(rcFile, Static, SS_LEFT | WS_GROUP, extended, 1);
            break;
        case Lexer::PUSHBUTTON:
            ReadStandard(rcFile, Button, BS_PUSHBUTTON | WS_TABSTOP, extended, 1);
            break;
        case Lexer::RADIOBUTTON:
            ReadStandard(rcFile, Button, BS_RADIOBUTTON, extended, 1);
            break;
        case Lexer::RTEXT:
            ReadStandard(rcFile, Static, SS_RIGHT | WS_GROUP, extended, 1);
            break;
        case Lexer::SCROLLBAR:
            ReadStandard(rcFile, Scrollbar, SBS_HORZ, extended, 0);
            break;
        case Lexer::STATE3:
            ReadStandard(rcFile, Button, BS_3STATE | WS_TABSTOP, extended, 1);
            break;
        case Lexer::CONTROL:
            ReadGeneric(rcFile, extended);
            break;
        default:
            // shouldn't get here
            break;
    }
    rcFile.NeedEol();
}