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 "GuiComponent.h"
|
|
|
|
#include "components/ImageComponent.h"
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2014-01-24 22:21:10 +00:00
|
|
|
// A very simple "on/off" switch.
|
|
|
|
// Should hopefully be switched to use images instead of text in the future.
|
2013-06-19 01:12:30 +00:00
|
|
|
class SwitchComponent : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SwitchComponent(Window* window, bool state = false);
|
|
|
|
|
|
|
|
bool input(InputConfig* config, Input input) override;
|
2017-10-28 20:24:35 +00:00
|
|
|
void render(const Transform4x4f& parentTrans) override;
|
2014-03-22 21:55:18 +00:00
|
|
|
void onSizeChanged() override;
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2014-03-08 01:35:16 +00:00
|
|
|
bool getState() const;
|
2013-06-19 01:12:30 +00:00
|
|
|
void setState(bool state);
|
2017-06-12 16:38:59 +00:00
|
|
|
std::string getValue() const;
|
|
|
|
void setValue(const std::string& statestring) override;
|
2013-06-19 01:12:30 +00:00
|
|
|
|
2014-01-25 23:34:29 +00:00
|
|
|
virtual std::vector<HelpPrompt> getHelpPrompts() override;
|
|
|
|
|
2013-06-19 01:12:30 +00:00
|
|
|
private:
|
2014-03-08 01:35:16 +00:00
|
|
|
void onStateChanged();
|
|
|
|
|
|
|
|
ImageComponent mImage;
|
2013-06-19 01:12:30 +00:00
|
|
|
bool mState;
|
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_COMPONENTS_SWITCH_COMPONENT_H
|