kodi
PVRContextMenus.h
1 /*
2  * Copyright (C) 2016-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 "utils/EventStream.h"
12 
13 #include <memory>
14 #include <vector>
15 
16 class IContextMenuItem;
17 
18 namespace PVR
19 {
20 enum class PVRContextMenuEventAction
21 {
22  ADD_ITEM,
23  REMOVE_ITEM
24 };
25 
27 {
28  PVRContextMenuEvent(const PVRContextMenuEventAction& a,
29  const std::shared_ptr<IContextMenuItem>& i)
30  : action(a), item(i)
31  {
32  }
33 
34  PVRContextMenuEventAction action;
35  std::shared_ptr<IContextMenuItem> item;
36 };
37 
38 class CPVRClientMenuHook;
39 
41 {
42 public:
43  static CPVRContextMenuManager& GetInstance();
44 
45  std::vector<std::shared_ptr<IContextMenuItem>> GetMenuItems() const { return m_items; }
46 
47  void AddMenuHook(const CPVRClientMenuHook& hook);
48  void RemoveMenuHook(const CPVRClientMenuHook& hook);
49 
53  CEventStream<PVRContextMenuEvent>& Events() { return m_events; }
54 
55 private:
58  CPVRContextMenuManager const& operator=(CPVRContextMenuManager const&) = delete;
59  virtual ~CPVRContextMenuManager() = default;
60 
61  std::vector<std::shared_ptr<IContextMenuItem>> m_items;
63 };
64 
65 } // namespace PVR
Definition: ContextMenuManager.h:24
Definition: EventStream.h:65
Definition: PVRContextMenus.h:40
Definition: ContextMenuItem.h:28
CEventStream< PVRContextMenuEvent > & Events()
Query the events available for CEventStream.
Definition: PVRContextMenus.h:53
Definition: PVRContextMenus.h:26
Definition: PVRClientMenuHooks.h:20
Definition: EventStream.h:22