1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <saltimer.hxx>
24 class WinSalTimer final
: public SalTimer
, protected VersionedEvent
26 // for access to Impl* functions
27 friend LRESULT CALLBACK
SalComWndProc( HWND
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
, bool& rDef
);
28 // for access to GetNextVersionedEvent
29 friend void CALLBACK
SalTimerProc( PVOID data
, BOOLEAN
);
30 // for access to ImplHandleElapsedTimer
31 friend bool ImplSalYield( bool bWait
, bool bHandleAllCurrentEvents
);
34 * Identifier for our SetTimer based timer
36 static constexpr UINT_PTR m_aWmTimerId
= 0xdeadbeef;
38 HANDLE m_nTimerId
; ///< Windows timer id
39 bool m_bDirectTimeout
; ///< timeout can be processed directly
40 bool m_bForceRealTimer
; ///< enforce using a real timer for 0ms
41 bool m_bSetTimerRunning
; ///< true, if a SetTimer is running
43 void ImplStart( sal_uInt64 nMS
);
45 void ImplHandleTimerEvent( WPARAM aWPARAM
);
46 void ImplHandleElapsedTimer();
47 void ImplHandle_WM_TIMER( WPARAM aWPARAM
);
51 virtual ~WinSalTimer() override
;
53 virtual void Start(sal_uInt64 nMS
) override
;
54 virtual void Stop() override
;
56 inline bool IsDirectTimeout() const;
57 inline bool HasTimerElapsed() const;
60 * Enforces the usage of a real timer instead of the message queue
62 * Needed for Window resize processing, as this starts a modal event loop.
64 void SetForceRealTimer( bool bVal
);
65 inline bool GetForceRealTimer() const;
68 inline bool WinSalTimer::IsDirectTimeout() const
70 return m_bDirectTimeout
;
73 inline bool WinSalTimer::HasTimerElapsed() const
75 return m_bDirectTimeout
|| ExistsValidEvent();
78 inline bool WinSalTimer::GetForceRealTimer() const
80 return m_bForceRealTimer
;
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */