"What you are about to witness may seriously amaze you.",
&Demo );
Mb.SetType ( OkayButton | ExclamationIcon );
Mb.Show ();
Exec();
}
DemoWind::far DemoWind( App *pa ) {
parent = pa;
EnableSysMenu ();
EnableBorder ();
SetCaption ( "A CommonView Demonstration" );
SetIcon ( new Icon( "DemoIcon" ) );
ChangeMenu ( new Menu( "DemoMenu" ) );
Show();
}
long DemoWind::far MenuCommand ( MenuCommandEvt mCE ) {
int Item = mCE.GetItemID ();
switch( Item ) {
case IDM_EXIT:
parent->Quit();
break;
case IDM_ABOUT:
AboutDialog( this, "AboutBox" );
break;
case IDM_DETAILS:
DetailsDialog( this, "COMMONVIEWDETAILS" );
break;
case IDM_HELLO:
HelloDialog( this, "HELLO_DIALOG" );
break;
case IDM_MEMMANAGEMENT:
InfoBox( this, "Container classes in CommonView allow multiple shared local heaps.\n\nContainers do all their own memory locking and unlocking automatically.");
break;
case IDM_SYSCALLREDUCTION:
InfoBox( this, "CommonView reduces the number of system calls needed dramatically, from as many as 700 in Presentation Manager, or 400 in MS-Windows to about 30 easy-to-use classes.");
break;
case IDM_DYNALINKS:
InfoBox( this, "CommonView simplifies programming Dynalinks. In fact CommonView itself is a Dynalink.");
break;
case IDM_EFFICIENCY:
InfoBox( this, "CommonView is written entirely in C++ which is just as efficient as C.");
break;
case IDM_PORTABILITY:
InfoBox( this, "Applications you develop with CommonView are 100% portable between Presentation Manager and MS-Windows. CommonView improves portability to both X11 and NeWS without interfering with the `look and feel' of the different environments.");
break;
case IDM_OBJECTORIENTEDDESIGN:
InfoBox( this, "CommonView's Object-Oriented design uses such concepts as Encapsulation and Inheritance to reduce development time for Windows applications.");
break;
case IDM_MESSAGEHANDLING:
InfoBox( this, "CommonView's generic events map in a portable way onto other Windows systems such as X11, Presentation Manager and NeWS.");
break;
default:
return FALSE;
}
}
long AboutDialog::far WindowInit ( Event )
{
return TRUE;
}
long AboutDialog::far ButtonClick ( ControlEvt )
{
EndDlg ( FALSE );
return TRUE;
}
long DetailsDialog::far ButtonClick ( ControlEvt )
{
EndDlg ( FALSE );
return TRUE;
}
long DetailsDialog::far HorizScroll ( ScrollEvt s ) {
CxxFile = new MultiLineEdit ( this, IDS_HELLO_CXX );
if ( ( fp = open ( "hello.cxx", 0x8000 ) ) == -1 )
CxxFile->SetText ( "Cannot open hello.cxx" );
else {
len = ( int ) lseek ( fp, 0, 2 );
lseek ( fp, 0L, 0 ); /* Find length of file */
Buffer = new char [ len + 1 ];
if ( Buffer ) {
len = read ( fp, Buffer, len );
* ( Buffer + len ) = '\0';
CxxFile->SetTextLimit ( len );
CxxFile->SetText ( Buffer );
delete Buffer;
}
else CFile->SetText("Out of memory!");
close ( fp );
}
if ( ( fp = open ( "hello.c", 0x8000 ) ) == -1 ) // binary mode
CFile->SetText ( "Cannot open hello.c" );
else {
len = ( int ) lseek ( fp, 0, 2 );
lseek ( fp, 0, 0 );
Buffer = new char [ len + 1 ];
if ( Buffer ) {
len = read ( fp, Buffer, len );
* ( Buffer + len ) = '\0';
CFile->SetTextLimit ( len );
CFile->SetText ( Buffer );
delete Buffer;
}
else CFile->SetText ( "Out of memory!" );
close ( fp );
}
MessBox M ( "The Hello Program",
"This window contains the listings of two programs. Each creates a window and prints 'Hello World' on it. One is written in C, the other in C++ with CommonView. Scroll around the code and see how the CommonView application is much smaller and much clearer in it's function.", 0 );