home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / Conic Sections 0.9.2 / Sources / ScrollTextBox.cpp < prev   
Encoding:
Text File  |  1997-07-20  |  794 b   |  46 lines  |  [TEXT/CWIE]

  1. //Copyright (c) 1997 Aidan Cully
  2. //All rights reserved
  3.  
  4. #include "ScrollTextBox.h"
  5. #include "CLNullHandler.h"
  6.  
  7. TScrollStyleBox::TScrollStyleBox(
  8.   TLayoutBranch *super,
  9.   short resID
  10.   ):
  11.     TStyleBox( super, resID ),
  12.     mTime( 0 ),
  13.     mDelay( 20 )
  14. {
  15. }
  16.  
  17. TScrollStyleBox::~TScrollStyleBox()
  18. {
  19.     TNullHandler::GetNullHandler()->RemovePulsar( this );
  20. }
  21.  
  22. void TScrollStyleBox::Pulse(
  23.   const TEvent *ev
  24.   )
  25. {
  26.     if( mDelay )
  27.         mDelay--;
  28.     else {
  29.         if( mPos.v+mHeight<0 )
  30.             ScrollTo( 0, mContentRect.bottom-mContentRect.top );
  31.         else
  32.             ScrollTo( 0, mPos.v-1 );
  33.         if( !mPos.v )
  34.             mDelay= 20;
  35.     }
  36. }
  37.  
  38. void TScrollStyleBox::AttachedToWindow(
  39.   TBaseWindow *win,
  40.   Rect size
  41.   )
  42. {
  43.     TStyleBox::AttachedToWindow( win, size );
  44.     TNullHandler::GetNullHandler()->AddPulsar( this );
  45.     ::TESetJust( teJustCenter, mTE );
  46. }