Files
MuditaOS/module-apps/GuiTimer.hpp
Przemyslaw Brudny 230eb7c343 [EGD-5816] Device freeze after cancelling a call
Reverted changed proposed by PR [EGD-5598] GuiTimer
refreshWindow on Count and custom stop.

Signed-off-by: Przemyslaw Brudny <przemyslaw.brudny@mudita.com>
2021-02-19 12:57:30 +01:00

60 lines
1.6 KiB
C++

// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include "Service/Timer.hpp" // for Timer
#include <module-gui/gui/core/Timer.hpp> // for ms, Timer
#include <string> // for string
namespace app
{
class Application;
} // namespace app
namespace gui
{
class Item;
} // namespace gui
namespace app
{
class Application;
/// proxies system Timer capabilities to gui::Timer and disconnects dependencies
/// by default one time run
class GuiTimer : public gui::Timer, protected sys::Timer
{
public:
/// gui timer default named GUI, infinite timeout on start
explicit GuiTimer(Application *parent);
/// gui timer with user name, infinite timeout on start
GuiTimer(const std::string &name,
Application *parent,
gui::ms timeout = sys::Timer::timeout_infinite,
gui::Timer::Type type = gui::Timer::Single);
/// there is no valid reason to create timer without app
GuiTimer() = delete;
/// @defgroup interface
/// @ {
void start() override;
void stop() override;
void reset() override;
void setInterval(gui::ms time) override;
/// @ }
/// interface to trigger timing callback
class Sysapi
{
friend Application;
GuiTimer &parent;
void connect(gui::Item *item);
public:
Sysapi(GuiTimer &parent) : parent(parent)
{}
} sysapi;
};
}; // namespace app