Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

frame_time_observer.H

Go to the documentation of this file.
00001 #ifndef FRAME_TIME_OBSERVER_H_IS_INCLUDED
00002 #define FRAME_TIME_OBSERVER_H_IS_INCLUDED
00003 
00004 #include "disp/view.H"
00005 
00006 /*****************************************************************
00007  * FRAME_TIME_OBSERVER:
00008  *
00009  *    Base class for objects that get notifications when the frame
00010  *    time variable stored in a VIEW changes.
00011  *****************************************************************/
00012 class FRAME_TIME_OBSERVER {
00013  public :
00014    virtual ~FRAME_TIME_OBSERVER() {}
00015 
00016    // called when the frame time has changed:
00017    virtual void  frame_time_changed() = 0;
00018 
00019    // sign up to track changes in frame time for the given view:
00020    void observe_frame_time(CVIEWptr& view = VIEW::peek()) {
00021       // if observing some other view, sign off first:
00022       unobserve_frame_time();
00023       // now record the new view:
00024       _view = view;
00025       if (_view)
00026          _view->add_frame_time_observer(this);
00027    }
00028    // sign off from observing changes in frame time for the given view:
00029    void unobserve_frame_time() {
00030       if (_view)
00031          _view->remove_frame_time_observer(this);
00032       _view = 0;
00033    }
00034 
00035  protected:
00036    VIEWptr      _view;
00037 };
00038 
00039 #endif // FRAME_TIME_OBSERVER_H_IS_INCLUDED
00040 
00041 // end of file frame_time_observer.H

Generated on Mon Sep 18 11:39:29 2006 for jot by  doxygen 1.4.4