ES-DE/es-core/src/components/SwitchComponent.h

30 lines
725 B
C
Raw Normal View History

#pragma once
#include "GuiComponent.h"
#include "components/ImageComponent.h"
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.
class SwitchComponent : public GuiComponent
{
public:
SwitchComponent(Window* window, bool state = false);
bool input(InputConfig* config, Input input) override;
void render(const Eigen::Affine3f& parentTrans) override;
void onSizeChanged() override;
bool getState() const;
void setState(bool state);
std::string getValue() const;
void setValue(const std::string& statestring) override;
virtual std::vector<HelpPrompt> getHelpPrompts() override;
private:
void onStateChanged();
ImageComponent mImage;
bool mState;
};