home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pctchnqs / 1992 / number1 / fviewer.chg < prev    next >
Text File  |  1992-01-05  |  2KB  |  65 lines

  1. ...
  2. #if !defined( __FILEVIEW_H )
  3. #include "FileView.h"
  4. #endif  // __FILEVIEW_H
  5.  
  6. // PRFILE CHANGE: added #include "prfile.h".
  7. #include "prfile.h"
  8.  
  9. class TFileViewerApp : public TApplication
  10. {
  11. public:
  12. ...
  13.     // PRFILE CHANGE: added idle() function.
  14.     virtual void idle();
  15. ...
  16. };
  17.  
  18. TFileViewerApp::TFileViewerApp() :
  19.     TProgInit( &TFileViewerApp::initStatusLine,
  20.            &TFileViewerApp::initMenuBar,
  21.            &TFileViewerApp::initDeskTop
  22.          )
  23. {
  24.     // PRFILE CHANGE: added disable of cmPrintFile.
  25.     // No files open; none can be printed.
  26.     disableCommand(cmPrintFile);
  27. }
  28. ...
  29. void TFileViewerApp::handleEvent( TEvent& event )
  30. {
  31.     // PRFILE CHANGE: added handler for cmQuit.
  32.     // Attempt to cancel print queue; clear quit event if failed.
  33.     if (event.what == evCommand && event.message.command == cmQuit
  34.     && !TPrintQueue::printQueue.cancel())
  35.     clearEvent( event );
  36.  
  37.     TApplication::handleEvent( event );
  38. ...
  39. }
  40.  
  41. TMenuBar *TFileViewerApp::initMenuBar( TRect r )
  42. {
  43.     r.b.y = r.a.y+1;
  44.  
  45.     return new TMenuBar( r,
  46.       *new TSubMenu( "~F~ile", kbAltF ) +
  47.     *new TMenuItem( "~O~pen...", cmFileOpen, kbF3, 
  48.     hcNoContext, "F3" ) +
  49.     *new TMenuItem( "~C~hange dir...", cmChangeDir, 
  50.     kbNoKey ) +
  51.     // PRFILE CHANGE: added ~P~rint menu item.
  52.     *new TMenuItem( "~P~rint", cmPrintFile, kbNoKey ) +
  53.     *new TMenuItem( "E~x~it", cmQuit, kbAltX, 
  54.     hcNoContext, "Alt-X" ) +
  55. ...
  56. }
  57. ...
  58. // PRFILE CHANGE: defined TFileViewerApp::idle() function.
  59. void TFileViewerApp::idle()
  60. {
  61. TApplication::idle();
  62. TPrintQueue::printQueue.print();
  63. }
  64.  
  65.