xref: /trunk/main/vcl/inc/saltimer.hxx (revision 161f4cd1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_SALTIMER_HXX
25 #define _SV_SALTIMER_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 #include <salwtype.hxx>
30 
31 // ------------
32 // - SalTimer -
33 // ------------
34 
35 /*
36  * note: there will be only a single instance of SalTimer
37  * SalTimer originally had only static methods, but
38  * this needed to be virtualized for the sal plugin migration
39  */
40 
41 class VCL_PLUGIN_PUBLIC SalTimer
42 {
43     SALTIMERPROC		m_pProc;
44 public:
SalTimer()45     SalTimer() : m_pProc( NULL ) {}
46     virtual ~SalTimer();
47 
48     // AutoRepeat and Restart
49 	virtual void 			Start( sal_uLong nMS ) = 0;
50 	virtual void 			Stop() = 0;
51 
52 	// Callbacks (indepen in \sv\source\app\timer.cxx)
SetCallback(SALTIMERPROC pProc)53 	void 			SetCallback( SALTIMERPROC pProc )
54     {
55         m_pProc = pProc;
56     }
57 
CallCallback()58     void			CallCallback()
59     {
60         if( m_pProc )
61             m_pProc();
62     }
63 };
64 
65 #endif // _SV_SALTIMER_HXX
66