ScummVM API documentation
timer.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/".
19  *
20  */
21 
22 #ifndef BAGEL_BOFLIB_TIMER_H
23 #define BAGEL_BOFLIB_TIMER_H
24 
25 #include "bagel/spacebar/boflib/timer.h"
26 #include "bagel/boflib/llist.h"
27 #include "bagel/boflib/palette.h"
28 
29 namespace Bagel {
30 namespace SpaceBar {
31 
32 struct WindowTimer {
33  uint32 _interval = 0;
34  uint32 _lastExpiryTime = 0;
35  uint32 _id = 0;
36  BofCallback _callback = nullptr;
37 
38  WindowTimer() { }
39  WindowTimer(uint32 interval, uint32 id, BofCallback callback);
40 };
41 
42 
43 class CBofTimer: public CBofObject, public CLList {
44 public:
45  CBofTimer();
46  CBofTimer(uint32 nID, uint32 nInterval, void *lUserInfo, BofCallback pCallBack);
47  ~CBofTimer();
48 
49  void start() {
50  _bActive = true;
51  }
52  void stop() {
53  _bActive = false;
54  }
55 
56  bool isActive() {
57  return _bActive;
58  }
59 
60  void setID(uint32 nID) {
61  _nID = nID;
62  }
63  uint32 getID() {
64  return _nID;
65  }
66 
67  void setInterval(uint32 nInterval) {
68  _nInterval = nInterval;
69  }
70  uint32 getInterval() {
71  return _nInterval;
72  }
73 
74  void setUserInfo(void *lUserInfo) {
75  _lUserInfo = lUserInfo;
76  }
77  void *getUserInfo() {
78  return _lUserInfo;
79  }
80 
81  void setCallBack(BofCallback pCallBack) {
82  _pCallBack = pCallBack;
83  }
84  BofCallback getCallBack() {
85  return _pCallBack;
86  }
87 
88  static void handleTimers();
89 
90  //
91  // members
92  //
93 
94 protected:
95 
96  static CBofTimer *_pTimerList;
97  static bool _bModified;
98 
99 public:
100 
101  uint32 _lLastTime;
102  uint32 _nID;
103  uint32 _nInterval;
104  BofCallback _pCallBack;
105  void *_lUserInfo;
106  bool _bActive;
107 };
108 
109 } // namespace SpaceBar
110 } // namespace Bagel
111 
112 #endif
Definition: object.h:28
Definition: timer.h:32
Definition: timer.h:43
Definition: afxwin.h:27
Definition: llist.h:31