Rose
PointerInteractions.h
1 
8 #pragma once
9 
10 #include "Callbacks.h"
11 
12 namespace rose {
13 
14  class Widget;
15 
21  enum class ButtonType {
22  Label,
23  PushButton,
24  ToggleButton,
25  };
26 
32  protected:
33 
45  };
46 
50  uint mButtonCommandId{0};
51 
52 
53  void setButtonState(bool active);
54  void enterLeaveCallback();
55  void displayState();
56 
57  ButtonDisplayCallback mButtonDisplayCallback{};
58  ButtonStateChangeCallback mButtonStateChangeCallback{};
59  ButtonCommandCallback mButtonCommandCallback{};
60 
61  public:
62  ButtonSemantics() = delete;
63  virtual ~ButtonSemantics() = default;
64 
65  explicit ButtonSemantics(Widget &);
66 
67  ButtonSemantics(const ButtonSemantics&) = delete;
68  ButtonSemantics(ButtonSemantics&&) = delete;
69 
70  ButtonSemantics& operator=(const ButtonSemantics&) = delete;
71  ButtonSemantics& operator=(ButtonSemantics&&) = delete;
72 
73  void setButtonType(ButtonType buttonType);
74 
79  void setButtonDisplayCallback(ButtonDisplayCallback buttonDisplayCallback) {
80  mButtonDisplayCallback = std::move(buttonDisplayCallback);
81  }
82 
87  void setButtonStateChangeCallback(ButtonStateChangeCallback buttonStateChangeCallback) {
88  mButtonStateChangeCallback = std::move(buttonStateChangeCallback);
89  }
90 
96  void setButtonCommandCallback(uint commandId, ButtonCommandCallback buttonCommandCallback) {
97  mButtonCommandId = commandId;
98  mButtonCommandCallback = std::move(buttonCommandCallback);
99  }
100  };
101 }
102 
Transitional state moving to Inactive.
Definition: PointerInteractions.h:44
When pressed and released signals an action.
std::function< void(ButtonStateChange buttonStateChange, uint commandId)> ButtonCommandCallback
Button command callback.
Definition: Callbacks.h:82
Button in Inactive state.
Definition: PointerInteractions.h:39
void setButtonCommandCallback(uint commandId, ButtonCommandCallback buttonCommandCallback)
Definition: PointerInteractions.h:96
A toggle button.
Definition: Constants.h:93
std::function< void(ButtonStateChange buttonStateChange)> ButtonStateChangeCallback
Button state change callback.
Definition: Callbacks.h:75
Button was pressed in the Active state.
Definition: PointerInteractions.h:41
Interpret interaction events to drive button operation semantics.
Definition: PointerInteractions.h:31
Button was pressed in the Inactive state.
Definition: PointerInteractions.h:42
Definitions to support callbacks.
std::function< void(ButtonDisplayState buttonDisplayState)> ButtonDisplayCallback
Button display state callback.
Definition: Callbacks.h:69
ButtonType
The button type.
Definition: PointerInteractions.h:21
InteractionState
Internal state.
Definition: PointerInteractions.h:38
void setButtonDisplayCallback(ButtonDisplayCallback buttonDisplayCallback)
Set the ButtonDisplayCallback function.
Definition: PointerInteractions.h:79
void setButtonStateChangeCallback(ButtonStateChangeCallback buttonStateChangeCallback)
Set the ButtonStateChangeCallback function.
Definition: PointerInteractions.h:87
Transitional state moving to Active.
Definition: PointerInteractions.h:43
An element of the application user interface.
Definition: Visual.h:451
Draw the background.
Widget & mWidget
The Widget that implements the button.
Definition: PointerInteractions.h:49
ToDo: There is an issue that the initial scroll interaction is lost if the click/press lands on a Wid...
Definition: CelestialOverlay.cpp:13
Button in Active state.
Definition: PointerInteractions.h:40
A button without any button semantics but can be inverted and animated.
Button is inactive (not pushed, toggled off, etc).