| 1 |
/* |
| 2 |
* Copyright (C) 2017-2024 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 "input/joysticks/JoystickTypes.h" |
| 12 |
#include "input/keymaps/interfaces/IKeymap.h" |
| 13 |
|
| 14 |
#include <map> |
| 15 |
#include <string> |
| 16 |
|
| 17 |
namespace KODI |
| 18 |
{ |
| 19 |
namespace KEYMAP |
| 20 |
{ |
| 21 |
/*! |
| 22 |
* \ingroup keymap |
| 23 |
*/ |
| 24 |
class CWindowKeymap : public IWindowKeymap |
| 25 |
{ |
| 26 |
public: |
| 27 |
explicit CWindowKeymap(const std::string& controllerId); |
| 28 |
|
| 29 |
// implementation of IWindowKeymap |
| 30 |
std::string ControllerID() const override { return m_controllerId; } |
| 31 |
void MapAction(int windowId, const std::string& keyName, KeymapAction action) override; |
| 32 |
const KeymapActionGroup& GetActions(int windowId, const std::string& keyName) const override; |
| 33 |
|
| 34 |
private: |
| 35 |
// Construction parameter |
| 36 |
const std::string m_controllerId; |
| 37 |
|
| 38 |
using KeyName = std::string; |
| 39 |
using Keymap = std::map<KeyName, KeymapActionGroup>; |
| 40 |
|
| 41 |
using WindowID = int; |
| 42 |
using WindowMap = std::map<WindowID, Keymap>; |
| 43 |
|
| 44 |
WindowMap m_windowKeymap; |
| 45 |
}; |
| 46 |
} // namespace KEYMAP |
| 47 |
} // namespace KODI |