home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 10.ddi / TVSRC.ZIP / THISTWIN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.2 KB  |  60 lines

  1. /*------------------------------------------------------------*/
  2. /* filename -       thistwin.cpp                              */
  3. /*                                                            */
  4. /* function(s)                                                */
  5. /*                  THistoryWindow member functions           */
  6. /*------------------------------------------------------------*/
  7.  
  8. /*------------------------------------------------------------*/
  9. /*                                                            */
  10. /*    Turbo Vision -  Version 1.0                             */
  11. /*                                                            */
  12. /*                                                            */
  13. /*    Copyright (c) 1991 by Borland International             */
  14. /*    All Rights Reserved.                                    */
  15. /*                                                            */
  16. /*------------------------------------------------------------*/
  17.  
  18. #define Uses_THistoryWindow
  19. #define Uses_THistoryViewer
  20. #include <tv.h>
  21.  
  22. THistInit::THistInit( TListViewer *(*cListViewer)( TRect, TWindow *, ushort ) ) :
  23.     createListViewer( cListViewer )
  24. {
  25. }
  26.  
  27. #define cpHistoryWindow "\x13\x13\x15\x18\x17\x13\x14"
  28.  
  29. THistoryWindow::THistoryWindow( const TRect& bounds,
  30.                                 ushort historyId ) :
  31.     THistInit( &THistoryWindow::initViewer ),
  32.     TWindow( bounds, 0, wnNoNumber),
  33.     TWindowInit( &THistoryWindow::initFrame )
  34. {
  35.     flags = wfClose;
  36.     if( createListViewer != 0 &&
  37.         (viewer = createListViewer( getExtent(), this, historyId )) != 0 )
  38.         insert( viewer );
  39. }
  40.  
  41. TPalette& THistoryWindow::getPalette() const
  42. {
  43.     static TPalette palette( cpHistoryWindow, sizeof( cpHistoryWindow )-1 );
  44.     return palette;
  45. }
  46.  
  47. void THistoryWindow::getSelection( char *dest )
  48. {
  49.     viewer->getText( dest, viewer->focused, 255 );
  50. }
  51.  
  52. TListViewer *THistoryWindow::initViewer( TRect r, TWindow * win, ushort historyId )
  53. {
  54.     r.grow( -1, -1 );
  55.     return new THistoryViewer( r,
  56.         win->standardScrollBar( sbHorizontal | sbHandleKeyboard ),
  57.         win->standardScrollBar( sbVertical | sbHandleKeyboard ),
  58.         historyId);
  59. }
  60.