mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-24 17:09:39 -04:00
In initial design a `TobBar`'s SimCard icon with number is supposed to display on the home screen only if there are two cards inserted. Because of the hardware limitations (there is no way of telling if there is a single or two cards inserted) the established consensus is that home screen should not display SimCard widget unless it's indication error state. Although in the task description there is only home screen mentioned, the behaviour was established for all `ApplicationDesktop`'s windows.
59 lines
1.1 KiB
C++
59 lines
1.1 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#pragma once
|
|
|
|
#include <log/log.hpp>
|
|
|
|
namespace gui::top_bar
|
|
{
|
|
class SIM;
|
|
class Time;
|
|
} // namespace gui::top_bar
|
|
|
|
class StatusBarVisitor
|
|
{
|
|
void logError() const
|
|
{
|
|
LOG_ERROR("Invalid widget visited");
|
|
}
|
|
|
|
public:
|
|
virtual void visit([[maybe_unused]] gui::top_bar::SIM &widget) const
|
|
{
|
|
logError();
|
|
}
|
|
virtual void visit([[maybe_unused]] gui::top_bar::Time &widget) const
|
|
{
|
|
logError();
|
|
}
|
|
virtual ~StatusBarVisitor() = default;
|
|
};
|
|
|
|
template <typename ItemPolicy> class StatusBarWidgetBase : public ItemPolicy
|
|
{
|
|
public:
|
|
using ItemPolicy::ItemPolicy;
|
|
virtual ~StatusBarWidgetBase() = default;
|
|
|
|
virtual void show()
|
|
{
|
|
ItemPolicy::setVisible(true);
|
|
}
|
|
|
|
virtual void hide()
|
|
{
|
|
ItemPolicy::setVisible(false);
|
|
}
|
|
|
|
virtual bool isVisible()
|
|
{
|
|
return ItemPolicy::visible;
|
|
}
|
|
|
|
virtual void acceptStatusBarVisitor([[maybe_unused]] StatusBarVisitor &visitor)
|
|
{
|
|
LOG_ERROR("Invalid visitor");
|
|
}
|
|
};
|