From 6aa2201797a9ed64ce0178215ae941d0c5f09579 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 30 Oct 2020 00:07:57 +0800 Subject: ... --- src/win/native/TimerManager.hpp | 61 ----------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/win/native/TimerManager.hpp (limited to 'src/win/native/TimerManager.hpp') diff --git a/src/win/native/TimerManager.hpp b/src/win/native/TimerManager.hpp deleted file mode 100644 index f2731f60..00000000 --- a/src/win/native/TimerManager.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once -#include "cru/common/Event.hpp" -#include "cru/win/WinPreConfig.hpp" - -#include "cru/common/Base.hpp" -#include "cru/win/native/GodWindow.hpp" -#include "cru/win/native/WindowNativeMessageEventArgs.hpp" - -#include -#include -#include -#include - -namespace cru::platform::native::win { -enum class TimerType { Immediate, Timeout, Interval }; - -struct TimerInfo { - TimerInfo(long long id, TimerType type, int period, - std::function action, UINT_PTR native_timer_id = 0) - : id(id), - type(type), - period(period), - action(std::move(action)), - native_timer_id(native_timer_id) {} - - long long id; - TimerType type; - int period; // in milliseconds - std::function action; - UINT_PTR native_timer_id; -}; - -class TimerManager : public Object { - public: - TimerManager(GodWindow* god_window); - - CRU_DELETE_COPY(TimerManager) - CRU_DELETE_MOVE(TimerManager) - - ~TimerManager() override = default; - - // Period is in milliseconds. When type is immediate, it is not checked and - // used. - long long SetTimer(TimerType type, int period, std::function action); - void CancelTimer(long long id); - - private: - void HandleGodWindowMessage(WindowNativeMessageEventArgs& args); - - void CreateNativeTimer(TimerInfo* info); - void KillNativeTimer(TimerInfo* info); - - private: - GodWindow* god_window_; - - EventRevokerListGuard event_guard_; - - long long next_id_ = 1; - std::unordered_map info_map_; -}; -} // namespace cru::platform::native::win -- cgit v1.2.3