TVision
view release on metacpan or search on metacpan
tvision.git/examples/tvdemo/tvdemo2.cpp view on Meta::CPAN
#include <stdlib.h>
#include <signal.h>
//
// DemoApp::handleEvent()
// Event loop to distribute the work.
//
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 cmEventViewCmd: // Open Event Viewer
eventViewer();
break;
case cmChBackground: // Change Background pattern
chBackground();
break;
case cmOpenCmd: // View a file
openFile("*.*");
break;
case cmChDirCmd: // Change directory
changeDir();
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);
}
}
//
// About Box function()
//
void TVDemo::aboutDlgBox()
{
TDialog *aboutBox = new TDialog(TRect(0, 0, 39, 13), "About");
aboutBox->insert(
new TStaticText(TRect(9, 2, 30, 9),
"\003Turbo Vision Demo\n\n" // These strings will be
"\003C++ Version\n\n" // concatenated by the compiler.
"\003Copyright (c) 1994\n\n" // The \003 centers the line.
"\003Borland International"
)
);
aboutBox->insert(
new TButton(TRect(14, 10, 26, 12), " OK", cmOK, bfDefault)
);
aboutBox->options |= ofCentered;
executeDialog(aboutBox);
}
//
// Ascii Chart function
//
void TVDemo::asciiTable()
{
TAsciiChart *chart = (TAsciiChart *) validView(new TAsciiChart);
if(chart != 0)
{
chart->helpCtx = hcAsciiTable;
deskTop->insert(chart);
}
}
void TVDemo::chBackground()
{
TChBackground *b = (TChBackground *) validView(new TChBackground(deskTop->background));
if (b != 0)
( run in 0.729 second using v1.01-cache-2.11-cpan-5623c5533a1 )