LibreOffice Module vcl (master)  1
win/saltimer.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_VCL_INC_WIN_SALTIMER_H
21 #define INCLUDED_VCL_INC_WIN_SALTIMER_H
22 
23 #include <saltimer.hxx>
24 
25 class WinSalTimer final : public SalTimer, protected VersionedEvent
26 {
27  // for access to Impl* functions
28  friend LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, bool& rDef );
29  // for access to GetNextVersionedEvent
30  friend void CALLBACK SalTimerProc( PVOID data, BOOLEAN );
31  // for access to ImplHandleElapsedTimer
32  friend bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents );
33 
37  static constexpr UINT_PTR m_aWmTimerId = 0xdeadbeef;
38 
39  HANDLE m_nTimerId;
43 
44  void ImplStart( sal_uInt64 nMS );
45  void ImplStop();
46  void ImplHandleTimerEvent( WPARAM aWPARAM );
48  void ImplHandle_WM_TIMER( WPARAM aWPARAM );
49 
50 public:
51  WinSalTimer();
52  virtual ~WinSalTimer() override;
53 
54  virtual void Start(sal_uInt64 nMS) override;
55  virtual void Stop() override;
56 
57  inline bool IsDirectTimeout() const;
58  inline bool HasTimerElapsed() const;
59 
65  void SetForceRealTimer( bool bVal );
66  inline bool GetForceRealTimer() const;
67 };
68 
69 inline bool WinSalTimer::IsDirectTimeout() const
70 {
71  return m_bDirectTimeout;
72 }
73 
74 inline bool WinSalTimer::HasTimerElapsed() const
75 {
77 }
78 
79 inline bool WinSalTimer::GetForceRealTimer() const
80 {
81  return m_bForceRealTimer;
82 }
83 
84 #endif
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
friend void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
bool m_bForceRealTimer
enforce using a real timer for 0ms
Definition: win/saltimer.h:41
void SetForceRealTimer(bool bVal)
Enforces the usage of a real timer instead of the message queue.
bool m_bDirectTimeout
timeout can be processed directly
Definition: win/saltimer.h:40
void ImplHandleTimerEvent(WPARAM aWPARAM)
void ImplHandle_WM_TIMER(WPARAM aWPARAM)
virtual ~WinSalTimer() override
bool IsDirectTimeout() const
Definition: win/saltimer.h:69
friend bool ImplSalYield(bool bWait, bool bHandleAllCurrentEvents)
void ImplStop()
virtual void Start(sal_uInt64 nMS) override
virtual void Stop() override
bool GetForceRealTimer() const
Definition: win/saltimer.h:79
void ImplHandleElapsedTimer()
void ImplStart(sal_uInt64 nMS)
bool HasTimerElapsed() const
Definition: win/saltimer.h:74
friend LRESULT CALLBACK SalComWndProc(HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, bool &rDef)
static constexpr UINT_PTR m_aWmTimerId
Identifier for our SetTimer based timer.
Definition: win/saltimer.h:37
HANDLE m_nTimerId
Windows timer id.
Definition: win/saltimer.h:39
#define CALLBACK
bool ExistsValidEvent() const
Definition: saltimer.hxx:90
bool m_bSetTimerRunning
true, if a SetTimer is running
Definition: win/saltimer.h:42