Add SwitchScreenActionArgs
This commit is contained in:
@@ -1,14 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <utility>
|
||||
|
||||
// local includes
|
||||
#include "actioninterface.h"
|
||||
#include "screenmanager.h"
|
||||
|
||||
namespace espgui {
|
||||
template<typename Tscreen, typename ...Targs>
|
||||
template<typename Tscreen>
|
||||
class SwitchScreenAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
void triggered() override { switchScreen<Tscreen>(std::make_unique<Targs>()...); }
|
||||
void triggered() override { switchScreen<Tscreen>(); }
|
||||
};
|
||||
|
||||
template<typename Tscreen, typename T1>
|
||||
class SwitchScreenActionArgs : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
SwitchScreenActionArgs(T1 &&arg1) :
|
||||
m_arg1{std::move<T1>(arg1)}
|
||||
{}
|
||||
SwitchScreenActionArgs(const T1 &arg1) :
|
||||
m_arg1{arg1}
|
||||
{}
|
||||
|
||||
void triggered() override { switchScreen<Tscreen>(std::move(m_arg1)); }
|
||||
|
||||
private:
|
||||
T1 m_arg1;
|
||||
};
|
||||
} // namespace espgui
|
||||
|
Reference in New Issue
Block a user