00001 /* AbiSource Program Utilities 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 00021 00022 #ifndef UT_UNIXTIMER_H 00023 #define UT_UNIXTIMER_H 00024 00025 #ifdef HAVE_CONFIG_H 00026 #include "config.h" 00027 #endif 00028 00029 #include "ut_timer.h" 00030 00031 #ifdef TOOLKIT_COCOA 00032 #include <objc/objc.h> 00033 #endif 00034 00035 00036 class UT_UNIXTimer : public UT_Timer 00037 { 00038 public: 00039 UT_UNIXTimer(UT_WorkerCallback pCallback, void* pData); 00040 virtual ~UT_UNIXTimer(); 00041 00042 virtual UT_sint32 set(UT_uint32 iMilliseconds); 00043 virtual void stop(); 00044 virtual void start(); 00045 private: 00046 typedef UT_sint32 millisec_t; 00047 millisec_t m_iMilliseconds; 00048 UT_uint32 m_iGtkTimerId; 00049 #ifdef TOOLKIT_COCOA 00050 /* these are here for Cocoa timer */ 00051 static id s_timerMutex; 00052 static id s_timerIds; 00053 static int s_lastTimerId; 00054 00055 friend void _checkLock(void); 00056 friend void XAP_stopCocoaTimer (UT_uint32 timerId); 00057 friend UT_uint32 XAP_newCocoaTimer (UT_uint32 time, int (*proc)(void *), void *p); 00058 #endif 00059 }; 00060 00061 #endif /* UT_UNIXTIMER_H */ 00062