xbmc
WindowKeymap.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 "IKeymap.h"
13 
14 #include <map>
15 #include <string>
16 
18 {
19 public:
20  explicit CWindowKeymap(const std::string& controllerId);
21 
22  // implementation of IWindowKeymap
23  std::string ControllerID() const override { return m_controllerId; }
24  void MapAction(int windowId,
25  const std::string& keyName,
26  KODI::JOYSTICK::KeymapAction action) override;
28  const std::string& keyName) const override;
29 
30 private:
31  // Construction parameter
32  const std::string m_controllerId;
33 
34  using KeyName = std::string;
35  using Keymap = std::map<KeyName, KODI::JOYSTICK::KeymapActionGroup>;
36 
37  using WindowID = int;
38  using WindowMap = std::map<WindowID, Keymap>;
39 
40  WindowMap m_windowKeymap;
41 };
const KODI::JOYSTICK::KeymapActionGroup & GetActions(int windowId, const std::string &keyName) const override
Get the actions for a given key name and window ID.
Definition: WindowKeymap.cpp:37
std::string ControllerID() const override
The controller ID.
Definition: WindowKeymap.h:23
Container that sorts action entries by their holdtime.
Definition: JoystickTypes.h:180
Definition: WindowKeymap.h:17
Action entry in joystick.xml.
Definition: JoystickTypes.h:166
void MapAction(int windowId, const std::string &keyName, KODI::JOYSTICK::KeymapAction action) override
Add an action to the keymap for a given key name and window ID.
Definition: WindowKeymap.cpp:19
Interface for mapping buttons to Kodi actions for specific windows.
Definition: IKeymap.h:54