xbmc
PeripheralMouse.h
1 /*
2  * Copyright (C) 2017-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "Peripheral.h"
12 #include "XBDateTime.h"
13 #include "input/mouse/interfaces/IMouseDriverHandler.h"
14 #include "threads/CriticalSection.h"
15 
16 #include <vector>
17 
18 namespace PERIPHERALS
19 {
21 {
22 public:
24  const PeripheralScanResult& scanResult,
25  CPeripheralBus* bus);
26 
27  ~CPeripheralMouse(void) override;
28 
29  // implementation of CPeripheral
30  bool InitialiseFeature(const PeripheralFeature feature) override;
31  void RegisterMouseDriverHandler(KODI::MOUSE::IMouseDriverHandler* handler,
32  bool bPromiscuous) override;
33  void UnregisterMouseDriverHandler(KODI::MOUSE::IMouseDriverHandler* handler) override;
34  CDateTime LastActive() override { return m_lastActive; }
35  KODI::GAME::ControllerPtr ControllerProfile() const override;
36 
37  // implementation of IMouseDriverHandler
38  bool OnPosition(int x, int y) override;
39  bool OnButtonPress(KODI::MOUSE::BUTTON_ID button) override;
40  void OnButtonRelease(KODI::MOUSE::BUTTON_ID button) override;
41 
42 private:
43  struct MouseHandle
44  {
46  bool bPromiscuous;
47  };
48 
49  std::vector<MouseHandle> m_mouseHandlers;
50  CCriticalSection m_mutex;
51  CDateTime m_lastActive;
52 };
53 } // namespace PERIPHERALS
bool InitialiseFeature(const PeripheralFeature feature) override
Initialise one of the features of this peripheral.
Definition: PeripheralMouse.cpp:37
Definition: PeripheralTypes.h:318
bool OnButtonPress(KODI::MOUSE::BUTTON_ID button) override
A mouse button has been pressed.
Definition: PeripheralMouse.cpp:113
Definition: RetroPlayerInput.h:15
KODI::GAME::ControllerPtr ControllerProfile() const override
Get the controller profile that best represents this peripheral.
Definition: PeripheralMouse.cpp:77
CDateTime LastActive() override
Return the last time this peripheral was active.
Definition: PeripheralMouse.h:34
Definition: PeripheralMouse.h:20
DateTime class, which uses FileTime as it&#39;s base.
Definition: XBDateTime.h:63
bool OnPosition(int x, int y) override
Handle mouse position updates.
Definition: PeripheralMouse.cpp:83
Definition: PeripheralBus.h:34
Interface for handling mouse driver events.
Definition: IMouseDriverHandler.h:21
void OnButtonRelease(KODI::MOUSE::BUTTON_ID button) override
A mouse button has been released.
Definition: PeripheralMouse.cpp:142
Definition: Peripheral.h:62
Definition: Peripherals.h:49