Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

BRunLoop.h

Go to the documentation of this file.
00001 // BRunLoop.h (this is -*- C++ -*-)
00002 // 
00003 // \author: Bjoern Giesler <bjoern@giesler.de>
00004 // 
00005 // 
00006 // 
00007 // $Author: giesler $
00008 // $Locker$
00009 // $Revision$
00010 // $Date: 2002-08-19 10:41:28 +0200 (Mon, 19 Aug 2002) $
00011 
00012 #ifndef BRUNLOOP_H
00013 #define BRUNLOOP_H
00014 
00015 /* system includes */
00016 #include <vector>
00017 
00018 /* my includes */
00019 #include "BEvent.h"
00020 #include "BResponder.h"
00021 
00022 class BRunLoop {
00023   friend class BGUI;
00024 public:
00025   class VBlankReceiver {
00026   public:
00027     virtual ~VBlankReceiver() {}
00028     virtual void runloopReachedVBlank(BRunLoop *loop) {}
00029   };
00030 
00031   BRunLoop() { }
00032   
00033   void addResponder(BResponder *responder);
00034   void removeResponder(BResponder *responder);
00035 
00036   void addVBlankReceiver(VBlankReceiver *receiver);
00037   void removeVBlankReceiver(VBlankReceiver *receiver);
00038 
00039   static void addGlobalVBlankReceiver(VBlankReceiver *receiver);
00040   static void removeGlobalVBlankReceiver(VBlankReceiver *receiver);
00041 
00042   void run();
00043   void stop();
00044 
00045   void postEvent(const BEvent& event);
00046 
00047   static BRunLoop* currentRunLoop();
00048 
00049   uint32 buttonsHeld() { return _buttons; }
00050 
00051 protected:
00053   void handle();
00054   
00055   static std::vector<VBlankReceiver*> _globalreceivers;
00056   static BRunLoop* _current;
00057 
00058   std::vector<VBlankReceiver*> _receivers;
00059   std::vector<BResponder*> _responders;
00060   bool _shouldStop;
00061   static uint32 _buttons;
00062   static bool _touchdown;
00063   static int _touchx, _touchy;
00064 };
00065 
00066 #endif /* BRUNLOOP_H */

Generated on Sat Dec 29 09:59:23 2007 for DSGUI by doxygen1.3-rc3