unatappli.hpp

00001 /* ==================================================== ======== ======= *
00002  *
00003  *  unatappli.hpp : Native Layer: platform dependent implementation
00004  *  Ubit Project
00005  *  Author: Eric Lecolinet
00006  *  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
00007  *  (C) 1999-2006 / Eric Lecolinet / ENST Paris
00008  *
00009  * ***********************************************************************
00010  * COPYRIGHT NOTICE : 
00011  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
00012  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
00013  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
00014  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
00015  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
00016  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
00017  * ***********************************************************************
00018  * ==================================================== [(c)Elc] ======= *
00019  * ==================================================== ======== ======= */
00020 
00021 #ifndef _unatappli_hpp_
00022 #define _unatappli_hpp_
00023 //pragma ident  "@(#)unatappli.hpp      ubit:05.05.00"
00024 #include <ubit/unatdisp.hpp>
00025 #include <sys/time.h>
00026 #include <sys/select.h>  // fd_set
00027 namespace ubit {
00028 
00029 /* ==================================================== ===== ======= */
00032 class UNatAppli {
00033 public:
00034   UNatAppli(class UAppli&, class UNatDisp&);
00035   virtual ~UNatAppli();
00036 
00037   void setProperties(class UConf&);
00039 
00040   void startLoop(bool main_loop);
00041   void quitLoop(bool main_loop);
00043 
00044   static UTime getTime();
00045   static void getTime(struct timeval&);
00046   static void addTime(struct timeval& time, unsigned long msec);
00047   static void minTime(struct timeval& mintime, struct timeval& time);
00048   static bool lessTime(struct timeval& time1, struct timeval& time2);
00049 
00050   bool resetTimers(UGroup* timers, struct timeval& delay);
00051   void fireTimers(UGroup* timers);
00052   void resetInputs(UGroup* inputs, fd_set& read_set, int& maxfd);
00053   void cleanInputs(UGroup* inputs);
00054   void fireInputs(UGroup* inputs, fd_set& read_set);
00055 
00056 private:
00057   friend class UAppli;
00058   class UAppli& appli;
00059   class UNatDisp& natdisp;
00060   bool mainloop_running, subloop_running;
00061 #ifdef WITH_GDK
00062   GMainLoop *gmainloop, *gsubloop;
00063 #endif
00064 };
00065 
00066 }
00067 #endif
00068 /* ==================================================== [TheEnd] ======= */
00069 /* ==================================================== [(c)Elc] ======= */

Generated on Mon Jan 29 00:20:39 2007 for Ubit by  doxygen 1.4.7