home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / MotifApp / ch2 / Stopwatch.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  1.9 KB  |  71 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////
  3. //         This example code is from the book:
  4. //
  5. //           Object-Oriented Programming with C++ and OSF/Motif
  6. //         by
  7. //           Douglas Young
  8. //           Prentice Hall, 1992
  9. //           ISBN 0-13-630252-1    
  10. //
  11. //         Copyright 1991 by Prentice Hall
  12. //         All Rights Reserved
  13. //
  14. //  Permission to use, copy, modify, and distribute this software for 
  15. //  any purpose except publication and without fee is hereby granted, provided 
  16. //  that the above copyright notice appear in all copies of the software.
  17. ///////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19.  
  20.  
  21. ////////////////////////////////////////////////////////////////
  22. // Stopwatch.C: Group subcomponents into one stopwatch component
  23. /////////////////////////////////////////////////////////////////
  24. #include "Stopwatch.h"
  25. #include <Xm/Xm.h>
  26. #include <Xm/RowColumn.h>
  27. #include "Timer.h"
  28. #include "Face.h"
  29. #include "Control.h"
  30.  
  31. Stopwatch::Stopwatch ( Widget parent, char *name ) : 
  32.              BasicComponent ( name )
  33. {
  34.     // Create a manager widget to hold all components
  35.     
  36.     _w = XmCreateRowColumn ( parent, _name, NULL, 0 );
  37.     
  38.     // Instantiate the three sub-components of the stopwatch
  39.     
  40.     _face  = new Face ( _w, "face" );
  41.     _timer = new Timer ( XtWidgetToApplicationContext ( parent ), 
  42.             _face, 
  43.             1000 );
  44.     _control = new Control ( _w, "control", this, _timer );
  45.     
  46.     // Manage the two user interface sub-components
  47.     
  48.     _face->manage();
  49.     _control->manage();
  50. }
  51.  
  52. Stopwatch::~Stopwatch ( )
  53. {
  54.     delete _face;
  55.     delete _timer;
  56.     delete _control;
  57. }
  58.  
  59. void Stopwatch::timerStarted()
  60. {
  61.     // Empty
  62. }
  63.  
  64. void Stopwatch::timerStopped()
  65. {
  66.     // Empty
  67. }
  68.  
  69.  
  70.  
  71.