00001 //--- < UPDATEPOLICY.H > ---------------------| cZUI - A Zoomable UI framework | 00002 // 00003 // UpdatePolicy decides when to update the 00004 // UI window. 00005 // 00006 // $Author: botik32 $ 00007 // $Revision: 1.1.1.1 $ 00008 // $Date: 2004/03/26 10:50:26 $ 00009 //-----------------------------------------------------------------------------/ 00010 00011 /// Specifies to always update the window 00012 class AlwaysUpdatePolicy 00013 { 00014 protected: 00015 inline bool should_update( long ) 00016 { 00017 return true; 00018 }; 00019 AlwaysUpdatePolicy( int ) 00020 {}; 00021 }; 00022 00023 /// Specifies a framerated window 00024 class FrameUpdatePolicy 00025 { 00026 protected: 00027 long last_updated; 00028 int delay; 00029 public: 00030 inline bool should_update( long t) 00031 { 00032 if( t-last_updated > delay ) 00033 { 00034 last_updated = t; 00035 return true; 00036 } 00037 return false; 00038 } 00039 00040 FrameUpdatePolicy( int d ) 00041 : last_updated(0), delay(d){}; 00042 }; 00043 00044 //$Log: updatepolicy.h,v $ 00045 //Revision 1.1.1.1 2004/03/26 10:50:26 botik32 00046 //Initial release 00047 // 00048 //Revision 1.1.1.1 2004/03/26 08:53:33 botik 00049 //initial import 00050 // 00051 // 00052 //Revision 1.2 2004/03/15 19:31:53 botik 00053 //Changed the structure of UpdatePolicy class so that 00054 //it can compile under MSVC. (MSVC did not like my 00055 //nested templates :() 00056 // 00057 //Revision 1.1 2004/03/15 18:06:45 botik 00058 //Initial check-in 00059 //