home *** CD-ROM | disk | FTP | other *** search
- ...
- #if !defined( __FILEVIEW_H )
- #include "FileView.h"
- #endif // __FILEVIEW_H
-
- // PRFILE CHANGE: added #include "prfile.h".
- #include "prfile.h"
-
- class TFileViewerApp : public TApplication
- {
- public:
- ...
- // PRFILE CHANGE: added idle() function.
- virtual void idle();
- ...
- };
-
- TFileViewerApp::TFileViewerApp() :
- TProgInit( &TFileViewerApp::initStatusLine,
- &TFileViewerApp::initMenuBar,
- &TFileViewerApp::initDeskTop
- )
- {
- // PRFILE CHANGE: added disable of cmPrintFile.
- // No files open; none can be printed.
- disableCommand(cmPrintFile);
- }
- ...
- void TFileViewerApp::handleEvent( TEvent& event )
- {
- // PRFILE CHANGE: added handler for cmQuit.
- // Attempt to cancel print queue; clear quit event if failed.
- if (event.what == evCommand && event.message.command == cmQuit
- && !TPrintQueue::printQueue.cancel())
- clearEvent( event );
-
- TApplication::handleEvent( event );
- ...
- }
-
- TMenuBar *TFileViewerApp::initMenuBar( TRect r )
- {
- r.b.y = r.a.y+1;
-
- return new TMenuBar( r,
- *new TSubMenu( "~F~ile", kbAltF ) +
- *new TMenuItem( "~O~pen...", cmFileOpen, kbF3,
- hcNoContext, "F3" ) +
- *new TMenuItem( "~C~hange dir...", cmChangeDir,
- kbNoKey ) +
- // PRFILE CHANGE: added ~P~rint menu item.
- *new TMenuItem( "~P~rint", cmPrintFile, kbNoKey ) +
- *new TMenuItem( "E~x~it", cmQuit, kbAltX,
- hcNoContext, "Alt-X" ) +
- ...
- }
- ...
- // PRFILE CHANGE: defined TFileViewerApp::idle() function.
- void TFileViewerApp::idle()
- {
- TApplication::idle();
- TPrintQueue::printQueue.print();
- }
-
-