Exemplo n.º 1
0
void TMyApp::handleEvent(TEvent& event) {
    TApplication::handleEvent(event); // act like base!
    if (event.what == evCommand) {
        switch (event.message.command) {
        case cmMyNewWin:
            myNewWindow();
            break;
        case cmAboutCmd:
            aboutDlgBox();
            break;
        case cmCalendarCmd:
            calendar();
            break;
        case cmAsciiCmd:
            asciiTable();
            break;
        case cmCalcCmd:
            calculator();
            break;
        case cmPuzzleCmd:
            puzzle();
            break;
        case cmTile:
            tile();
            break;
        case cmCascade:
            cascade();
            break;
        case cmCO128x75:
            setVideoMode(TScreen::smCO128x75);
            break;
        case cmCO128x60:
            setVideoMode(TScreen::smCO128x60);
            break;
        case cmCO128x37:
            setVideoMode(TScreen::smCO128x37);
            break;
        case cmCO113x75:
            setVideoMode(TScreen::smCO113x75);
            break;
        case cmCO113x37:
            setVideoMode(TScreen::smCO113x37);
            break;
        case cmCO102x30:
            setVideoMode(TScreen::smCO102x30);
            break;
        case cmCO85x37:
            setVideoMode(TScreen::smCO85x37);
            break;
        case cmCO85x26:
            setVideoMode(TScreen::smCO85x26);
            break;
        case cmCO85x25:
            setVideoMode(TScreen::smCO85x25);
            break;
        case cmCO85x22:
            setVideoMode(TScreen::smCO85x22);
            break;
        case cmCO73x20:
            setVideoMode(TScreen::smCO73x20);
            break;
        case cmCO64x18:
            setVideoMode(TScreen::smCO64x18);
            break;
        case cmCO64x16:
            setVideoMode(TScreen::smCO64x16);
            break;
        case cmCO40x22:
            setVideoMode(TScreen::smCO40x22);
            break;
        default:
            return;
        }
        clearEvent(event); // clear event after handling
    }
}
void TVDemo::handleEvent(TEvent &event)
{
    TApplication::handleEvent(event);

    if (event.what == evCommand)
    {
        switch (event.message.command)
            {
            case cmAboutCmd:            //  About Dialog Box
                aboutDlgBox();
                break;

            case cmCalendarCmd:         //  Calendar Window
                calendar();
                break;

            case cmAsciiCmd:            //  Ascii Table
                asciiTable();
                break;

            case cmCalcCmd:             //  Calculator
                calculator();
                break;

            case cmPuzzleCmd:           //  Puzzle
                puzzle();
                break;

            case cmOpenCmd:             //  View a file
                openFile("*.*");
                break;

            case cmChDirCmd:            //  Change directory
                changeDir();
                break;

            case cmDOS_Cmd:             //  DOS shell
                shell();
                break;

            case cmTile:             //  Tile current file windows
                tile();
                break;

            case cmCascade:          //  Cascade current file windows
                cascade();
                break;

            case cmMouseCmd:            //  Mouse control dialog box
                mouse();
                break;

            case cmColorCmd:            //  Color control dialog box
                colors();
                break;

        case cmSaveCmd:             //  Save current desktop
                saveDesktop();
                break;
 
        case cmRestoreCmd:          //  Restore saved desktop
                retrieveDesktop();
                break;

            default:                    //  Unknown command
                return;

            }
        clearEvent (event);
        }
}