mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-23 22:55:39 +00:00
70d0057295
User changes are marked with blue and scraper changes with red.
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
//
|
|
// SwitchComponent.h
|
|
//
|
|
// Basic switch used in the menus.
|
|
//
|
|
|
|
#pragma once
|
|
#ifndef ES_CORE_COMPONENTS_SWITCH_COMPONENT_H
|
|
#define ES_CORE_COMPONENTS_SWITCH_COMPONENT_H
|
|
|
|
#include "components/ImageComponent.h"
|
|
#include "GuiComponent.h"
|
|
|
|
// A simple "on/off" switch.
|
|
class SwitchComponent : public GuiComponent
|
|
{
|
|
public:
|
|
SwitchComponent(Window* window, bool state = false);
|
|
|
|
bool input(InputConfig* config, Input input) override;
|
|
void render(const Transform4x4f& parentTrans) override;
|
|
void onSizeChanged() override;
|
|
|
|
bool getState() const;
|
|
void setState(bool state);
|
|
std::string getValue() const override;
|
|
void setValue(const std::string& statestring) override;
|
|
|
|
void setOriginalColor(unsigned int color) override { mColorOriginalValue = color; };
|
|
void setChangedColor(unsigned int color) override { mColorChangedValue = color; };
|
|
|
|
virtual std::vector<HelpPrompt> getHelpPrompts() override;
|
|
|
|
private:
|
|
void onStateChanged();
|
|
|
|
ImageComponent mImage;
|
|
bool mState;
|
|
bool mOriginalValue;
|
|
unsigned int mColorOriginalValue;
|
|
unsigned int mColorChangedValue;
|
|
};
|
|
|
|
#endif // ES_CORE_COMPONENTS_SWITCH_COMPONENT_H
|