Fission FSN
Loading...
Searching...
No Matches
fsCButtonComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* Created: 17/3/2014 11:05
4*
5* File: fsCButtonComponent.h
6*
7* Author: Mick Waites
8*
9* Purpose: Control component for a GUI button entity.
10*
11*********************************************************************/
12
13#ifndef fsCButtonComponenthdr
14#define fsCButtonComponenthdr
15
17
19
20struct fsPoint;
21class fsCResourceName;
22class fsIFont;
23class fsCBrush;
24
26{
27 friend class fsCComponentFactory;
29
30public:
31
37
38 void brushesReplace(const fsCResourceName& pImageFileName, const fsCResourceName& pDownImageFileName,
39 const fsPoint& pSize);
40
41 void actionSet(const fsCUniqueId& pActionId, const fsStr& pParamStr);
42
43 fsCEntity* buttonGuiEntityCreate(const fsStr& pEntityName, const fsCResourceName& pImageFileName,
44 const fsCResourceName& pDownImageFileName);
45 fsCEntity* textButtonGuiEntityCreate(const fsStr& pEntityName, const fsCResourceName& pImageFileName,
46 const fsCResourceName& pDownImageFileName, const fsStr& pText, fsIFont* pFont);
47
48 static const fsCUniqueId mTypeId;
49
50protected:
51
52 void defaultSpriteSet();
53
54 fsBool acceptingInputGet() const override;
55 fsBool highlightSetDo() override;
56
57 void onTap(const fsPoint& pTapPos) override;
58
59 static fsIComponent* create(fsCEntity* pParent);
60
61 void initialiseFromVariableTableDo(const fsCVariableTable& pVars) override;
62
64 virtual ~fsCButtonComponent();
65
67 std::shared_ptr<fsCBrush> mBrush;
68 std::shared_ptr<fsCBrush> mOverBrush;
69
72
73private:
74
75 static const fsCUniqueId mActionUnsetId;
76
77 void spriteInitialise(const fsCVariableTable& pVars);
78 void actionInitialise(const fsCVariableTable& pVars);
79 void textCreateIfWanted(const fsCVariableTable& pVars) const;
80
81 void actionPerform();
82};
83
84#endif
Definition fsCBrush.h:26
fsBool acceptingInputGet() const override
Definition fsCButtonComponent.cpp:166
sButtonEventMsgParam mActionParam
Definition fsCButtonComponent.h:71
friend class gfIAutoTestLevelUserInputComponent
Definition fsCButtonComponent.h:28
friend class fsCComponentFactory
Definition fsCButtonComponent.h:27
void brushesReplace(const fsCResourceName &pImageFileName, const fsCResourceName &pDownImageFileName, const fsPoint &pSize)
Definition fsCButtonComponent.cpp:24
std::shared_ptr< fsCBrush > mBrush
Definition fsCButtonComponent.h:67
fsCButtonComponent(fsCEntity *pParent)
Definition fsCButtonComponent.cpp:214
void initialiseFromVariableTableDo(const fsCVariableTable &pVars) override
Definition fsCButtonComponent.cpp:53
void actionSet(const fsCUniqueId &pActionId, const fsStr &pParamStr)
Definition fsCButtonComponent.cpp:126
static const fsCUniqueId mTypeId
Definition fsCButtonComponent.h:48
fsCEntity * buttonGuiEntityCreate(const fsStr &pEntityName, const fsCResourceName &pImageFileName, const fsCResourceName &pDownImageFileName)
Definition fsCButtonComponent.cpp:132
fsCUniqueId mActionId
Definition fsCButtonComponent.h:70
void onTap(const fsPoint &pTapPos) override
Definition fsCButtonComponent.cpp:184
static fsIComponent * create(fsCEntity *pParent)
Definition fsCButtonComponent.cpp:209
std::shared_ptr< fsCBrush > mOverBrush
Definition fsCButtonComponent.h:68
virtual ~fsCButtonComponent()
Definition fsCButtonComponent.cpp:221
fsPoint mSize
Definition fsCButtonComponent.h:66
void defaultSpriteSet()
Definition fsCButtonComponent.cpp:76
fsCEntity * textButtonGuiEntityCreate(const fsStr &pEntityName, const fsCResourceName &pImageFileName, const fsCResourceName &pDownImageFileName, const fsStr &pText, fsIFont *pFont)
Definition fsCButtonComponent.cpp:155
fsBool highlightSetDo() override
Definition fsCButtonComponent.cpp:171
Definition fsCEntity.h:39
Definition fsCResourceName.h:32
Definition fsCUniqueId.h:21
Definition fsCVariableTable.h:27
fsIComponent(fsCEntity *pParent)
Definition fsIComponent.cpp:86
Definition fsIFont.h:34
fsIGestureHandlingComponent(fsCEntity *pParent, fsBool pHandleTaps, fsBool pHandleDragEvent, fsBool pHandlePinchEvents)
Definition fsIGestureHandlingComponent.cpp:448
Definition fsStr.h:23
bool fsBool
Definition fsBaseTypes.h:26
Definition fsCButtonComponent.h:33
fsStr mStr
Definition fsCButtonComponent.h:34
fsCButtonComponent * mParent
Definition fsCButtonComponent.h:35
Definition fsIMessageDispatcher.h:32
Definition fsPoint.h:17