You.i Engine
YiToggleButtonView.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_TOGGLEBUTTON_VIEW_H_
3 #define _YI_TOGGLEBUTTON_VIEW_H_
4 
6 
47 {
48 public:
52  enum class ToggleState
53  {
54  Off = 0,
55  On
56  };
57 
59  virtual ~CYIToggleButtonView();
60 
61  virtual bool Init() override;
62 
67  void SetToggled(bool isToggled);
68 
73  void ToggleOn();
74 
79  void ToggleOff();
80 
84  bool IsToggledOn() const;
85 
90  void SetState(CYIAbstractButtonView::EnableState enabledState, ToggleState toggleState);
91 
112 protected:
116  enum class EmitSignals
117  {
118  Emit,
119  DoNotEmit
120  };
121 
122  virtual void OnEnable() override;
123  virtual void OnDisable() override;
124  virtual void OnPress() override;
125  virtual void OnRelease() override;
126  virtual void OnEnter() override;
127  virtual void OnLeave() override;
128  virtual void OnCancel() override;
129 
134  virtual void OnToggleOn(EmitSignals signals);
135 
140  virtual void OnToggleOff(EmitSignals signals);
141 
142  virtual void FinishAllPlayingTimelines() override;
146  virtual void FinishAllPlayingFocusTimelines();
147 
151  void ToggleOn(EmitSignals signals);
155  void ToggleOff(EmitSignals signals);
156 
157  void OnPressOnCompleted();
158  void OnPressOffCompleted();
159  void OnReleaseOnCompleted();
160  void OnReleaseOffCompleted();
161 
162  virtual bool HandleEvent(const std::shared_ptr<CYIEventDispatcher> &pDispatcher, CYIEvent *pEvent) override;
163 
165 
182 
184 };
185 
190 #endif // _YI_TOGGLEBUTTON_VIEW_H_
EnableState
Definition: YiAbstractButtonView.h:31
virtual void OnPress() override
The base class for the timeline framework.
Definition: YiAbstractTimeline.h:29
CYIAbstractTimeline * m_pUpOverCheckedAnim
Definition: YiToggleButtonView.h:173
virtual ~CYIToggleButtonView()
virtual void OnDisable() override
CYIAbstractTimeline * m_pDownUpAnim
Definition: YiToggleButtonView.h:176
Provides an abstraction for a button which accepts user interaction in the form of a press...
Definition: YiAbstractButtonView.h:25
CYISignal< int32_t > ButtonReleasingOn
Definition: YiToggleButtonView.h:105
CYIAbstractTimeline * m_pToggleOnAnim
Definition: YiToggleButtonView.h:168
virtual void OnEnter() override
Base class for events.
Definition: YiEvent.h:27
CYISignal< int32_t > ButtonPressingOn
Definition: YiToggleButtonView.h:93
void OnReleaseOffCompleted()
virtual bool Init() override
CYIAbstractTimeline * m_pOverUpAnim
Definition: YiToggleButtonView.h:174
CYIAbstractTimeline * m_pFocusInCheckedAnim
Definition: YiToggleButtonView.h:178
CYISignal< int32_t > ButtonToggledOff
Definition: YiToggleButtonView.h:102
void SetToggled(bool isToggled)
bool IsToggledOn() const
CYISignal< bool, int32_t > ButtonReleasing
Definition: YiToggleButtonView.h:104
CYISignal< bool, int32_t > ButtonToggled
Definition: YiToggleButtonView.h:100
CYISignal< int32_t > ButtonReleasedOn
Definition: YiToggleButtonView.h:109
virtual void OnEnable() override
CYIAbstractTimeline * m_pDisableAnim
Definition: YiToggleButtonView.h:170
CYISignal< int32_t > ButtonToggledOn
Definition: YiToggleButtonView.h:101
CYISignal< bool, int32_t > ButtonPressing
Definition: YiToggleButtonView.h:92
CYISignal< int32_t > ButtonPressedOn
Definition: YiToggleButtonView.h:97
CYIAbstractTimeline * m_pPressCheckedAnim
Definition: YiToggleButtonView.h:167
virtual void OnToggleOff(EmitSignals signals)
CYIAbstractTimeline * m_pDisableCheckedAnim
Definition: YiToggleButtonView.h:171
virtual void OnToggleOn(EmitSignals signals)
Provides an implementation of a button which maintains a state based on user interaction.
Definition: YiToggleButtonView.h:46
CYISignal< int32_t > ButtonReleasingOff
Definition: YiToggleButtonView.h:106
virtual void FinishAllPlayingTimelines() override
CYIAbstractTimeline * m_pFocusInCheckedToggleTransitionAnim
Definition: YiToggleButtonView.h:181
virtual bool HandleEvent(const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
CYIAbstractTimeline * m_pOverUpCheckedAnim
Definition: YiToggleButtonView.h:175
CYISignal< int32_t > ButtonPressedOff
Definition: YiToggleButtonView.h:98
virtual void OnRelease() override
EmitSignals
Definition: YiToggleButtonView.h:116
virtual void OnCancel() override
CYISignal< int32_t > ButtonReleasedOff
Definition: YiToggleButtonView.h:110
ToggleState
Definition: YiToggleButtonView.h:52
CYISignal< bool, int32_t > ButtonPressed
Definition: YiToggleButtonView.h:96
void SetState(CYIAbstractButtonView::EnableState enabledState, ToggleState toggleState)
virtual void FinishAllPlayingFocusTimelines()
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
CYIAbstractTimeline * m_pDownUpCheckedAnim
Definition: YiToggleButtonView.h:177
virtual void OnLeave() override
CYIAbstractTimeline * m_pToggleOffAnim
Definition: YiToggleButtonView.h:169
CYISignal< bool, int32_t > ButtonReleased
Definition: YiToggleButtonView.h:108
CYISignal< int32_t > ButtonPressingOff
Definition: YiToggleButtonView.h:94
CYIAbstractTimeline * m_pFocusOutCheckedAnim
Definition: YiToggleButtonView.h:179
ToggleState m_toggleState
Definition: YiToggleButtonView.h:164
CYIAbstractTimeline * m_pUpOverAnim
Definition: YiToggleButtonView.h:172
CYIAbstractTimeline * m_pPressAnim
Definition: YiToggleButtonView.h:166
CYIAbstractTimeline * m_pFocusInToggleTransitionAnim
Definition: YiToggleButtonView.h:180