xref: /trunk/main/vcl/inc/vcl/timer.hxx (revision 0d63794c)
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_TIMER_HXX
25 #define _SV_TIMER_HXX
26 
27 #include <tools/link.hxx>
28 #include <vcl/sv.h>
29 #include <vcl/dllapi.h>
30 
31 struct ImplTimerData;
32 struct ImplSVData;
33 
34 // ---------
35 // - Timer -
36 // ---------
37 
38 class VCL_DLLPUBLIC Timer
39 {
40 protected:
41     ImplTimerData*  mpTimerData;
42     sal_uLong           mnTimeout;
43     sal_Bool            mbActive;
44     sal_Bool            mbAuto;
45     Link            maTimeoutHdl;
46 
47 public:
48                     Timer();
49                     Timer( const Timer& rTimer );
50 	virtual			~Timer();
51 
52     virtual void    Timeout();
53 
54     void            Start();
55     void            Stop();
56 
57     void            SetTimeout( sal_uLong nTimeout );
GetTimeout() const58     sal_uLong           GetTimeout() const { return mnTimeout; }
IsActive() const59     sal_Bool            IsActive() const { return mbActive; }
60 
SetTimeoutHdl(const Link & rLink)61     void            SetTimeoutHdl( const Link& rLink ) { maTimeoutHdl = rLink; }
GetTimeoutHdl() const62     const Link&     GetTimeoutHdl() const { return maTimeoutHdl; }
63 
64     Timer&          operator=( const Timer& rTimer );
65 
66 //    #ifdef _SOLAR__PRIVATE
67     static void ImplDeInitTimer();
68     static void ImplTimerCallbackProc();
69 //    #endif
70 };
71 
72 // -------------
73 // - AutoTimer -
74 // -------------
75 
76 class VCL_DLLPUBLIC AutoTimer : public Timer
77 {
78 public:
79                     AutoTimer();
80                     AutoTimer( const AutoTimer& rTimer );
81 
82     AutoTimer&      operator=( const AutoTimer& rTimer );
83 };
84 
85 #endif // _SV_TIMER_HXX
86