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
25class 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
50public:
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
70{
71 return m_bDirectTimeout;
72}
73
75{
77}
78
80{
81 return m_bForceRealTimer;
82}
83
84#endif
85
86/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ExistsValidEvent() const
Definition: saltimer.hxx:90
bool m_bForceRealTimer
enforce using a real timer for 0ms
Definition: win/saltimer.h:41
HANDLE m_nTimerId
Windows timer id.
Definition: win/saltimer.h:39
friend bool ImplSalYield(bool bWait, bool bHandleAllCurrentEvents)
virtual void Stop() override
friend void CALLBACK SalTimerProc(PVOID data, BOOLEAN)
bool m_bSetTimerRunning
true, if a SetTimer is running
Definition: win/saltimer.h:42
bool IsDirectTimeout() const
Definition: win/saltimer.h:69
virtual void Start(sal_uInt64 nMS) override
void ImplHandleElapsedTimer()
virtual ~WinSalTimer() override
void SetForceRealTimer(bool bVal)
Enforces the usage of a real timer instead of the message queue.
friend LRESULT CALLBACK SalComWndProc(HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, bool &rDef)
void ImplHandleTimerEvent(WPARAM aWPARAM)
void ImplStop()
void ImplStart(sal_uInt64 nMS)
static constexpr UINT_PTR m_aWmTimerId
Identifier for our SetTimer based timer.
Definition: win/saltimer.h:37
bool GetForceRealTimer() const
Definition: win/saltimer.h:79
bool HasTimerElapsed() const
Definition: win/saltimer.h:74
bool m_bDirectTimeout
timeout can be processed directly
Definition: win/saltimer.h:40
void ImplHandle_WM_TIMER(WPARAM aWPARAM)
#define CALLBACK