summaryrefslogtreecommitdiffstats
path: root/xbmc/input/keyboard/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/input/keyboard/interfaces')
-rw-r--r--xbmc/input/keyboard/interfaces/IActionMap.h36
-rw-r--r--xbmc/input/keyboard/interfaces/IKeyboardDriverHandler.h43
-rw-r--r--xbmc/input/keyboard/interfaces/IKeyboardInputHandler.h69
-rw-r--r--xbmc/input/keyboard/interfaces/IKeyboardInputProvider.h43
4 files changed, 191 insertions, 0 deletions
diff --git a/xbmc/input/keyboard/interfaces/IActionMap.h b/xbmc/input/keyboard/interfaces/IActionMap.h
new file mode 100644
index 0000000..e77643e
--- /dev/null
+++ b/xbmc/input/keyboard/interfaces/IActionMap.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+class CKey;
+
+namespace KODI
+{
+namespace KEYBOARD
+{
+/*!
+ * \brief Interface for translating keys to action IDs
+ */
+class IActionMap
+{
+public:
+ virtual ~IActionMap() = default;
+
+ /*!
+ * \brief Get the action ID mapped to the specified key
+ *
+ * \param key The key to look up
+ *
+ * \return The action ID from ActionIDs.h, or ACTION_NONE if no action is
+ * mapped to the specified key
+ */
+ virtual unsigned int GetActionID(const CKey& key) = 0;
+};
+} // namespace KEYBOARD
+} // namespace KODI
diff --git a/xbmc/input/keyboard/interfaces/IKeyboardDriverHandler.h b/xbmc/input/keyboard/interfaces/IKeyboardDriverHandler.h
new file mode 100644
index 0000000..828f0a9
--- /dev/null
+++ b/xbmc/input/keyboard/interfaces/IKeyboardDriverHandler.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+class CKey;
+
+namespace KODI
+{
+namespace KEYBOARD
+{
+/*!
+ * \ingroup keyboard
+ * \brief Interface for handling keyboard events
+ */
+class IKeyboardDriverHandler
+{
+public:
+ virtual ~IKeyboardDriverHandler() = default;
+
+ /*!
+ * \brief A key has been pressed
+ *
+ * \param key The pressed key
+ *
+ * \return True if the event was handled, false otherwise
+ */
+ virtual bool OnKeyPress(const CKey& key) = 0;
+
+ /*!
+ * \brief A key has been released
+ *
+ * \param key The released key
+ */
+ virtual void OnKeyRelease(const CKey& key) = 0;
+};
+} // namespace KEYBOARD
+} // namespace KODI
diff --git a/xbmc/input/keyboard/interfaces/IKeyboardInputHandler.h b/xbmc/input/keyboard/interfaces/IKeyboardInputHandler.h
new file mode 100644
index 0000000..f0df6a3
--- /dev/null
+++ b/xbmc/input/keyboard/interfaces/IKeyboardInputHandler.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2017-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "input/keyboard/KeyboardTypes.h"
+
+#include <stdint.h>
+#include <string>
+
+namespace KODI
+{
+namespace KEYBOARD
+{
+/*!
+ * \ingroup keyboard
+ * \brief Interface for handling input events for keyboards
+ *
+ * Input events are an abstraction over driver events. Keys are identified by
+ * the name defined in the keyboard's controller profile.
+ */
+class IKeyboardInputHandler
+{
+public:
+ virtual ~IKeyboardInputHandler() = default;
+
+ /*!
+ * \brief The add-on ID of the keyboard's controller profile
+ *
+ * \return The ID of the controller profile add-on
+ */
+ virtual std::string ControllerID() const = 0;
+
+ /*!
+ * \brief Return true if the input handler accepts the given key
+ *
+ * \param key A key belonging to the controller specified by ControllerID()
+ *
+ * \return True if the key is used for input, false otherwise
+ */
+ virtual bool HasKey(const KeyName& key) const = 0;
+
+ /*!
+ * \brief A key has been pressed
+ *
+ * \param key A key belonging to the controller specified by ControllerID()
+ * \param mod A combination of modifiers
+ * \param unicode The unicode value associated with the key, or 0 if unknown
+ *
+ * \return True if the event was handled, false otherwise
+ */
+ virtual bool OnKeyPress(const KeyName& key, Modifier mod, uint32_t unicode) = 0;
+
+ /*!
+ * \brief A key has been released
+ *
+ * \param key A key belonging to the controller specified by ControllerID()
+ * \param mod A combination of modifiers
+ * \param unicode The unicode value associated with the key, or 0 if unknown
+ */
+ virtual void OnKeyRelease(const KeyName& key, Modifier mod, uint32_t unicode) = 0;
+};
+} // namespace KEYBOARD
+} // namespace KODI
diff --git a/xbmc/input/keyboard/interfaces/IKeyboardInputProvider.h b/xbmc/input/keyboard/interfaces/IKeyboardInputProvider.h
new file mode 100644
index 0000000..5d964d5
--- /dev/null
+++ b/xbmc/input/keyboard/interfaces/IKeyboardInputProvider.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+namespace KODI
+{
+namespace KEYBOARD
+{
+class IKeyboardInputHandler;
+
+/*!
+ * \ingroup mouse
+ * \brief Interface for classes that can provide keyboard input
+ */
+class IKeyboardInputProvider
+{
+public:
+ virtual ~IKeyboardInputProvider() = default;
+
+ /*!
+ * \brief Registers a handler to be called on keyboard input
+ *
+ * \param handler The handler to receive keyboard input provided by this class
+ * \param bPromiscuous True to observe all events without affecting the
+ * input's destination
+ */
+ virtual void RegisterKeyboardHandler(IKeyboardInputHandler* handler, bool bPromiscuous) = 0;
+
+ /*!
+ * \brief Unregisters handler from keyboard input
+ *
+ * \param handler The handler that was receiving keyboard input
+ */
+ virtual void UnregisterKeyboardHandler(IKeyboardInputHandler* handler) = 0;
+};
+} // namespace KEYBOARD
+} // namespace KODI