summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Platform/TimerSerenity.h
blob: 4f368c8a5d8c23abf48717bb1150aa8a900be4f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/NonnullRefPtr.h>
#include <LibCore/Forward.h>
#include <LibWeb/Platform/Timer.h>

namespace Web::Platform {

class TimerSerenity final : public Timer {
public:
    static NonnullRefPtr<TimerSerenity> create();

    virtual ~TimerSerenity();

    virtual void start() override;
    virtual void start(int interval_ms) override;
    virtual void restart() override;
    virtual void restart(int interval_ms) override;
    virtual void stop() override;

    virtual void set_active(bool) override;

    virtual bool is_active() const override;
    virtual int interval() const override;
    virtual void set_interval(int interval_ms) override;

    virtual bool is_single_shot() const override;
    virtual void set_single_shot(bool) override;

private:
    TimerSerenity();

    NonnullRefPtr<Core::Timer> m_timer;
};

}