/********************************************************************
*
* Created: 1/4/2014 9:48
*
* File: fsCCheckBoxComponent.h
*
* Author: Mick Waites
*
* Purpose: A single toggle switch, or part of a group.
*
*********************************************************************/
#ifndef fsCCheckBoxComponenthdr
#define fsCCheckBoxComponenthdr
#include <fsCore/src/fsCUniqueId.h>
#include <fsCore/fsSColour.h>
#include "../../fsIGestureHandlingComponent.h"
struct fsPoint;
class fsCCheckBoxGroupComponent;
class fsCBrush;
class fsCCheckBoxComponent : public fsIGestureHandlingComponent
{
friend class fsCComponentFactory;
friend class fsCCheckBoxGroupComponent;
public:
struct sCheckBoxMsgParam : public fsIMessageDispatcher::sMessageParameters
{
sCheckBoxMsgParam(const fsStr& pParentName) : mParentName(pParentName), mValue(false)
{
}
const fsStr& mParentName;
fsBool mValue;
};
static const fsCUniqueId mTypeId;
static const fsCUniqueId mEventCheckBoxToggledMsg;
void initManually(std::vector<fsStr> pButtonFilenames);
void tint(fsSColour const& pTint);
void valueSet(fsBool pValue);
fsBool valueGet() const;
void groupInitialise();
protected:
fsBool acceptingInputGet() const override;
fsBool highlightSetDo() override;
void onTap(const fsPoint& pTapPos) override;
static fsIComponent* create(fsCEntity* pParent);
void initialiseFromVariableTableDo(const fsCVariableTable& pVars) override;
fsCCheckBoxComponent(fsCEntity* pParent);
virtual ~fsCCheckBoxComponent();<--- Destructor in derived class
sCheckBoxMsgParam mMessageParams;
fsCCheckBoxGroupComponent* mGroup;
std::shared_ptr<fsCBrush> mBrushes[4];
private:
void spriteInitialise(const fsCVariableTable& pVars);
void brushLoad(const fsCVariableTable& pVars, const fsStr& pVarKey, fsS32 pBrushIndex);
void spriteBrushSet() const;
fsSColour mTint;
};
#endif