Back to index

lightning-sunbird  0.9+nobinonly
nsITimer.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * ***** BEGIN LICENSE BLOCK *****
00005  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  * The contents of this file are subject to the Mozilla Public License Version
00008  * 1.1 (the "License"); you may not use this file except in compliance with
00009  * the License. You may obtain a copy of the License at
00010  * http://www.mozilla.org/MPL/
00011  *
00012  * Software distributed under the License is distributed on an "AS IS" basis,
00013  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00014  * for the specific language governing rights and limitations under the
00015  * License.
00016  *
00017  * The Original Code is mozilla.org code.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Netscape Communications Corporation.
00021  * Portions created by the Initial Developer are Copyright (C) 2002
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsISupports.idl"
00041 
00042 interface nsIObserver;
00043 
00044 %{C++
00058 class nsITimer;
00059 typedef void (*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure);
00060 %}
00061 
00062 native nsTimerCallbackFunc(nsTimerCallbackFunc);
00063 
00067 interface nsITimer;
00068 
00069 [scriptable, uuid(a796816d-7d47-4348-9ab8-c7aeb3216a7d)]
00070 interface nsITimerCallback : nsISupports
00071 {
00075   void notify(in nsITimer timer);
00076 };
00077 
00078 
00085 [scriptable, uuid(436a83fa-b396-11d9-bcfa-00112478d626)]
00086 interface nsITimer : nsISupports
00087 {
00088   /* Timer types */
00089 
00093   const short TYPE_ONE_SHOT           = 0;
00094 
00103   const short TYPE_REPEATING_SLACK    = 1;
00104   
00113   const short TYPE_REPEATING_PRECISE  = 2;
00114 
00131   void init(in nsIObserver aObserver, in unsigned long aDelay, 
00132             in unsigned long aType);
00133 
00134 
00145   [noscript] void initWithFuncCallback(in nsTimerCallbackFunc aCallback,
00146                                        in voidPtr aClosure,
00147                                        in unsigned long aDelay, 
00148                                        in unsigned long aType);
00149 
00159   void initWithCallback(in nsITimerCallback aCallback,
00160                         in unsigned long aDelay, 
00161                         in unsigned long aType);
00162 
00169   void cancel();
00170   
00174   attribute unsigned long delay;
00175   
00179   attribute unsigned long type;
00180 
00184   [noscript] readonly attribute voidPtr closure;
00185 
00189   readonly attribute nsITimerCallback callback;
00190 };
00191 
00192 %{C++
00193 #define NS_TIMER_CONTRACTID "@mozilla.org/timer;1"
00194 #define NS_TIMER_CALLBACK_TOPIC "timer-callback"
00195 %}
00196