1 /*
2  *  Copyright (C) 2012-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 "guilib/WindowIDs.h"
12 #include "guilib/guiinfo/GUIInfoProvider.h"
13 
14 #include <map>
15 
16 namespace KODI
17 {
18 namespace GUILIB
19 {
20 namespace GUIINFO
21 {
22 
23 class CGUIInfo;
24 
25 class CGUIControlsGUIInfo : public CGUIInfoProvider
26 {
27 public:
28   ~CGUIControlsGUIInfo() override = default;
29 
30   // KODI::GUILIB::GUIINFO::IGUIInfoProvider implementation
31   bool InitCurrentItem(CFileItem *item) override;
32   bool GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const override;
33   bool GetInt(int& value, const CGUIListItem *item, int contextWindow, const CGUIInfo &info) const override;
34   bool GetBool(bool& value, const CGUIListItem *item, int contextWindow, const CGUIInfo &info) const override;
35 
SetNextWindow(int windowID)36   void SetNextWindow(int windowID) { m_nextWindowID = windowID; };
SetPreviousWindow(int windowID)37   void SetPreviousWindow(int windowID) { m_prevWindowID = windowID; };
38 
39   /*! \brief containers call this to specify that the focus is changing
40    \param id control id
41    \param next true if we're moving to the next item, false if previous
42    \param scrolling true if the container is scrolling, false if the movement requires no scroll
43    */
44   void SetContainerMoving(int id, bool next, bool scrolling);
45   void ResetContainerMovingCache();
46 
47 private:
48   int m_nextWindowID = WINDOW_INVALID;
49   int m_prevWindowID = WINDOW_INVALID;
50 
51   std::map<int, int> m_containerMoves;  // direction of list moving
52 };
53 
54 } // namespace GUIINFO
55 } // namespace GUILIB
56 } // namespace KODI
57