Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

app.h

Go to the documentation of this file.
00001 /*
00002  * app.h
00003  *
00004  * Turbo Vision - Version 2.0
00005  *
00006  * Copyright (c) 1994 by Borland International
00007  * All Rights Reserved.
00008  *
00009  * Modified by Sergio Sigala <sergio@sigala.it>
00010  */
00011 
00012 #if defined( Uses_TBackground ) && !defined( __TBackground )
00013 #define __TBackground
00014 
00019 class TRect;
00020 
00029 class TBackground : public TView
00030 {
00031 public:
00040     TBackground( const TRect& bounds, char aPattern );
00045     virtual void draw();
00049     virtual TPalette& getPalette() const;
00050 protected:
00054     char pattern;
00055 private:
00056     virtual const char *streamableName() const
00057         { return name; }
00058 protected:
00069     TBackground( StreamableInit );
00075     virtual void write( opstream& os );
00081     virtual void *read( ipstream& is );
00082 public:
00086     static const char * const name;
00094     static TStreamable *build();
00095 };
00096 
00100 inline ipstream& operator >> ( ipstream& is, TBackground& cl )
00101     { return is >> (TStreamable&)cl; }
00105 inline ipstream& operator >> ( ipstream& is, TBackground*& cl )
00106     { return is >> (void *&)cl; }
00107 
00111 inline opstream& operator << ( opstream& os, TBackground& cl )
00112     { return os << (TStreamable&)cl; }
00116 inline opstream& operator << ( opstream& os, TBackground* cl )
00117     { return os << (TStreamable *)cl; }
00118 
00119 #endif  // Uses_TBackground
00120 
00121 
00122 #if defined( Uses_TDeskTop )  && !defined( __TDeskTop )
00123 #define __TDeskTop
00124 
00125 class TBackground;
00126 class TRect;
00127 class TEvent;
00128 
00136 class TDeskInit
00137 {
00138 public:
00150     TDeskInit( TBackground *(*cBackground)( TRect bounds ) );
00151 protected:
00157     TBackground *(*createBackground)( TRect bounds );
00158 };
00159 
00179 class TDeskTop : public TGroup, public virtual TDeskInit
00180 {
00181 public:
00194     TDeskTop( const TRect& bounds );
00204     void cascade( const TRect& );
00212     virtual void handleEvent( TEvent& );
00226     static TBackground *initBackground( TRect );
00230     void tile( const TRect& );
00238     virtual void tileError();
00251     virtual void shutDown();
00255     static char defaultBkgrnd;
00256 protected:
00261     TBackground *background;
00267     Boolean tileColumnsFirst;
00268 private:
00269     virtual const char *streamableName() const
00270         { return name; }
00271 protected:
00280     TDeskTop( StreamableInit );
00281 public:
00285     static const char * const name;
00292     static TStreamable *build();
00293 };
00294 
00298 inline ipstream& operator >> ( ipstream& is, TDeskTop& cl )
00299     { return is >> (TStreamable&)(TGroup&)cl; }
00303 inline ipstream& operator >> ( ipstream& is, TDeskTop*& cl )
00304     { return is >> (void *&)cl; }
00305 
00309 inline opstream& operator << ( opstream& os, TDeskTop& cl )
00310     { return os << (TStreamable&)(TGroup&)cl; }
00314 inline opstream& operator << ( opstream& os, TDeskTop* cl )
00315     { return os << (TStreamable *)(TGroup *)cl; }
00316 
00317 #endif
00318 
00319 // Turbo Vision 2.0 Color Palettes
00320 
00321 #ifndef __UNPATCHED
00322 #define cpAppColor \
00323        "\x71\x70\x78\x74\x20\x28\x24\x17\x1F\x1A\x31\x31\x1E\x71\x1F" \
00324     "\x37\x3F\x3A\x13\x13\x3E\x21\x3F\x70\x7F\x7A\x13\x13\x70\x7F\x7E" \
00325     "\x70\x7F\x7A\x13\x13\x70\x70\x7F\x7E\x20\x2B\x2F\x78\x2E\x70\x30" \
00326     "\x3F\x3E\x1F\x2F\x1A\x20\x72\x31\x31\x30\x2F\x3E\x31\x13\x38\x00" \
00327     "\x17\x1F\x1A\x71\x71\x1E\x17\x1F\x1E\x20\x2B\x2F\x78\x2E\x10\x30" \
00328     "\x3F\x3E\x70\x2F\x7A\x20\x12\x31\x31\x30\x2F\x3E\x31\x13\x38\x00" \
00329     "\x37\x3F\x3A\x13\x13\x3E\x30\x3F\x3E\x20\x2B\x2F\x78\x2E\x30\x70" \
00330     "\x7F\x7E\x1F\x2F\x1A\x20\x32\x31\x71\x70\x2F\x7E\x71\x13\x78\x00" \
00331     "\x37\x3F\x3A\x13\x13\x30\x3E\x1E"    // help colors
00332 #else
00333 #define cpAppColor \
00334        "\x71\x70\x78\x74\x20\x28\x24\x17\x1F\x1A\x31\x31\x1E\x71\x1F" \
00335     "\x37\x3F\x3A\x13\x13\x3E\x21\x3F\x70\x7F\x7A\x13\x13\x70\x7F\x7E" \
00336     "\x70\x7F\x7A\x13\x13\x70\x70\x7F\x7E\x20\x2B\x2F\x78\x2E\x70\x30" \
00337     "\x3F\x3E\x1F\x2F\x1A\x20\x72\x31\x31\x30\x2F\x3E\x31\x13\x38\x00" \
00338     "\x17\x1F\x1A\x71\x71\x1E\x17\x1F\x1E\x20\x2B\x2F\x78\x2E\x10\x30" \
00339     "\x3F\x3E\x70\x2F\x7A\x20\x12\x31\x31\x30\x2F\x3E\x31\x13\x38\x00" \
00340     "\x37\x3F\x3A\x13\x13\x3E\x30\x3F\x3E\x20\x2B\x2F\x78\x2E\x30\x70" \
00341     "\x7F\x7E\x1F\x2F\x1A\x20\x32\x31\x71\x70\x2F\x7E\x71\x13\x38\x00" \
00342     "\x37\x3F\x3A\x13\x13\x30\x3E\x1E"    // help colors
00343 #endif
00344 
00345 #ifndef __UNPATCHED
00346 #define cpAppBlackWhite \
00347        "\x70\x70\x78\x7F\x07\x07\x0F\x07\x0F\x07\x70\x70\x07\x70\x0F" \
00348     "\x07\x0F\x07\x70\x70\x07\x70\x0F\x70\x7F\x7F\x70\x07\x70\x07\x0F" \
00349     "\x70\x7F\x7F\x70\x07\x70\x70\x7F\x7F\x07\x0F\x0F\x78\x0F\x78\x07" \
00350     "\x0F\x0F\x0F\x70\x0F\x07\x70\x70\x70\x07\x70\x0F\x07\x07\x08\x00" \
00351     "\x07\x0F\x0F\x07\x70\x07\x07\x0F\x0F\x70\x78\x7F\x08\x7F\x08\x70" \
00352     "\x7F\x7F\x7F\x0F\x70\x70\x07\x70\x70\x70\x07\x7F\x70\x07\x78\x00" \
00353     "\x70\x7F\x7F\x70\x07\x70\x70\x7F\x7F\x07\x0F\x0F\x78\x0F\x78\x07" \
00354     "\x0F\x0F\x0F\x70\x0F\x07\x70\x70\x70\x07\x70\x0F\x07\x07\x08\x00" \
00355     "\x07\x0F\x07\x70\x70\x07\x0F\x70"    // help colors
00356 #else
00357 #define cpAppBlackWhite \
00358        "\x70\x70\x78\x7F\x07\x07\x0F\x07\x0F\x07\x70\x70\x07\x70\x0F" \
00359     "\x07\x0F\x07\x70\x70\x07\x70\x0F\x70\x7F\x7F\x70\x07\x70\x07\x0F" \
00360     "\x70\x7F\x7F\x70\x07\x70\x70\x7F\x7F\x07\x0F\x0F\x78\x0F\x78\x07" \
00361     "\x0F\x0F\x0F\x70\x0F\x07\x70\x70\x70\x07\x70\x0F\x07\x07\x78\x00" \
00362     "\x07\x0F\x0F\x07\x70\x07\x07\x0F\x0F\x70\x78\x7F\x08\x7F\x08\x70" \
00363     "\x7F\x7F\x7F\x0F\x70\x70\x07\x70\x70\x70\x07\x7F\x70\x07\x78\x00" \
00364     "\x70\x7F\x7F\x70\x07\x70\x70\x7F\x7F\x07\x0F\x0F\x78\x0F\x78\x07" \
00365     "\x0F\x0F\x0F\x70\x0F\x07\x70\x70\x70\x07\x70\x0F\x07\x07\x78\x00" \
00366     "\x07\x0F\x07\x70\x70\x07\x0F\x70"    // help colors
00367 #endif
00368 
00369 #ifndef __UNPATCHED
00370 #define cpAppMonochrome \
00371        "\x70\x07\x07\x0F\x70\x70\x70\x07\x0F\x07\x70\x70\x07\x70\x00" \
00372     "\x07\x0F\x07\x70\x70\x07\x70\x00\x70\x70\x70\x07\x07\x70\x07\x00" \
00373     "\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
00374     "\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x70\x00" \
00375     "\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
00376     "\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x01\x00" \
00377     "\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
00378     "\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x01\x00" \
00379     "\x07\x0F\x07\x70\x70\x07\x0F\x70"    // help colors
00380 #else
00381 #define cpAppMonochrome \
00382        "\x70\x07\x07\x0F\x70\x70\x70\x07\x0F\x07\x70\x70\x07\x70\x00" \
00383     "\x07\x0F\x07\x70\x70\x07\x70\x00\x70\x70\x70\x07\x07\x70\x07\x00" \
00384     "\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
00385     "\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x70\x00" \
00386     "\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
00387     "\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x70\x00" \
00388     "\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
00389     "\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x70\x00" \
00390     "\x07\x0F\x07\x70\x70\x07\x0F\x70"    // help colors
00391 #endif
00392 
00393 #if defined( Uses_TProgram ) && !defined( __TProgram )
00394 #define __TProgram
00395 
00396 // Standard application help contexts
00397 
00398 // Note: range $FF00 - $FFFF of help contexts are reserved by Borland
00399 
00400 const unsigned short hcNew          = 0xFF01;
00401 const unsigned short hcOpen         = 0xFF02;
00402 const unsigned short hcSave         = 0xFF03;
00403 const unsigned short hcSaveAs       = 0xFF04;
00404 const unsigned short hcSaveAll      = 0xFF05;
00405 const unsigned short hcChangeDir    = 0xFF06;
00406 const unsigned short hcDosShell     = 0xFF07;
00407 const unsigned short hcExit         = 0xFF08;
00408 
00409 const unsigned short hcUndo         = 0xFF10;
00410 const unsigned short hcCut          = 0xFF11;
00411 const unsigned short hcCopy         = 0xFF12;
00412 const unsigned short hcPaste        = 0xFF13;
00413 const unsigned short hcClear        = 0xFF14;
00414 
00415 const unsigned short hcTile         = 0xFF20;
00416 const unsigned short hcCascade      = 0xFF21;
00417 const unsigned short hcCloseAll     = 0xFF22;
00418 const unsigned short hcResize       = 0xFF23;
00419 const unsigned short hcZoom         = 0xFF24;
00420 const unsigned short hcNext         = 0xFF25;
00421 const unsigned short hcPrev         = 0xFF26;
00422 const unsigned short hcClose        = 0xFF27;
00423 
00424 
00425 class TStatusLine;
00426 class TMenuBar;
00427 class TDeskTop;
00428 class TEvent;
00429 class TView;
00430 
00439 class TProgInit
00440 {
00441 public:
00459     TProgInit( TStatusLine *(*cStatusLine)( TRect ),
00460                TMenuBar *(*cMenuBar)( TRect ),
00461                TDeskTop *(*cDeskTop )( TRect )
00462              );
00463 protected:
00467     TStatusLine *(*createStatusLine)( TRect );
00471     TMenuBar *(*createMenuBar)( TRect );
00475     TDeskTop *(*createDeskTop)( TRect );
00476 };
00477 
00478 /* ---------------------------------------------------------------------- */
00479 /*      class TProgram                                                    */
00480 /*                                                                        */
00481 /*      Palette layout                                                    */
00482 /*          1 = TBackground                                               */
00483 /*       2- 7 = TMenuView and TStatusLine                                 */
00484 /*       8-15 = TWindow(Blue)                                             */
00485 /*      16-23 = TWindow(Cyan)                                             */
00486 /*      24-31 = TWindow(Gray)                                             */
00487 /*      32-63 = TDialog                                                   */
00488 /* ---------------------------------------------------------------------- */
00489 
00490 //  TApplication palette entries
00491 
00496 const int
00497     apColor      = 0,
00498 
00503     apBlackWhite = 1,
00504 
00509     apMonochrome = 2;
00510 
00511 class TDialog;
00512 class TWindow;
00513 
00524 class TProgram : public TGroup, public virtual TProgInit
00525 {
00526 public:
00547     TProgram();
00554     virtual ~TProgram();
00562     virtual Boolean canMoveFocus();
00582     virtual ushort executeDialog(TDialog* pD, void*data = 0);
00602     virtual void getEvent(TEvent& event);
00610     virtual TPalette& getPalette() const;
00630     virtual void handleEvent(TEvent& event);
00653     virtual void idle();
00667     virtual void initScreen();
00679     virtual void outOfMemory();
00690     virtual void putEvent( TEvent& event );
00697     virtual void run();
00701     virtual TWindow* insertWindow(TWindow*);
00720     void setScreenMode( ushort mode );
00739     TView *validView( TView *p );
00751     virtual void shutDown();
00759     virtual void suspend() {}
00767     virtual void resume() {}
00783     static TStatusLine *initStatusLine( TRect );
00799     static TMenuBar *initMenuBar( TRect );
00815     static TDeskTop *initDeskTop( TRect );
00825     static TProgram * application;
00833     static TStatusLine * statusLine;
00841     static TMenuBar * menuBar;
00849     static TDeskTop * deskTop;
00866      static int appPalette;
00867 protected:
00874     static TEvent pending;
00875 private:
00876     static const char * exitText;
00877 };
00878 
00879 #endif
00880 
00881 #if defined( Uses_TApplication ) && !defined( __TApplication )
00882 #define __TApplication
00883 
00907 class TApplication : public TScreen, public TProgram
00908 {
00909 protected:
00936     TApplication();
00943     virtual ~TApplication();
00944 public:
00953     virtual void suspend();
00962     virtual void resume();
00968     void getEvent(TEvent& event) { TProgram::getEvent(event); };
00969 };
00970 
00971 #endif

Generated at Sat Sep 22 20:19:07 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001