home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / TVINC.ZIP / DIALOGS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  27.3 KB  |  906 lines

  1. /* ------------------------------------------------------------------------*/
  2. /*                                                                         */
  3. /*   DIALOGS.H                                                             */
  4. /*                                                                         */
  5. /*   Copyright (c) Borland International 1991                              */
  6. /*   All Rights Reserved.                                                  */
  7. /*                                                                         */
  8. /*   defines the classes TDialog, TInputLine, TButton, TCluster,           */
  9. /*   TRadioButtons, TCheckBoxes, TStaticText, TParamText, TLabel,          */
  10. /*   THistoryViewer, and THistoryWindow.                                   */
  11. /*                                                                         */
  12. /* ------------------------------------------------------------------------*/
  13.  
  14. #pragma option -Vo-
  15. #if defined( __BCOPT__ )
  16. #pragma option -po-
  17. #endif
  18.  
  19. #if !defined( __BUTTON_TYPE )
  20. #define __BUTTON_TYPE
  21.  
  22. const
  23.     bfNormal    = 0x00,
  24.     bfDefault   = 0x01,
  25.     bfLeftJust  = 0x02,
  26.     bfBroadcast = 0x04,
  27.  
  28.     cmRecordHistory = 60;
  29.  
  30. #endif  // __BUTTON_TYPE
  31.  
  32. /* ---------------------------------------------------------------------- */
  33. /*      class TDialog                                                     */
  34. /*                                                                        */
  35. /*      Palette layout                                                    */
  36. /*        1 = Frame passive                                               */
  37. /*        2 = Frame active                                                */
  38. /*        3 = Frame icon                                                  */
  39. /*        4 = ScrollBar page area                                         */
  40. /*        5 = ScrollBar controls                                          */
  41. /*        6 = StaticText                                                  */
  42. /*        7 = Label normal                                                */
  43. /*        8 = Label selected                                              */
  44. /*        9 = Label shortcut                                              */
  45. /*       10 = Button normal                                               */
  46. /*       11 = Button default                                              */
  47. /*       12 = Button selected                                             */
  48. /*       13 = Button disabled                                             */
  49. /*       14 = Button shortcut                                             */
  50. /*       15 = Button shadow                                               */
  51. /*       16 = Cluster normal                                              */
  52. /*       17 = Cluster selected                                            */
  53. /*       18 = Cluster shortcut                                            */
  54. /*       19 = InputLine normal text                                       */
  55. /*       20 = InputLine selected text                                     */
  56. /*       21 = InputLine arrows                                            */
  57. /*       22 = History arrow                                               */
  58. /*       23 = History sides                                               */
  59. /*       24 = HistoryWindow scrollbar page area                           */
  60. /*       25 = HistoryWindow scrollbar controls                            */
  61. /*       26 = ListViewer normal                                           */
  62. /*       27 = ListViewer focused                                          */
  63. /*       28 = ListViewer selected                                         */
  64. /*       29 = ListViewer divider                                          */
  65. /*       30 = InfoPane                                                    */
  66. /*       31 = Reserved                                                    */
  67. /*       32 = Reserved                                                    */
  68. /* ---------------------------------------------------------------------- */
  69.  
  70. #if defined( Uses_TDialog ) && !defined( __TDialog )
  71. #define __TDialog
  72.  
  73. class far TRect;
  74. class far TEvent;
  75.  
  76. class TDialog : public TWindow
  77. {
  78.  
  79. public:
  80.  
  81.     TDialog( const TRect& bounds, const char *aTitle );
  82.  
  83.     virtual TPalette& getPalette() const;
  84.     virtual void handleEvent( TEvent& event );
  85.     virtual Boolean valid( ushort command );
  86.  
  87. private:
  88.  
  89.     virtual const char *streamableName() const
  90.         { return name; }
  91.  
  92. protected:
  93.  
  94.     TDialog( StreamableInit );
  95.  
  96. public:
  97.  
  98.     static const char * const near name;
  99.     static TStreamable *build();
  100.  
  101. };
  102.  
  103. inline ipstream& operator >> ( ipstream& is, TDialog& cl )
  104.     { return is >> (TStreamable&)cl; }
  105. inline ipstream& operator >> ( ipstream& is, TDialog*& cl )
  106.     { return is >> (void *&)cl; }
  107.  
  108. inline opstream& operator << ( opstream& os, TDialog& cl )
  109.     { return os << (TStreamable&)cl; }
  110. inline opstream& operator << ( opstream& os, TDialog* cl )
  111.     { return os << (TStreamable *)cl; }
  112.  
  113. #endif  // Uses_TDialog
  114.  
  115. /* ---------------------------------------------------------------------- */
  116. /*      class TInputLine                                                  */
  117. /*                                                                        */
  118. /*      Palette layout                                                    */
  119. /*        1 = Passive                                                     */
  120. /*        2 = Active                                                      */
  121. /*        3 = Selected                                                    */
  122. /*        4 = Arrows                                                      */
  123. /* ---------------------------------------------------------------------- */
  124.  
  125. #if defined( Uses_TInputLine ) && !defined( __TInputLine )
  126. #define __TInputLine
  127.  
  128. class far TRect;
  129. class far TEvent;
  130.  
  131. class TInputLine : public TView
  132. {
  133.  
  134. public:
  135.  
  136.     TInputLine( const TRect& bounds, int aMaxLen );
  137.     ~TInputLine();
  138.  
  139.     virtual ushort dataSize();
  140.     virtual void draw();
  141.     virtual void getData( void *rec );
  142.     virtual TPalette& getPalette() const;
  143.     virtual void handleEvent( TEvent& event );
  144.     void selectAll( Boolean enable );
  145.     virtual void setData( void *rec );
  146.     virtual void setState( ushort aState, Boolean enable );
  147.  
  148.     char* data;
  149.     int maxLen;
  150.     int curPos;
  151.     int firstPos;
  152.     int selStart;
  153.     int selEnd;
  154.  
  155. private:
  156.  
  157.     Boolean canScroll( int delta );
  158.     int mouseDelta( TEvent& event );
  159.     int mousePos( TEvent& event );
  160.     void deleteSelect();
  161.  
  162.     static const char near rightArrow;
  163.     static const char near leftArrow;
  164.     
  165.     virtual const char *streamableName() const
  166.         { return name; }
  167.  
  168. protected:
  169.  
  170.     TInputLine( StreamableInit );
  171.     virtual void write( opstream& );
  172.     virtual void *read( ipstream& );
  173.  
  174. public:
  175.  
  176.     static const char * const near name;
  177.     static TStreamable *build();
  178.  
  179. };
  180.  
  181. inline ipstream& operator >> ( ipstream& is, TInputLine& cl )
  182.     { return is >> (TStreamable&)cl; }
  183. inline ipstream& operator >> ( ipstream& is, TInputLine*& cl )
  184.     { return is >> (void *&)cl; }
  185.  
  186. inline opstream& operator << ( opstream& os, TInputLine& cl )
  187.     { return os << (TStreamable&)cl; }
  188. inline opstream& operator << ( opstream& os, TInputLine* cl )
  189.     { return os << (TStreamable *)cl; }
  190.  
  191. #endif  // Uses_TInputLine
  192.  
  193.  
  194. /* ---------------------------------------------------------------------- */
  195. /*      TButton object                                                    */
  196. /*                                                                        */
  197. /*      Palette layout                                                    */
  198. /*        1 = Normal text                                                 */
  199. /*        2 = Default text                                                */
  200. /*        3 = Selected text                                               */
  201. /*        4 = Disabled text                                               */
  202. /*        5 = Normal shortcut                                             */
  203. /*        6 = Default shortcut                                            */
  204. /*        7 = Selected shortcut                                           */
  205. /*        8 = Shadow                                                      */
  206. /* ---------------------------------------------------------------------- */
  207.  
  208. #if defined( Uses_TButton ) && !defined( __TButton )
  209. #define __TButton
  210.  
  211. class far TRect;
  212. class far TEvent;
  213. class far TDrawBuffer;
  214.  
  215. class TButton : public TView
  216. {
  217.  
  218. public:
  219.  
  220.     TButton( const TRect& bounds,
  221.              const char *aTitle,
  222.              ushort aCommand,
  223.              ushort aFlags
  224.            );
  225.     ~TButton();
  226.  
  227.     virtual void draw();
  228.     void drawState( Boolean down );
  229.     virtual TPalette& getPalette() const;
  230.     virtual void handleEvent( TEvent& event );
  231.     void makeDefault( Boolean enable );
  232.     virtual void press();
  233.     virtual void setState( ushort aState, Boolean enable );
  234.  
  235.     const char *title;
  236.  
  237. protected:
  238.  
  239.     ushort command;
  240.     uchar flags;
  241.     Boolean amDefault;
  242.  
  243. private:
  244.  
  245.     void drawTitle( TDrawBuffer&, int, int, ushort, Boolean );
  246.     void pressButton( TEvent& );
  247.     TRect getActiveRect();
  248.  
  249.     static const char * near shadows;
  250.     static const char * near markers;
  251.     
  252.     virtual const char *streamableName() const
  253.         { return name; }
  254.  
  255. protected:
  256.  
  257.     TButton( StreamableInit ): TView( streamableInit ) {};
  258.     virtual void write( opstream& );
  259.     virtual void *read( ipstream& );
  260.  
  261. public:
  262.  
  263.     static const char * const near name;
  264.     static TStreamable *build();
  265.  
  266. };
  267.  
  268. inline ipstream& operator >> ( ipstream& is, TButton& cl )
  269.     { return is >> (TStreamable&)cl; }
  270. inline ipstream& operator >> ( ipstream& is, TButton*& cl )
  271.     { return is >> (void *&)cl; }
  272.  
  273. inline opstream& operator << ( opstream& os, TButton& cl )
  274.     { return os << (TStreamable&)cl; }
  275. inline opstream& operator << ( opstream& os, TButton* cl )
  276.     { return os << (TStreamable *)cl; }
  277.  
  278. #endif  // Uses_TButton
  279.  
  280.  
  281. #if defined( Uses_TSItem ) && !defined( __TSItem )
  282. #define __TSItem
  283.  
  284. class TSItem
  285. {
  286.  
  287. public:
  288.  
  289.     TSItem( const char *aValue, TSItem *aNext )
  290.         { value = newStr(aValue); next = aNext; }
  291.     ~TSItem() { delete (void *)value; }
  292.  
  293.     const char *value;
  294.     TSItem *next;
  295. };
  296.  
  297. #endif  // Uses_TSItem
  298.  
  299. /* ---------------------------------------------------------------------- */
  300. /*      class TCluster                                                    */
  301. /*                                                                        */
  302. /*      Palette layout                                                    */
  303. /*        1 = Normal text                                                 */
  304. /*        2 = Selected text                                               */
  305. /*        3 = Normal shortcut                                             */
  306. /*        4 = Selected shortcut                                           */
  307. /* ---------------------------------------------------------------------- */
  308.  
  309. #if defined( Uses_TCluster ) && !defined( __TCluster )
  310. #define __TCluster
  311.  
  312. class far TRect;
  313. class far TSItem;
  314. class far TEvent;
  315. class far TPoint;
  316. class far TStringCollection;
  317.  
  318. class TCluster : public TView
  319. {
  320.  
  321. public:
  322.  
  323.     TCluster( const TRect& bounds, TSItem *aStrings );
  324.     ~TCluster();
  325.  
  326.     virtual ushort dataSize();
  327.     void drawBox( const char *icon, char marker );
  328.     virtual void getData( void *rec );
  329.     ushort getHelpCtx();
  330.     virtual TPalette& getPalette() const;
  331.     virtual void handleEvent( TEvent& event );
  332.     virtual Boolean mark( int item );
  333.     virtual void press( int item );
  334.     virtual void movedTo( int item );
  335.     virtual void setData( void *rec );
  336.     virtual void setState( ushort aState, Boolean enable );
  337.  
  338. protected:
  339.  
  340.     ushort value;
  341.     int sel;
  342.     TStringCollection *strings;
  343.  
  344. private:
  345.  
  346.     int column( int item );
  347.     int findSel( TPoint p );
  348.     int row( int item );
  349.  
  350.     virtual const char *streamableName() const
  351.         { return name; }
  352.  
  353. protected:
  354.  
  355.     TCluster( StreamableInit );
  356.     virtual void write( opstream& );
  357.     virtual void *read( ipstream& );
  358.  
  359. public:
  360.  
  361.     static const char * const near name;
  362.     static TStreamable *build();
  363.  
  364. };
  365.  
  366. inline ipstream& operator >> ( ipstream& is, TCluster& cl )
  367.     { return is >> (TStreamable&)cl; }
  368. inline ipstream& operator >> ( ipstream& is, TCluster*& cl )
  369.     { return is >> (void *&)cl; }
  370.  
  371. inline opstream& operator << ( opstream& os, TCluster& cl )
  372.     { return os << (TStreamable&)cl; }
  373. inline opstream& operator << ( opstream& os, TCluster* cl )
  374.     { return os << (TStreamable *)cl; }
  375.  
  376. #endif  // Uses_TCluster
  377.  
  378.  
  379. /* ---------------------------------------------------------------------- */
  380. /*      class TRadioButtons                                               */
  381. /*                                                                        */
  382. /*      Palette layout                                                    */
  383. /*        1 = Normal text                                                 */
  384. /*        2 = Selected text                                               */
  385. /*        3 = Normal shortcut                                             */
  386. /*        4 = Selected shortcut                                           */
  387. /* ---------------------------------------------------------------------- */
  388.  
  389.  
  390. #if defined( Uses_TRadioButtons ) && !defined( __TRadioButtons )
  391. #define __TRadioButtons
  392.  
  393. class far TRect;
  394. class far TSItem;
  395.  
  396. class TRadioButtons : public TCluster
  397. {
  398.  
  399. public:
  400.  
  401.     TRadioButtons( const TRect& bounds, TSItem *aStrings );
  402.  
  403.     virtual void draw();
  404.     virtual Boolean mark( int item );
  405.     virtual void movedTo( int item );
  406.     virtual void press( int item );
  407.     virtual void setData( void *rec );
  408.  
  409. private:
  410.  
  411.     static const char * near button;
  412.     virtual const char *streamableName() const
  413.         { return name; }
  414.  
  415. protected:
  416.  
  417.     TRadioButtons( StreamableInit );
  418.  
  419. public:
  420.  
  421.     static const char * const near name;
  422.     static TStreamable *build();
  423.  
  424. };
  425.  
  426. inline ipstream& operator >> ( ipstream& is, TRadioButtons& cl )
  427.     { return is >> (TStreamable&)cl; }
  428. inline ipstream& operator >> ( ipstream& is, TRadioButtons*& cl )
  429.     { return is >> (void *&)cl; }
  430.  
  431. inline opstream& operator << ( opstream& os, TRadioButtons& cl )
  432.     { return os << (TStreamable&)cl; }
  433. inline opstream& operator << ( opstream& os, TRadioButtons* cl )
  434.     { return os << (TStreamable *)cl; }
  435.  
  436. inline TRadioButtons::TRadioButtons( const TRect& bounds, TSItem *aStrings ) :
  437.     TCluster( bounds, aStrings )
  438. {
  439. }
  440.  
  441. #endif  // Uses_TRadioButtons
  442.  
  443.  
  444. /* ---------------------------------------------------------------------- */
  445. /*      TCheckBoxes                                                       */
  446. /*                                                                        */
  447. /*      Palette layout                                                    */
  448. /*        1 = Normal text                                                 */
  449. /*        2 = Selected text                                               */
  450. /*        3 = Normal shortcut                                             */
  451. /*        4 = Selected shortcut                                           */
  452. /* ---------------------------------------------------------------------- */
  453.  
  454. #if defined( Uses_TCheckBoxes ) && !defined( __TCheckBoxes )
  455. #define __TCheckBoxes
  456.  
  457. class far TRect;
  458. class far TSItem;
  459.  
  460. class TCheckBoxes : public TCluster
  461. {
  462.  
  463. public:
  464.  
  465.     TCheckBoxes( const TRect& bounds, TSItem *aStrings);
  466.  
  467.     virtual void draw();
  468.     
  469.     virtual Boolean mark( int item );
  470.     virtual void press( int item );
  471.  
  472. private:
  473.  
  474.     static const char * near button;
  475.  
  476.     virtual const char *streamableName() const
  477.         { return name; }
  478.  
  479. protected:
  480.  
  481.     TCheckBoxes( StreamableInit );
  482.  
  483. public:
  484.  
  485.     static const char * const near name;
  486.     static TStreamable *build();
  487.  
  488. };
  489.  
  490. inline ipstream& operator >> ( ipstream& is, TCheckBoxes& cl )
  491.     { return is >> (TStreamable&)cl; }
  492. inline ipstream& operator >> ( ipstream& is, TCheckBoxes*& cl )
  493.     { return is >> (void *&)cl; }
  494.  
  495. inline opstream& operator << ( opstream& os, TCheckBoxes& cl )
  496.     { return os << (TStreamable&)cl; }
  497. inline opstream& operator << ( opstream& os, TCheckBoxes* cl )
  498.     { return os << (TStreamable *)cl; }
  499.  
  500. inline TCheckBoxes::TCheckBoxes( const TRect& bounds, TSItem *aStrings) :
  501.     TCluster( bounds, aStrings )
  502. {
  503. }
  504.  
  505. #endif  // Uses_TCheckBoxes
  506.  
  507.  
  508. #if defined( Uses_TListBox ) && !defined( __TListBox )
  509. #define __TListBox
  510.  
  511. class far TRect;
  512. class far TScrollBar;
  513. class far TCollection;
  514.  
  515. class TListBox : public TListViewer
  516. {
  517.  
  518. public:
  519.  
  520.     TListBox( const TRect& bounds, ushort aNumCols, TScrollBar *aScrollBar );
  521.     ~TListBox();
  522.  
  523.     virtual ushort dataSize();
  524.     virtual void getData( void *rec );
  525.     virtual void getText( char *dest, short item, short maxLen );
  526.     virtual void newList( TCollection *aList );
  527.     virtual void setData( void *rec );
  528.  
  529.     TCollection *list();
  530.  
  531. private:
  532.  
  533.     TCollection *items;
  534.     
  535.     virtual const char *streamableName() const
  536.         { return name; }
  537.  
  538. protected:
  539.  
  540.     TListBox( StreamableInit );
  541.     virtual void write( opstream& );
  542.     virtual void *read( ipstream& );
  543.  
  544. public:
  545.  
  546.     static const char * const near name;
  547.     static TStreamable *build();
  548.  
  549. };
  550.  
  551. inline ipstream& operator >> ( ipstream& is, TListBox& cl )
  552.     { return is >> (TStreamable&)cl; }
  553. inline ipstream& operator >> ( ipstream& is, TListBox*& cl )
  554.     { return is >> (void *&)cl; }
  555.  
  556. inline opstream& operator << ( opstream& os, TListBox& cl )
  557.     { return os << (TStreamable&)cl; }
  558. inline opstream& operator << ( opstream& os, TListBox* cl )
  559.     { return os << (TStreamable *)cl; }
  560.  
  561. inline TCollection *TListBox::list()
  562. {
  563.     return items;
  564. }
  565.  
  566. #endif  // Uses_TListBox
  567.  
  568.  
  569. /* ---------------------------------------------------------------------- */
  570. /*      class TStaticText                                                 */
  571. /*                                                                        */
  572. /*      Palette layout                                                    */
  573. /*        1 = Text                                                        */
  574. /* ---------------------------------------------------------------------- */
  575.  
  576. #if defined( Uses_TStaticText ) && !defined( __TStaticText )
  577. #define __TStaticText
  578.  
  579. class far TRect;
  580.  
  581. class TStaticText : public TView
  582. {
  583.  
  584. public:
  585.  
  586.     TStaticText( const TRect& bounds, const char *aText );
  587.     ~TStaticText();
  588.  
  589.     virtual void draw();
  590.     virtual TPalette& getPalette() const;
  591.     virtual void getText( char * );
  592.  
  593. protected:
  594.  
  595.     const char *text;
  596.  
  597. private:
  598.  
  599.     virtual const char *streamableName() const
  600.         { return name; }
  601.  
  602. protected:
  603.  
  604.     TStaticText( StreamableInit );
  605.     virtual void write( opstream& );
  606.     virtual void *read( ipstream& );
  607.  
  608. public:
  609.  
  610.     static const char * const near name;
  611.     static TStreamable *build();
  612.  
  613. };
  614.  
  615. inline ipstream& operator >> ( ipstream& is, TStaticText& cl )
  616.     { return is >> (TStreamable&)cl; }
  617. inline ipstream& operator >> ( ipstream& is, TStaticText*& cl )
  618.     { return is >> (void *&)cl; }
  619.  
  620. inline opstream& operator << ( opstream& os, TStaticText& cl )
  621.     { return os << (TStreamable&)cl; }
  622. inline opstream& operator << ( opstream& os, TStaticText* cl )
  623.     { return os << (TStreamable *)cl; }
  624.  
  625. #endif  // Uses_TStaticText
  626.  
  627.  
  628. /* ---------------------------------------------------------------------- */
  629. /*      class TParamText                                                  */
  630. /*                                                                        */
  631. /*      Palette layout                                                    */
  632. /*        1 = Text                                                        */
  633. /* ---------------------------------------------------------------------- */
  634.  
  635. #if defined( Uses_TParamText ) && !defined( __TParamText )
  636. #define __TParamText
  637.  
  638. class far TRect;
  639.  
  640. class TParamText : public TStaticText
  641. {
  642.  
  643. public:
  644.     TParamText( const TRect& bounds, const char *aText, int aParamCount );
  645.  
  646.     virtual ushort dataSize();
  647.     virtual void getText( char * );
  648.     virtual void setData( void *rec );
  649.  
  650. protected:
  651.  
  652.     short paramCount;
  653.     void *paramList;
  654.  
  655. private:
  656.  
  657.     virtual const char *streamableName() const
  658.         { return name; }
  659.  
  660. protected:
  661.  
  662.     TParamText( StreamableInit );
  663.     virtual void write( opstream& );
  664.     virtual void *read( ipstream& );
  665.  
  666. public:
  667.  
  668.     static const char * const near name;
  669.     static TStreamable *build();
  670.  
  671. };
  672.  
  673. inline ipstream& operator >> ( ipstream& is, TParamText& cl )
  674.     { return is >> (TStreamable&)cl; }
  675. inline ipstream& operator >> ( ipstream& is, TParamText*& cl )
  676.     { return is >> (void *&)cl; }
  677.  
  678. inline opstream& operator << ( opstream& os, TParamText& cl )
  679.     { return os << (TStreamable&)cl; }
  680. inline opstream& operator << ( opstream& os, TParamText* cl )
  681.     { return os << (TStreamable *)cl; }
  682.  
  683. #endif  // Uses_TParamText
  684.  
  685.  
  686. /* ---------------------------------------------------------------------- */
  687. /*      class TLabel                                                      */
  688. /*                                                                        */
  689. /*      Palette layout                                                    */
  690. /*        1 = Normal text                                                 */
  691. /*        2 = Selected text                                               */
  692. /*        3 = Normal shortcut                                             */
  693. /*        4 = Selected shortcut                                           */
  694. /* ---------------------------------------------------------------------- */
  695.  
  696. #if defined( Uses_TLabel ) && !defined( __TLabel )
  697. #define __TLabel
  698.  
  699. class far TRect;
  700. class far TEvent;
  701. class far TView;
  702.  
  703. class TLabel : public TStaticText
  704. {
  705.  
  706. public:
  707.  
  708.     TLabel( const TRect& bounds, const char *aText, TView *aLink );
  709.  
  710.     virtual void draw();
  711.     virtual TPalette& getPalette() const;
  712.     virtual void handleEvent( TEvent& event );
  713.     virtual void shutDown();
  714.  
  715. protected:
  716.  
  717.     TView *link;
  718.     Boolean light;
  719.  
  720. private:
  721.  
  722.     virtual const char *streamableName() const
  723.         { return name; }
  724.  
  725. protected:
  726.  
  727.     TLabel( StreamableInit );
  728.     virtual void write( opstream& );
  729.     virtual void *read( ipstream& );
  730.  
  731. public:
  732.  
  733.     static const char * const near name;
  734.     static TStreamable *build();
  735.  
  736. };
  737.  
  738. inline ipstream& operator >> ( ipstream& is, TLabel& cl )
  739.     { return is >> (TStreamable&)cl; }
  740. inline ipstream& operator >> ( ipstream& is, TLabel*& cl )
  741.     { return is >> (void *&)cl; }
  742.  
  743. inline opstream& operator << ( opstream& os, TLabel& cl )
  744.     { return os << (TStreamable&)cl; }
  745. inline opstream& operator << ( opstream& os, TLabel* cl )
  746.     { return os << (TStreamable *)cl; }
  747.  
  748. #endif  // Uses_TLabel
  749.  
  750.  
  751. /* ---------------------------------------------------------------------- */
  752. /*      class THistoryViewer                                              */
  753. /*                                                                        */
  754. /*      Palette layout                                                    */
  755. /*        1 = Active                                                      */
  756. /*        2 = Inactive                                                    */
  757. /*        3 = Focused                                                     */
  758. /*        4 = Selected                                                    */
  759. /*        5 = Divider                                                     */
  760. /* ---------------------------------------------------------------------- */
  761.  
  762. #if defined( Uses_THistoryViewer ) && !defined( __THistoryViewer )
  763. #define __THistoryViewer
  764.  
  765. class far TRect;
  766. class far TScrollBar;
  767.  
  768. class THistoryViewer : public TListViewer
  769. {
  770.  
  771. public:
  772.  
  773.     THistoryViewer( const TRect& bounds,
  774.                     TScrollBar *aHScrollBar,
  775.                     TScrollBar *aVScrollBar,
  776.                     ushort aHistoryId
  777.                   );
  778.  
  779.     virtual TPalette& getPalette() const;
  780.     virtual void getText( char *dest, short item, short maxLen );
  781.     virtual void handleEvent( TEvent& event );
  782.     int historyWidth();
  783.  
  784. protected:
  785.  
  786.     ushort historyId;
  787.  
  788. };
  789.  
  790. #endif  // Uses_THistoryViewer
  791.  
  792. #if defined( Uses_THistoryWindow ) && !defined( __THistoryWindow )
  793. #define __THistoryWindow
  794.  
  795. class far TListViewer;
  796. class far TRect;
  797. class far TWindow;
  798. class far TInputLine;
  799.  
  800. class THistInit
  801. {
  802.  
  803. public:
  804.  
  805.     THistInit( TListViewer *(*cListViewer)( TRect, TWindow *, ushort ) );
  806.  
  807. protected:
  808.  
  809.     TListViewer *(*createListViewer)( TRect, TWindow *, ushort );
  810.  
  811. };
  812.  
  813. /* ---------------------------------------------------------------------- */
  814. /*      THistoryWindow                                                    */
  815. /*                                                                        */
  816. /*      Palette layout                                                    */
  817. /*        1 = Frame passive                                               */
  818. /*        2 = Frame active                                                */
  819. /*        3 = Frame icon                                                  */
  820. /*        4 = ScrollBar page area                                         */
  821. /*        5 = ScrollBar controls                                          */
  822. /*        6 = HistoryViewer normal text                                   */
  823. /*        7 = HistoryViewer selected text                                 */
  824. /* ---------------------------------------------------------------------- */
  825.  
  826. class THistoryWindow : public TWindow, public virtual THistInit
  827. {
  828.  
  829. public:
  830.  
  831.     THistoryWindow( const TRect& bounds, ushort historyId );
  832.  
  833.     virtual TPalette& getPalette() const;
  834.     virtual void getSelection( char *dest );
  835.     static TListViewer *initViewer( TRect, TWindow *, ushort );
  836.  
  837. protected:
  838.  
  839.     TListViewer *viewer;
  840. };
  841.  
  842. #endif  // Uses_THistoryWindow
  843.  
  844. #if defined( Uses_THistory ) && !defined( __THistory )
  845. #define __THistory
  846.  
  847. class far TRect;
  848. class far TInputLine;
  849. class far TEvent;
  850. class far THistoryWindow;
  851.  
  852. class THistory : public TView
  853. {
  854.  
  855. public:
  856.  
  857.     THistory( const TRect& bounds, TInputLine *aLink, ushort aHistoryId );
  858.  
  859.     virtual void draw();
  860.     virtual TPalette& getPalette() const;
  861.     virtual void handleEvent( TEvent& event );
  862.     virtual THistoryWindow *initHistoryWindow( const TRect& bounds );
  863.     virtual void shutDown();
  864. protected:
  865.  
  866.     TInputLine *link;
  867.     ushort historyId;
  868.  
  869. private:
  870.  
  871.     static const char * near icon;
  872.  
  873.     virtual const char *streamableName() const
  874.         { return name; }
  875.  
  876. protected:
  877.  
  878.     THistory( StreamableInit );
  879.     virtual void write( opstream& );
  880.     virtual void *read( ipstream& );
  881.  
  882. public:
  883.  
  884.     static const char * const near name;
  885.     static TStreamable *build();
  886.  
  887. };
  888.  
  889. inline ipstream& operator >> ( ipstream& is, THistory& cl )
  890.     { return is >> (TStreamable&)cl; }
  891. inline ipstream& operator >> ( ipstream& is, THistory*& cl )
  892.     { return is >> (void *&)cl; }
  893.  
  894. inline opstream& operator << ( opstream& os, THistory& cl )
  895.     { return os << (TStreamable&)cl; }
  896. inline opstream& operator << ( opstream& os, THistory* cl )
  897.     { return os << (TStreamable *)cl; }
  898.  
  899. #endif  // Uses_THistory
  900.  
  901. #pragma option -Vo.
  902. #if defined( __BCOPT__ )
  903. #pragma option -po.
  904. #endif
  905.  
  906.