home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / tvision / msgcls / tlnmsg.h < prev   
Encoding:
C/C++ Source or Header  |  1992-01-30  |  2.5 KB  |  108 lines

  1. #if !defined __TLNMSG_H__
  2. #define __TLNMSG_H__
  3.  
  4. #define Uses_TWindow
  5. #define Uses_TNSCollection
  6. #define Uses_TScrollBar
  7. #define Uses_TListViewer
  8. #define Uses_TPalette
  9. #define Uses_TEvent
  10. #define Uses_TProgram
  11. #define Uses_TDeskTop
  12. #define Uses_TEventQueue
  13. #define Uses_TStaticText
  14.  
  15. #include <tv.h>
  16.  
  17. #include "const.h"
  18.  
  19. extern void postMsg(const char *);
  20. extern void postInfo(int, const char *);
  21.  
  22. //
  23. // TMsgListViewer: Very similar to listbox, except it has a TNSCollection
  24. // (nonstreamable) and works with two scroll bars which are attached
  25. // to the frame of it's owner window.
  26. //
  27.  
  28. class TMsgListViewer : public TListViewer {
  29.  
  30.   private:
  31.     // list of items to display
  32.     TNSCollection * items;
  33.  
  34.   public:
  35.     TMsgListViewer( const TRect& bounds, ushort aNumCols,
  36.                     TScrollBar * aHScrollBar, TScrollBar * aVScrollBar);
  37.  
  38.     void getText( char * dest, short item, short maxLen );
  39.  
  40.     virtual TPalette& getPalette() const;
  41.  
  42.     void insert( const char * msg) ;
  43.  
  44.     TNSCollection * list() { return items; } ;
  45.  
  46. } ;
  47.  
  48. //
  49. // TlnMsgWindow: Cyan window to hold the TMsgListViewer.
  50. //
  51.  
  52. class TlnMsgWindow : public TWindow
  53. {
  54.   // private members
  55.   TMsgListViewer * msgViewer;
  56.  
  57.   public :
  58.     TlnMsgWindow(const TRect& bounds);
  59.     ~TlnMsgWindow();
  60.     virtual void handleEvent(TEvent& event);
  61.     virtual TPalette& getPalette() const;
  62. } ;
  63.  
  64. //
  65. // TlnInfoWindow: displays information in a gray window like a dialog
  66. // box with the exception that it isn't modal.  The application posts
  67. // information to the window and is responsible for closing the window
  68. // when done.
  69. //
  70.  
  71. class TStaticPrompt : public TStaticText
  72. {
  73.   public:
  74.     TStaticPrompt(TRect&, const char *);   // constructor
  75.     virtual TPalette& getPalette() const; // Text blue on cyan
  76. } ;
  77.  
  78. class TlnInfoWindow : public TWindow
  79. {
  80.  
  81.   //
  82.   // Create an array of pointers to static text items.. make
  83.   // this larger or smaller as required.  Current setting assumes
  84.   // maximum box length of 25 lines.  The last line is reserved for
  85.   // special prompts to the user, e.g. "Press Escape to Continue" or
  86.   // "Ctrl-Break to Quit".  A control break handler is not supplied.
  87.   //
  88.  
  89.   private:
  90.     int count;
  91.     TStaticText * items[25];
  92.  
  93.   public:
  94.     TlnInfoWindow(const TRect&, const char*, short);
  95.     ~TlnInfoWindow();
  96.  
  97.     // Once virtual, always virtual!!
  98.     virtual void handleEvent(TEvent&);
  99.     virtual TPalette& getPalette() const;
  100. };
  101.  
  102. typedef struct {
  103.   int line;
  104.   const char * text;
  105. } InfoData;
  106.  
  107.  
  108. #endif