home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / BuildingBlocks / LogWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  3.4 KB  |  144 lines  |  [TEXT/R*ch]

  1. /*
  2.     File:        LogWindow.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __TYPES__
  15. #include <Types.h>
  16. #endif
  17.  
  18. #ifndef __WINDOWS__
  19. #include <Windows.h>
  20. #endif
  21.  
  22. #ifndef __MEMORY__
  23. #include <Memory.h>
  24. #endif
  25.  
  26. #ifndef __LIMITS__
  27. #include <Limits.h>
  28. #endif
  29.  
  30. #ifdef    __UNIVERSAL__
  31. #ifndef    __LOWMEM__
  32. #include <LowMem.h>
  33. #endif
  34. #else
  35. #ifndef    __SYSEQU__
  36. #include <SysEqu.h>
  37. #endif
  38. #endif
  39.  
  40. #ifndef __EVENTS__
  41. #include <Events.h>
  42. #endif
  43.  
  44. #ifndef __OSEVENTS__
  45. #include <OSEvents.h>
  46. #endif
  47.  
  48. #ifndef __STDIO__
  49. #include <stdio.h>
  50. #endif
  51.  
  52. /***********************************|****************************************/
  53.  
  54. const short kLogWindowHMargin = 5;
  55. const short kLogWindowVMargin = 10;
  56.  
  57. /***********************************|****************************************/
  58.  
  59. class TLogWindow : public TDirectObject
  60. {
  61. public:                                TLogWindow ( short windowID );
  62.         virtual                        ~TLogWindow ( );
  63.                                     
  64.         virtual void                 Show ( ) const;
  65.         virtual void                Hide ( ) const;
  66.         
  67.         virtual WindowPtr            GetWindowPtr () const;
  68.  
  69.         virtual void                WindowFocus(void);
  70.         virtual void                ContentFocus(void);
  71.  
  72.         virtual void                InsertRow ( unsigned long beforeWhichRow, unsigned long count = 1 );
  73.         virtual void                DeleteRow ( unsigned long whichRow, unsigned long count = 1);
  74.  
  75.         virtual void                Draw (void) const;
  76.         virtual void                Draw ( const Rect& rectToRedraw ) const;
  77.         
  78.         virtual void                DrawRow ( unsigned long whichRow ) const;
  79.         virtual void                ValidateRow ( unsigned long whichRow ) const;
  80.         virtual void                InvalidateRow ( unsigned long whichRow ) const;
  81.         
  82.         virtual unsigned long        GetRowCount () const;
  83.         virtual unsigned long        GetRowWidth ( ) const;
  84.         virtual Rect                GetRectForRow ( unsigned long whichRow ) const;
  85.         
  86.     static Boolean IsLogWindowEvent ( const EventRecord& event );
  87.  
  88.         /* Call before SizeWindow if you need to resize the debug window programmatically*/
  89.         void                         InvalidateGrowBox () const ;
  90.     
  91.         /* Call after SizeWindow if you need to resize the debug window programmatically*/
  92.         void                         Grown();
  93.  
  94.         void                         ShowPoint(Point pt);
  95.         void                         Scroll(short howManyLines);
  96.         void                         DoScrolling(void);
  97.  
  98. protected:
  99.         //    Call the following procedures in response to events for the WriteLnWindow.
  100.         //    (Test the window receiving the event against gDebugWindowPtr.
  101.     
  102.         void ActivateEvent(short modifiers);
  103.         void MouseDown(short where, Point pt, short modifiers);
  104.         void UpdateEvent();
  105.     
  106.     friend pascal void LogWindowTrackControlCallback ( ControlHandle aControl, short partCode );    
  107.  
  108.         
  109. protected:
  110.  
  111.         virtual Boolean                Initialize ( );
  112.         
  113.         short                        fWindowResID ;
  114.     
  115.         WindowPtr                    fDebugWindowPtr;    
  116.     
  117.         unsigned long                fRowCount;
  118.         short                        fHeight;
  119.         
  120.         ControlHandle                fSBars[2];                //    the window scroll bars
  121.  
  122.         Point                        fScrollOffset;
  123.         Point                        fViewSize;
  124.         
  125.         Rect                        fStdDrag;
  126.         Rect                        fStdSize;
  127.         RgnHandle                    fARgn;
  128.     
  129.         Boolean                        fScrollWindowWhenTextIsAdded;
  130. };
  131.  
  132. /***********************************|****************************************/
  133.  
  134. void DrawString ( short x, short y, StringPtr s );
  135. void DrawNumber ( short x, short y, long n );
  136.  
  137. void EraseLineTo ( short x, short y );
  138. void EraseLineTo ( short x, short y );
  139.  
  140. void EraseLineToDrawString ( short x, short y, StringPtr s );
  141. void EraseLineToDrawNumber ( short x, short y, long n );
  142.  
  143. /***********************************|****************************************/
  144.