ecore-integration.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *  D-Bus++ - C++ bindings for D-Bus
00004  *
00005  *  Copyright (C) 2005-2007  Paolo Durante <shackan@gmail.com>
00006  *
00007  *
00008  *  This library is free software; you can redistribute it and/or
00009  *  modify it under the terms of the GNU Lesser General Public
00010  *  License as published by the Free Software Foundation; either
00011  *  version 2.1 of the License, or (at your option) any later version.
00012  *
00013  *  This library is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  *  Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public
00019  *  License along with this library; if not, write to the Free Software
00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 
00025 #ifndef __DBUSXX_ECORE_INTEGRATION_H
00026 #define __DBUSXX_ECORE_INTEGRATION_H
00027 
00028 #include <Ecore.h>
00029 
00030 #include "api.h"
00031 #include "dispatcher.h"
00032 #include "Ecore.h"
00033 
00034 namespace DBus
00035 {
00036 
00037 namespace Ecore
00038 {
00039 
00040 class BusDispatcher;
00041 
00042 class DXXAPI BusTimeout : public Timeout
00043 {
00044 private:
00045 
00046   BusTimeout(Timeout::Internal *);
00047 
00048   ~BusTimeout();
00049 
00050   void toggle();
00051 
00052   static Eina_Bool timeout_handler(void *);
00053 
00054   void _enable();
00055 
00056   void _disable();
00057 
00058 private:
00059   Ecore_Timer *_etimer;
00060 
00061   friend class BusDispatcher;
00062 };
00063 
00064 class DXXAPI BusWatch : public Watch
00065 {
00066 private:
00067 
00068   BusWatch(Watch::Internal *);
00069 
00070   ~BusWatch();
00071 
00072   void toggle();
00073 
00074   static Eina_Bool watch_check(void *data, Ecore_Fd_Handler *fdh);
00075   static Eina_Bool watch_prepare(void *data, Ecore_Fd_Handler *fdh);
00076   static Eina_Bool watch_dispatch(void *data, Ecore_Fd_Handler *fdh);
00077 
00078   void _enable();
00079 
00080   void _disable();
00081 
00082   void data(Ecore::BusDispatcher *bd);
00083 
00084 private:
00085   Ecore_Fd_Handler *fd_handler;
00086   Ecore::BusDispatcher *_bd;
00087 
00088   friend class BusDispatcher;
00089 };
00090 
00091 class DXXAPI BusDispatcher : public Dispatcher
00092 {
00093 public:
00094   BusDispatcher();
00095 
00096   void enter() {}
00097 
00098   void leave() {}
00099 
00100   Timeout *add_timeout(Timeout::Internal *);
00101 
00102   void rem_timeout(Timeout *);
00103 
00104   Watch *add_watch(Watch::Internal *);
00105 
00106   void rem_watch(Watch *);
00107 
00108   static Eina_Bool dispatch(void *data, Ecore_Fd_Handler *fdh);
00109   static Eina_Bool check(void *data, Ecore_Fd_Handler *fdh);
00110 
00111 private:
00112 };
00113 
00114 } /* namespace Ecore */
00115 
00116 } /* namespace DBus */
00117 
00118 #endif//__DBUSXX_ECORE_INTEGRATION_H