home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tv20os2.zip / src / THistoryWindow.cpp < prev    next >
C/C++ Source or Header  |  1998-01-19  |  1KB  |  54 lines

  1. /*
  2.  * THistoryWindow.cc
  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. #define Uses_THistoryWindow
  13. #define Uses_THistoryViewer
  14. #include <tvision/tv.h>
  15.  
  16. THistInit::THistInit( TListViewer *(*cListViewer)( TRect, TWindow *, ushort ) ) :
  17.     createListViewer( cListViewer )
  18. {
  19. }
  20.  
  21. #define cpHistoryWindow "\x13\x13\x15\x18\x17\x13\x14"
  22.  
  23. THistoryWindow::THistoryWindow( const TRect& bounds,
  24.                                 ushort historyId ) :
  25.     THistInit( &THistoryWindow::initViewer ),
  26.     TWindow( bounds, 0, wnNoNumber),
  27.     TWindowInit( &THistoryWindow::initFrame )
  28. {
  29.     flags = wfClose;
  30.     if( createListViewer != 0 &&
  31.         (viewer = createListViewer( getExtent(), this, historyId )) != 0 )
  32.         insert( viewer );
  33. }
  34.  
  35. TPalette& THistoryWindow::getPalette() const
  36. {
  37.     static TPalette palette( cpHistoryWindow, sizeof( cpHistoryWindow )-1 );
  38.     return palette;
  39. }
  40.  
  41. void THistoryWindow::getSelection( char *dest )
  42. {
  43.     viewer->getText( dest, viewer->focused, 255 );
  44. }
  45.  
  46. TListViewer *THistoryWindow::initViewer( TRect r, TWindow * win, ushort historyId )
  47. {
  48.     r.grow( -1, -1 );
  49.     return new THistoryViewer( r,
  50.         win->standardScrollBar( sbHorizontal | sbHandleKeyboard ),
  51.         win->standardScrollBar( sbVertical | sbHandleKeyboard ),
  52.         historyId);
  53. }
  54.