2020-06-06 14:48:05 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// SwitchComponent.h
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// Basic switch used in the menus.
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
|
|
|
|
2013-06-19 01:12:30 +00:00
|
|
|
#pragma once
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_COMPONENTS_SWITCH_COMPONENT_H
|
|
|
|
#define ES_CORE_COMPONENTS_SWITCH_COMPONENT_H
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2014-06-20 01:30:09 +00:00
|
|
|
#include "components/ImageComponent.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "GuiComponent.h"
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2020-06-06 14:48:05 +00:00
|
|
|
// A simple "on/off" switch.
|
2013-06-19 01:12:30 +00:00
|
|
|
class SwitchComponent : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2020-06-21 12:25:28 +00:00
|
|
|
SwitchComponent(Window* window, bool state = false);
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
bool input(InputConfig* config, Input input) override;
|
|
|
|
void render(const Transform4x4f& parentTrans) override;
|
|
|
|
void onSizeChanged() override;
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
bool getState() const;
|
|
|
|
void setState(bool state);
|
|
|
|
std::string getValue() const;
|
|
|
|
void setValue(const std::string& statestring) override;
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
virtual std::vector<HelpPrompt> getHelpPrompts() override;
|
2014-01-25 23:34:29 +00:00
|
|
|
|
2013-06-19 01:12:30 +00:00
|
|
|
private:
|
2020-06-21 12:25:28 +00:00
|
|
|
void onStateChanged();
|
2014-03-08 01:35:16 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
ImageComponent mImage;
|
|
|
|
bool mState;
|
2013-06-19 01:12:30 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_COMPONENTS_SWITCH_COMPONENT_H
|