home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tv20cpp.zip / tvision / dialogs.h < prev    next >
C/C++ Source or Header  |  1999-06-02  |  30KB  |  1,018 lines

  1. /*
  2.  * dialogs.h
  3.  *
  4.  * Turbo Vision - Version 2.0
  5.  *
  6.  * Copyright (c) 1994 by Borland International
  7.  * All Rights Reserved.
  8.  *
  9.  * Modified by Sergio Sigala <ssigala@globalnet.it>
  10.  */
  11.  
  12. #if !defined( __BUTTON_TYPE )
  13. #define __BUTTON_TYPE
  14.  
  15. const
  16.     bfNormal    = 0x00,
  17.     bfDefault   = 0x01,
  18.     bfLeftJust  = 0x02,
  19.     bfBroadcast = 0x04,
  20.     bfGrabFocus = 0x08,
  21.  
  22.     cmRecordHistory = 60;
  23.  
  24. #endif  // __BUTTON_TYPE
  25.  
  26. /* ---------------------------------------------------------------------- */
  27. /*      class TDialog                                                     */
  28. /*                                                                        */
  29. /*      Palette layout                                                    */
  30. /*        1 = Frame passive                                               */
  31. /*        2 = Frame active                                                */
  32. /*        3 = Frame icon                                                  */
  33. /*        4 = ScrollBar page area                                         */
  34. /*        5 = ScrollBar controls                                          */
  35. /*        6 = StaticText                                                  */
  36. /*        7 = Label normal                                                */
  37. /*        8 = Label selected                                              */
  38. /*        9 = Label shortcut                                              */
  39. /*       10 = Button normal                                               */
  40. /*       11 = Button default                                              */
  41. /*       12 = Button selected                                             */
  42. /*       13 = Button disabled                                             */
  43. /*       14 = Button shortcut                                             */
  44. /*       15 = Button shadow                                               */
  45. /*       16 = Cluster normal                                              */
  46. /*       17 = Cluster selected                                            */
  47. /*       18 = Cluster shortcut                                            */
  48. /*       19 = InputLine normal text                                       */
  49. /*       20 = InputLine selected text                                     */
  50. /*       21 = InputLine arrows                                            */
  51. /*       22 = History arrow                                               */
  52. /*       23 = History sides                                               */
  53. /*       24 = HistoryWindow scrollbar page area                           */
  54. /*       25 = HistoryWindow scrollbar controls                            */
  55. /*       26 = ListViewer normal                                           */
  56. /*       27 = ListViewer focused                                          */
  57. /*       28 = ListViewer selected                                         */
  58. /*       29 = ListViewer divider                                          */
  59. /*       30 = InfoPane                                                    */
  60. /*       31 = Cluster Disabled                                            */
  61. /*       32 = Reserved                                                    */
  62. /* ---------------------------------------------------------------------- */
  63.  
  64. #if defined( Uses_TDialog ) && !defined( __TDialog )
  65. #define __TDialog
  66.  
  67. #define  cpGrayDialog \
  68.     "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F"\
  69.     "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F"
  70.  
  71. #define  cpBlueDialog \
  72.     "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"\
  73.     "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
  74.  
  75. #define  cpCyanDialog \
  76.     "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"\
  77.     "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
  78.  
  79. #define cpDialog cpGrayDialog
  80.  
  81. const dpBlueDialog = 0,
  82.       dpCyanDialog = 1,
  83.       dpGrayDialog = 2;
  84.  
  85. class TRect;
  86. class TEvent;
  87. class TValidator;
  88.  
  89. class TDialog : public TWindow
  90. {
  91.  
  92. public:
  93.  
  94.     TDialog( const TRect& bounds, const char *aTitle );
  95.  
  96.     virtual TPalette& getPalette() const;
  97.     virtual void handleEvent( TEvent& event );
  98.     virtual Boolean valid( ushort command );
  99.  
  100. private:
  101.  
  102.     virtual const char *streamableName() const
  103.         { return name; }
  104.  
  105. protected:
  106.  
  107.     TDialog( StreamableInit );
  108.  
  109. public:
  110.  
  111.     static const char * const name;
  112.     static TStreamable *build();
  113.  
  114. };
  115.  
  116. inline ipstream& operator >> ( ipstream& is, TDialog& cl )
  117.     { return is >> (TStreamable&)cl; }
  118. inline ipstream& operator >> ( ipstream& is, TDialog*& cl )
  119.     { return is >> (void *&)cl; }
  120.  
  121. inline opstream& operator << ( opstream& os, TDialog& cl )
  122.     { return os << (TStreamable&)cl; }
  123. inline opstream& operator << ( opstream& os, TDialog* cl )
  124.     { return os << (TStreamable *)cl; }
  125.  
  126. #endif  // Uses_TDialog
  127.  
  128. /* ---------------------------------------------------------------------- */
  129. /*      class TInputLine                                                  */
  130. /*                                                                        */
  131. /*      Palette layout                                                    */
  132. /*        1 = Passive                                                     */
  133. /*        2 = Active                                                      */
  134. /*        3 = Selected                                                    */
  135. /*        4 = Arrows                                                      */
  136. /* ---------------------------------------------------------------------- */
  137.  
  138. #if defined( Uses_TInputLine ) && !defined( __TInputLine )
  139. #define __TInputLine
  140.  
  141. class TRect;
  142. class TEvent;
  143. class TValidator;
  144.  
  145. class TInputLine : public TView
  146. {
  147.  
  148. public:
  149.  
  150.     TInputLine( const TRect& bounds, int aMaxLen, TValidator *aValid = 0 );
  151.     ~TInputLine();
  152.  
  153.     virtual ushort dataSize();
  154.     virtual void draw();
  155.     virtual void getData( void *rec );
  156.     virtual TPalette& getPalette() const;
  157.     virtual void handleEvent( TEvent& event );
  158.     void selectAll( Boolean enable );
  159.     virtual void setData( void *rec );
  160.     virtual void setState( ushort aState, Boolean enable );
  161.     virtual Boolean valid( ushort cmd );
  162.     void setValidator( TValidator* aValid );
  163.  
  164.     char* data;
  165.     int maxLen;
  166.     int curPos;
  167.     int firstPos;
  168.     int selStart;
  169.     int selEnd;
  170.  
  171. private:
  172.  
  173.     int mouseDelta( TEvent& event );
  174.     int mousePos( TEvent& event );
  175.     void deleteSelect();
  176.     void adjustSelectBlock();
  177.     void saveState();
  178.     void restoreState();
  179.     Boolean checkValid(Boolean);
  180.  
  181.     virtual const char *streamableName() const
  182.         { return name; }
  183.  
  184.     TValidator* validator;
  185.  
  186.     int anchor;
  187. #ifndef __UNPATCHED
  188.     int oldAnchor; // New variable to save another bit of state info
  189. #endif
  190.     char* oldData;
  191.     int oldCurPos;
  192.     int oldFirstPos;
  193.     int oldSelStart;
  194.     int oldSelEnd;
  195.  
  196. protected:
  197.  
  198.     TInputLine( StreamableInit );
  199.     virtual void write( opstream& );
  200.     virtual void *read( ipstream& );
  201.     static const char rightArrow;
  202.     static const char leftArrow;
  203.     Boolean canScroll( int delta );
  204.  
  205. public:
  206.     static const char * const name;
  207.     static TStreamable *build();
  208.  
  209. };
  210.  
  211. inline ipstream& operator >> ( ipstream& is, TInputLine& cl )
  212.     { return is >> (TStreamable&)cl; }
  213. inline ipstream& operator >> ( ipstream& is, TInputLine*& cl )
  214.     { return is >> (void *&)cl; }
  215.  
  216. inline opstream& operator << ( opstream& os, TInputLine& cl )
  217.     { return os << (TStreamable&)cl; }
  218. inline opstream& operator << ( opstream& os, TInputLine* cl )
  219.     { return os << (TStreamable *)cl; }
  220.  
  221. #endif  // Uses_TInputLine
  222.  
  223.  
  224. /* ---------------------------------------------------------------------- */
  225. /*      TButton object                                                    */
  226. /*                                                                        */
  227. /*      Palette layout                                                    */
  228. /*        1 = Normal text                                                 */
  229. /*        2 = Default text                                                */
  230. /*        3 = Selected text                                               */
  231. /*        4 = Disabled text                                               */
  232. /*        5 = Normal shortcut                                             */
  233. /*        6 = Default shortcut                                            */
  234. /*        7 = Selected shortcut                                           */
  235. /*        8 = Shadow                                                      */
  236. /* ---------------------------------------------------------------------- */
  237.  
  238. #if defined( Uses_TButton ) && !defined( __TButton )
  239. #define __TButton
  240.  
  241. class TRect;
  242. class TEvent;
  243. class TDrawBuffer;
  244.  
  245. class TButton : public TView
  246. {
  247.  
  248. public:
  249.  
  250.     TButton( const TRect& bounds,
  251.              const char *aTitle,
  252.              ushort aCommand,
  253.              ushort aFlags
  254.            );
  255.     ~TButton();
  256.  
  257.     virtual void draw();
  258.     void drawState( Boolean down );
  259.     virtual TPalette& getPalette() const;
  260.     virtual void handleEvent( TEvent& event );
  261.     void makeDefault( Boolean enable );
  262.     virtual void press();
  263.     virtual void setState( ushort aState, Boolean enable );
  264.  
  265.     const char *title;
  266.     static const char * shadows;
  267.  
  268. protected:
  269.  
  270.     ushort command;
  271.     uchar flags;
  272.     Boolean amDefault;
  273.  
  274. private:
  275.  
  276.     void drawTitle( TDrawBuffer&, int, int, ushort, Boolean );
  277.     void pressButton( TEvent& );
  278.     TRect getActiveRect();
  279.  
  280. //    static const char * shadows;
  281.     static const char * markers;
  282.  
  283.     virtual const char *streamableName() const
  284.         { return name; }
  285.  
  286. protected:
  287.  
  288.     TButton( StreamableInit ): TView( streamableInit ) {};
  289.     virtual void write( opstream& );
  290.     virtual void *read( ipstream& );
  291.  
  292. public:
  293.  
  294.     static const char * const name;
  295.     static TStreamable *build();
  296.  
  297. };
  298.  
  299. inline ipstream& operator >> ( ipstream& is, TButton& cl )
  300.     { return is >> (TStreamable&)cl; }
  301. inline ipstream& operator >> ( ipstream& is, TButton*& cl )
  302.     { return is >> (void *&)cl; }
  303.  
  304. inline opstream& operator << ( opstream& os, TButton& cl )
  305.     { return os << (TStreamable&)cl; }
  306. inline opstream& operator << ( opstream& os, TButton* cl )
  307.     { return os << (TStreamable *)cl; }
  308.  
  309. #endif  // Uses_TButton
  310.  
  311.  
  312. #if defined( Uses_TSItem ) && !defined( __TSItem )
  313. #define __TSItem
  314.  
  315. class TSItem
  316. {
  317.  
  318. public:
  319.  
  320.     TSItem( const char *aValue, TSItem *aNext )
  321.         { value = newStr(aValue); next = aNext; }
  322.     ~TSItem() { delete (void *)value; }
  323.  
  324.     const char *value;
  325.     TSItem *next;
  326. };
  327.  
  328. #endif  // Uses_TSItem
  329.  
  330. /* ---------------------------------------------------------------------- */
  331. /*      class TCluster                                                    */
  332. /*                                                                        */
  333. /*      Palette layout                                                    */
  334. /*        1 = Normal text                                                 */
  335. /*        2 = Selected text                                               */
  336. /*        3 = Normal shortcut                                             */
  337. /*        4 = Selected shortcut                                           */
  338. /*        5 = Disabled text                                               */
  339. /* ---------------------------------------------------------------------- */
  340.  
  341. #if defined( Uses_TCluster ) && !defined( __TCluster )
  342. #define __TCluster
  343.  
  344. class TRect;
  345. class TSItem;
  346. class TEvent;
  347. class TPoint;
  348. class TStringCollection;
  349.  
  350. class TCluster : public TView
  351. {
  352.  
  353. public:
  354.  
  355.     TCluster( const TRect& bounds, TSItem *aStrings );
  356.     ~TCluster();
  357.  
  358.     virtual ushort dataSize();
  359.     void drawBox( const char *icon, char marker );
  360.     void drawMultiBox(const char *icon, const char* marker);
  361.     virtual void getData( void *rec );
  362.     ushort getHelpCtx();
  363.     virtual TPalette& getPalette() const;
  364.     virtual void handleEvent( TEvent& event );
  365.     virtual Boolean mark( int item );
  366.     virtual uchar multiMark( int item );
  367.  
  368.     virtual void press( int item );
  369.     virtual void movedTo( int item );
  370.     virtual void setData( void *rec );
  371.     virtual void setState( ushort aState, Boolean enable );
  372.     virtual void setButtonState(unsigned long aMask, Boolean enable);
  373.  
  374. protected:
  375.  
  376.     unsigned long value;
  377.     unsigned long enableMask;
  378.     int sel;
  379.     TStringCollection *strings;
  380.  
  381. private:
  382.  
  383.     int column( int item );
  384.     int findSel( TPoint p );
  385.     int row( int item );
  386.     void moveSel(int, int);
  387.  
  388.     virtual const char *streamableName() const
  389.         { return name; }
  390.  
  391. protected:
  392.  
  393.     TCluster( StreamableInit );
  394.     virtual void write( opstream& );
  395.     virtual void *read( ipstream& );
  396.  
  397. public:
  398.     Boolean buttonState(int );
  399.  
  400.     static const char * const name;
  401.     static TStreamable *build();
  402.  
  403. };
  404.  
  405. inline ipstream& operator >> ( ipstream& is, TCluster& cl )
  406.     { return is >> (TStreamable&)cl; }
  407. inline ipstream& operator >> ( ipstream& is, TCluster*& cl )
  408.     { return is >> (void *&)cl; }
  409.  
  410. inline opstream& operator << ( opstream& os, TCluster& cl )
  411.     { return os << (TStreamable&)cl; }
  412. inline opstream& operator << ( opstream& os, TCluster* cl )
  413.     { return os << (TStreamable *)cl; }
  414.  
  415. #endif  // Uses_TCluster
  416.  
  417.  
  418. /* ---------------------------------------------------------------------- */
  419. /*      class TRadioButtons                                               */
  420. /*                                                                        */
  421. /*      Palette layout                                                    */
  422. /*        1 = Normal text                                                 */
  423. /*        2 = Selected text                                               */
  424. /*        3 = Normal shortcut                                             */
  425. /*        4 = Selected shortcut                                           */
  426. /* ---------------------------------------------------------------------- */
  427.  
  428.  
  429. #if defined( Uses_TRadioButtons ) && !defined( __TRadioButtons )
  430. #define __TRadioButtons
  431.  
  432. class TRect;
  433. class TSItem;
  434.  
  435. class TRadioButtons : public TCluster
  436. {
  437.  
  438. public:
  439.  
  440.     TRadioButtons( const TRect& bounds, TSItem *aStrings );
  441.  
  442.     virtual void draw();
  443.     virtual Boolean mark( int item );
  444.     virtual void movedTo( int item );
  445.     virtual void press( int item );
  446.     virtual void setData( void *rec );
  447.  
  448. private:
  449.  
  450.     static const char * button;
  451.     virtual const char *streamableName() const
  452.         { return name; }
  453.  
  454. protected:
  455.  
  456.     TRadioButtons( StreamableInit );
  457.  
  458. public:
  459.  
  460.     static const char * const name;
  461.     static TStreamable *build();
  462.  
  463. };
  464.  
  465. inline ipstream& operator >> ( ipstream& is, TRadioButtons& cl )
  466.     { return is >> (TStreamable&)cl; }
  467. inline ipstream& operator >> ( ipstream& is, TRadioButtons*& cl )
  468.     { return is >> (void *&)cl; }
  469.  
  470. inline opstream& operator << ( opstream& os, TRadioButtons& cl )
  471.     { return os << (TStreamable&)cl; }
  472. inline opstream& operator << ( opstream& os, TRadioButtons* cl )
  473.     { return os << (TStreamable *)cl; }
  474.  
  475. inline TRadioButtons::TRadioButtons( const TRect& bounds, TSItem *aStrings ) :
  476.     TCluster( bounds, aStrings )
  477. {
  478. }
  479.  
  480. #endif  // Uses_TRadioButtons
  481.  
  482.  
  483. /* ---------------------------------------------------------------------- */
  484. /*      TCheckBoxes                                                       */
  485. /*                                                                        */
  486. /*      Palette layout                                                    */
  487. /*        1 = Normal text                                                 */
  488. /*        2 = Selected text                                               */
  489. /*        3 = Normal shortcut                                             */
  490. /*        4 = Selected shortcut                                           */
  491. /* ---------------------------------------------------------------------- */
  492.  
  493. #if defined( Uses_TCheckBoxes ) && !defined( __TCheckBoxes )
  494. #define __TCheckBoxes
  495.  
  496. class TRect;
  497. class TSItem;
  498.  
  499. class TCheckBoxes : public TCluster
  500. {
  501.  
  502. public:
  503.  
  504.     TCheckBoxes( const TRect& bounds, TSItem *aStrings);
  505.  
  506.     virtual void draw();
  507.  
  508.     virtual Boolean mark( int item );
  509.     virtual void press( int item );
  510.  
  511. private:
  512.  
  513.     static const char * button;
  514.  
  515.     virtual const char *streamableName() const
  516.         { return name; }
  517.  
  518. protected:
  519.  
  520.     TCheckBoxes( StreamableInit );
  521.  
  522. public:
  523.  
  524.     static const char * const name;
  525.     static TStreamable *build();
  526.  
  527. };
  528.  
  529. inline ipstream& operator >> ( ipstream& is, TCheckBoxes& cl )
  530.     { return is >> (TStreamable&)cl; }
  531. inline ipstream& operator >> ( ipstream& is, TCheckBoxes*& cl )
  532.     { return is >> (void *&)cl; }
  533.  
  534. inline opstream& operator << ( opstream& os, TCheckBoxes& cl )
  535.     { return os << (TStreamable&)cl; }
  536. inline opstream& operator << ( opstream& os, TCheckBoxes* cl )
  537.     { return os << (TStreamable *)cl; }
  538.  
  539. inline TCheckBoxes::TCheckBoxes( const TRect& bounds, TSItem *aStrings) :
  540.     TCluster( bounds, aStrings )
  541. {
  542. }
  543.  
  544. #endif  // Uses_TCheckBoxes
  545.  
  546.  
  547. #if defined( Uses_TMultiCheckBoxes ) && !defined( __TMultiCheckBoxes )
  548. #define __TMultiCheckBoxes
  549.  
  550. const unsigned short cfOneBit       = 0x0101,
  551.                      cfTwoBits      = 0x0203,
  552.                      cfFourBits     = 0x040F,
  553.                      cfEightBits    = 0x08FF;
  554.  
  555. /* ---------------------------------------------------------------------- */
  556. /*      TMultiCheckBoxes                                                  */
  557. /*                                                                        */
  558. /*      Palette layout                                                    */
  559. /*        1 = Normal text                                                 */
  560. /*        2 = Selected text                                               */
  561. /*        3 = Normal shortcut                                             */
  562. /*        4 = Selected shortcut                                           */
  563. /* ---------------------------------------------------------------------- */
  564.  
  565. class TRect;
  566. class TSItem;
  567.  
  568. class TMultiCheckBoxes : public TCluster
  569. {
  570. public:
  571.     TMultiCheckBoxes(TRect&, TSItem*, uchar, ushort, const char*);
  572.     ~TMultiCheckBoxes();
  573.     virtual ushort dataSize();
  574.     virtual void draw();
  575.     virtual void getData(void *);
  576.     virtual uchar multiMark(int item);
  577.     virtual void press( int item );
  578.     virtual void setData(void*);
  579.  
  580. private:
  581.     uchar selRange;
  582.     ushort flags;
  583.     char* states;
  584. #ifndef __UNPATCHED
  585.     virtual const char *streamableName() const
  586.         { return name; }
  587. #endif
  588.  
  589. protected:
  590.  
  591.     TMultiCheckBoxes( StreamableInit );
  592.     virtual void write( opstream& );
  593.     virtual void *read( ipstream& );
  594.  
  595. public:
  596.     static const char * const name;
  597.     static TStreamable *build();
  598.  
  599. };
  600.  
  601. inline ipstream& operator >> ( ipstream& is, TMultiCheckBoxes& cl )
  602.     { return is >> (TStreamable&)cl; }
  603. inline ipstream& operator >> ( ipstream& is, TMultiCheckBoxes*& cl )
  604.     { return is >> (void *&)cl; }
  605.  
  606. inline opstream& operator << ( opstream& os, TMultiCheckBoxes& cl )
  607.     { return os << (TStreamable&)cl; }
  608. inline opstream& operator << ( opstream& os, TMultiCheckBoxes* cl )
  609.     { return os << (TStreamable *)cl; }
  610.  
  611. #endif
  612.  
  613.  
  614. #if defined( Uses_TListBox ) && !defined( __TListBox )
  615. #define __TListBox
  616.  
  617. class TRect;
  618. class TScrollBar;
  619. class TCollection;
  620.  
  621. struct TListBoxRec
  622. {
  623.     TCollection *items;
  624.     ushort selection;
  625. };
  626.  
  627. class TListBox : public TListViewer
  628. {
  629.  
  630. public:
  631.  
  632.     TListBox( const TRect& bounds, ushort aNumCols, TScrollBar *aScrollBar );
  633.     ~TListBox();
  634.  
  635.     virtual ushort dataSize();
  636.     virtual void getData( void *rec );
  637.     virtual void getText( char *dest, short item, short maxLen );
  638.     virtual void newList( TCollection *aList );
  639.     virtual void setData( void *rec );
  640.  
  641.     TCollection *list();
  642.  
  643. private:
  644.  
  645.     virtual const char *streamableName() const
  646.         { return name; }
  647.  
  648. protected:
  649.  
  650.     TCollection *items;
  651.  
  652.     TListBox( StreamableInit );
  653.     virtual void write( opstream& );
  654.     virtual void *read( ipstream& );
  655.  
  656. public:
  657.  
  658.     static const char * const name;
  659.     static TStreamable *build();
  660.  
  661. };
  662.  
  663. inline ipstream& operator >> ( ipstream& is, TListBox& cl )
  664.     { return is >> (TStreamable&)cl; }
  665. inline ipstream& operator >> ( ipstream& is, TListBox*& cl )
  666.     { return is >> (void *&)cl; }
  667.  
  668. inline opstream& operator << ( opstream& os, TListBox& cl )
  669.     { return os << (TStreamable&)cl; }
  670. inline opstream& operator << ( opstream& os, TListBox* cl )
  671.     { return os << (TStreamable *)cl; }
  672.  
  673. inline TCollection *TListBox::list()
  674. {
  675.     return items;
  676. }
  677.  
  678. #endif  // Uses_TListBox
  679.  
  680.  
  681. /* ---------------------------------------------------------------------- */
  682. /*      class TStaticText                                                 */
  683. /*                                                                        */
  684. /*      Palette layout                                                    */
  685. /*        1 = Text                                                        */
  686. /* ---------------------------------------------------------------------- */
  687.  
  688. #if defined( Uses_TStaticText ) && !defined( __TStaticText )
  689. #define __TStaticText
  690.  
  691. class TRect;
  692.  
  693. class TStaticText : public TView
  694. {
  695.  
  696. public:
  697.  
  698.     TStaticText( const TRect& bounds, const char *aText );
  699.     ~TStaticText();
  700.  
  701.     virtual void draw();
  702.     virtual TPalette& getPalette() const;
  703.     virtual void getText( char * );
  704.  
  705. protected:
  706.  
  707.     const char *text;
  708.  
  709. private:
  710.  
  711.     virtual const char *streamableName() const
  712.         { return name; }
  713.  
  714. protected:
  715.  
  716.     TStaticText( StreamableInit );
  717.     virtual void write( opstream& );
  718.     virtual void *read( ipstream& );
  719.  
  720. public:
  721.  
  722.     static const char * const name;
  723.     static TStreamable *build();
  724.  
  725. };
  726.  
  727. inline ipstream& operator >> ( ipstream& is, TStaticText& cl )
  728.     { return is >> (TStreamable&)cl; }
  729. inline ipstream& operator >> ( ipstream& is, TStaticText*& cl )
  730.     { return is >> (void *&)cl; }
  731.  
  732. inline opstream& operator << ( opstream& os, TStaticText& cl )
  733.     { return os << (TStreamable&)cl; }
  734. inline opstream& operator << ( opstream& os, TStaticText* cl )
  735.     { return os << (TStreamable *)cl; }
  736.  
  737. #endif  // Uses_TStaticText
  738.  
  739.  
  740. /* ---------------------------------------------------------------------- */
  741. /*      class TParamText                                                  */
  742. /*                                                                        */
  743. /*      Palette layout                                                    */
  744. /*        1 = Text                                                        */
  745. /* ---------------------------------------------------------------------- */
  746.  
  747. #if defined( Uses_TParamText ) && !defined( __TParamText )
  748. #define __TParamText
  749.  
  750. class TRect;
  751.  
  752. class TParamText : public TStaticText
  753. {
  754.  
  755. public:
  756.     TParamText( const TRect& bounds );
  757.     ~TParamText();
  758.  
  759.     virtual void getText( char *str );
  760.     virtual void setText( char *fmt, ... );
  761.     virtual int getTextLen();
  762.  
  763. protected:
  764.  
  765.     char *str;
  766.  
  767. private:
  768.  
  769.     virtual const char *streamableName() const
  770.         { return name; }
  771.  
  772. protected:
  773.  
  774.     TParamText( StreamableInit );
  775. #ifndef __UNPATCHED
  776.     virtual void write( opstream& );
  777.     virtual void *read( ipstream& );
  778. #endif
  779.  
  780. public:
  781.  
  782.     static const char * const name;
  783.     static TStreamable *build();
  784.  
  785. };
  786.  
  787. inline ipstream& operator >> ( ipstream& is, TParamText& cl )
  788.     { return is >> (TStreamable&)cl; }
  789. inline ipstream& operator >> ( ipstream& is, TParamText*& cl )
  790.     { return is >> (void *&)cl; }
  791.  
  792. inline opstream& operator << ( opstream& os, TParamText& cl )
  793.     { return os << (TStreamable&)cl; }
  794. inline opstream& operator << ( opstream& os, TParamText* cl )
  795.     { return os << (TStreamable *)cl; }
  796.  
  797. #endif  // Uses_TParamText
  798.  
  799.  
  800. /* ---------------------------------------------------------------------- */
  801. /*      class TLabel                                                      */
  802. /*                                                                        */
  803. /*      Palette layout                                                    */
  804. /*        1 = Normal text                                                 */
  805. /*        2 = Selected text                                               */
  806. /*        3 = Normal shortcut                                             */
  807. /*        4 = Selected shortcut                                           */
  808. /* ---------------------------------------------------------------------- */
  809.  
  810. #if defined( Uses_TLabel ) && !defined( __TLabel )
  811. #define __TLabel
  812.  
  813. class TRect;
  814. class TEvent;
  815. class TView;
  816.  
  817. class TLabel : public TStaticText
  818. {
  819.  
  820. public:
  821.  
  822.     TLabel( const TRect& bounds, const char *aText, TView *aLink );
  823.  
  824.     virtual void draw();
  825.     virtual TPalette& getPalette() const;
  826.     virtual void handleEvent( TEvent& event );
  827.     virtual void shutDown();
  828.  
  829. protected:
  830.  
  831.     TView *link;
  832.     Boolean light;
  833.  
  834. private:
  835.  
  836.     virtual const char *streamableName() const
  837.         { return name; }
  838.     void focusLink(TEvent&);
  839.  
  840. protected:
  841.  
  842.     TLabel( StreamableInit );
  843.     virtual void write( opstream& );
  844.     virtual void *read( ipstream& );
  845.  
  846. public:
  847.  
  848.     static const char * const name;
  849.     static TStreamable *build();
  850.  
  851. };
  852.  
  853. inline ipstream& operator >> ( ipstream& is, TLabel& cl )
  854.     { return is >> (TStreamable&)cl; }
  855. inline ipstream& operator >> ( ipstream& is, TLabel*& cl )
  856.     { return is >> (void *&)cl; }
  857.  
  858. inline opstream& operator << ( opstream& os, TLabel& cl )
  859.     { return os << (TStreamable&)cl; }
  860. inline opstream& operator << ( opstream& os, TLabel* cl )
  861.     { return os << (TStreamable *)cl; }
  862.  
  863. #endif  // Uses_TLabel
  864.  
  865.  
  866. /* ---------------------------------------------------------------------- */
  867. /*      class THistoryViewer                                              */
  868. /*                                                                        */
  869. /*      Palette layout                                                    */
  870. /*        1 = Active                                                      */
  871. /*        2 = Inactive                                                    */
  872. /*        3 = Focused                                                     */
  873. /*        4 = Selected                                                    */
  874. /*        5 = Divider                                                     */
  875. /* ---------------------------------------------------------------------- */
  876.  
  877. #if defined( Uses_THistoryViewer ) && !defined( __THistoryViewer )
  878. #define __THistoryViewer
  879.  
  880. class TRect;
  881. class TScrollBar;
  882.  
  883. class THistoryViewer : public TListViewer
  884. {
  885.  
  886. public:
  887.  
  888.     THistoryViewer( const TRect& bounds,
  889.                     TScrollBar *aHScrollBar,
  890.                     TScrollBar *aVScrollBar,
  891.                     ushort aHistoryId
  892.                   );
  893.  
  894.     virtual TPalette& getPalette() const;
  895.     virtual void getText( char *dest, short item, short maxLen );
  896.     virtual void handleEvent( TEvent& event );
  897.     int historyWidth();
  898.  
  899. protected:
  900.  
  901.     ushort historyId;
  902.  
  903. };
  904.  
  905. #endif  // Uses_THistoryViewer
  906.  
  907. #if defined( Uses_THistoryWindow ) && !defined( __THistoryWindow )
  908. #define __THistoryWindow
  909.  
  910. class TListViewer;
  911. class TRect;
  912. class TWindow;
  913. class TInputLine;
  914.  
  915. class THistInit
  916. {
  917.  
  918. public:
  919.  
  920.     THistInit( TListViewer *(*cListViewer)( TRect, TWindow *, ushort ) );
  921.  
  922. protected:
  923.  
  924.     TListViewer *(*createListViewer)( TRect, TWindow *, ushort );
  925.  
  926. };
  927.  
  928. /* ---------------------------------------------------------------------- */
  929. /*      THistoryWindow                                                    */
  930. /*                                                                        */
  931. /*      Palette layout                                                    */
  932. /*        1 = Frame passive                                               */
  933. /*        2 = Frame active                                                */
  934. /*        3 = Frame icon                                                  */
  935. /*        4 = ScrollBar page area                                         */
  936. /*        5 = ScrollBar controls                                          */
  937. /*        6 = HistoryViewer normal text                                   */
  938. /*        7 = HistoryViewer selected text                                 */
  939. /* ---------------------------------------------------------------------- */
  940.  
  941. class THistoryWindow : public TWindow, public virtual THistInit
  942. {
  943.  
  944. public:
  945.  
  946.     THistoryWindow( const TRect& bounds, ushort historyId );
  947.  
  948.     virtual TPalette& getPalette() const;
  949.     virtual void getSelection( char *dest );
  950.     static TListViewer *initViewer( TRect, TWindow *, ushort );
  951.  
  952. protected:
  953.  
  954.     TListViewer *viewer;
  955. };
  956.  
  957. #endif  // Uses_THistoryWindow
  958.  
  959. #if defined( Uses_THistory ) && !defined( __THistory )
  960. #define __THistory
  961.  
  962. class TRect;
  963. class TInputLine;
  964. class TEvent;
  965. class THistoryWindow;
  966.  
  967. class THistory : public TView
  968. {
  969.  
  970. public:
  971.  
  972.     THistory( const TRect& bounds, TInputLine *aLink, ushort aHistoryId );
  973.  
  974.     virtual void draw();
  975.     virtual TPalette& getPalette() const;
  976.     virtual void handleEvent( TEvent& event );
  977.     virtual THistoryWindow *initHistoryWindow( const TRect& bounds );
  978.     virtual void recordHistory(const char *s);
  979.     virtual void shutDown();
  980.     static const char * icon;
  981.  
  982. protected:
  983.  
  984.     TInputLine *link;
  985.     ushort historyId;
  986.  
  987. private:
  988.  
  989. //    static const char * icon;
  990.  
  991.     virtual const char *streamableName() const
  992.         { return name; }
  993.  
  994. protected:
  995.  
  996.     THistory( StreamableInit );
  997.     virtual void write( opstream& );
  998.     virtual void *read( ipstream& );
  999.  
  1000. public:
  1001.  
  1002.     static const char * const name;
  1003.     static TStreamable *build();
  1004.  
  1005. };
  1006.  
  1007. inline ipstream& operator >> ( ipstream& is, THistory& cl )
  1008.     { return is >> (TStreamable&)cl; }
  1009. inline ipstream& operator >> ( ipstream& is, THistory*& cl )
  1010.     { return is >> (void *&)cl; }
  1011.  
  1012. inline opstream& operator << ( opstream& os, THistory& cl )
  1013.     { return os << (TStreamable&)cl; }
  1014. inline opstream& operator << ( opstream& os, THistory* cl )
  1015.     { return os << (TStreamable *)cl; }
  1016.  
  1017. #endif  // Uses_THistory
  1018.