API Documentation
InputSystem.h
1 // InputSystem.h
3 //
5 
6 namespace nkWinUi
7 {
11  class InputSystem final : public nkCommon::MaybeSingletonClass<InputSystem>
12  {
13  public :
14 
15  // Tracking requests
22  void registerToTrack (EVENT_TYPE eventType, Component* component) ;
29  void unregisterTracking (EVENT_TYPE eventType, Component* component) ;
36  void requestWindowFollow (Component* caller, bool value) ;
37 
38  // Getters
42  std::function<bool (Component*)> getCloseCallback () const ;
46  std::function<void (Component*, bool)> getVisibilityCallback () const ;
50  std::function<void (Component*, const ClickEventData&)> getClickCallback () const ;
54  std::function<void (Component*, const WheelEventData&)> getWheelCallback () const ;
58  std::function<void (Component*, const KeyEventData&)> getKeyCallback () const ;
59 
63  const std::unordered_map<Component*, std::pair<bool, bool>>& getFollowedWindows () const ;
64 
65  // Setters
72  void setCloseCallback (std::function<bool (Component* caller)> callback) ;
79  void setVisibilityCallback (std::function<void (Component* caller, bool visibility)> callback) ;
86  void setClickCallback (std::function<void (Component* caller, const ClickEventData& eventData)> callback) ;
93  void setWheelCallback (std::function<void (Component* caller, const WheelEventData& eventData)> callback) ;
100  void setKeyCallback (std::function<void (Component* caller, const KeyEventData& eventData)> callback) ;
101  } ;
102 }
nkWinUi::ClickEventData
Data holder for a click event.
Definition: ClickEventData.h:12
nkWinUi::KeyEventData
Data holder for a key event.
Definition: KeyEventData.h:12
nkWinUi::InputSystem::getWheelCallback
std::function< void(Component *, const WheelEventData &)> getWheelCallback() const
nkWinUi::InputSystem::getClickCallback
std::function< void(Component *, const ClickEventData &)> getClickCallback() const
nkWinUi::InputSystem::registerToTrack
void registerToTrack(EVENT_TYPE eventType, Component *component)
nkWinUi::InputSystem::getCloseCallback
std::function< bool(Component *)> getCloseCallback() const
nkWinUi::InputSystem::setWheelCallback
void setWheelCallback(std::function< void(Component *caller, const WheelEventData &eventData)> callback)
nkWinUi::Component
Base class for any graphical component.
Definition: Component.h:12
nkWinUi::InputSystem::getFollowedWindows
const std::unordered_map< Component *, std::pair< bool, bool > > & getFollowedWindows() const
nkWinUi::InputSystem::requestWindowFollow
void requestWindowFollow(Component *caller, bool value)
nkWinUi::InputSystem::setCloseCallback
void setCloseCallback(std::function< bool(Component *caller)> callback)
nkWinUi::InputSystem::getKeyCallback
std::function< void(Component *, const KeyEventData &)> getKeyCallback() const
nkWinUi::InputSystem
Input system, centralizing default behaviour for the input.
Definition: InputSystem.h:12
nkWinUi::EVENT_TYPE
EVENT_TYPE
Represents an event type.
Definition: EventTypes.h:12
nkWinUi::InputSystem::getVisibilityCallback
std::function< void(Component *, bool)> getVisibilityCallback() const
nkWinUi::InputSystem::unregisterTracking
void unregisterTracking(EVENT_TYPE eventType, Component *component)
nkWinUi::WheelEventData
Data holder for a wheel event.
Definition: WheelEventData.h:12
nkWinUi
Encompasses all API of component NilkinsWinUi.
Definition: Clipboard.h:7
nkWinUi::InputSystem::setVisibilityCallback
void setVisibilityCallback(std::function< void(Component *caller, bool visibility)> callback)
nkWinUi::InputSystem::setClickCallback
void setClickCallback(std::function< void(Component *caller, const ClickEventData &eventData)> callback)
nkWinUi::InputSystem::setKeyCallback
void setKeyCallback(std::function< void(Component *caller, const KeyEventData &eventData)> callback)