Debian Codegraph @

xbmc/games/dialogs/osd/DialogGameSaves.h

raw
1 /*
2 * Copyright (C) 2020-2021 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/GUIDialog.h"
12
13 #include <memory>
14 #include <string>
15
16 class CFileItem;
17 class CFileItemList;
18 class CGUIMessage;
19 class CGUIViewControl;
20
21 namespace KODI
22 {
23 namespace GAME
24 {
25 /*!
26 * \ingroup games
27 */
28 class CDialogGameSaves : public CGUIDialog
29 {
30 public:
31 CDialogGameSaves();
32 ~CDialogGameSaves() override = default;
33
34 // implementation of CGUIControl via CGUIDialog
35 bool OnMessage(CGUIMessage& message) override;
36
37 // implementation of CGUIWindow via CGUIDialog
38 void FrameMove() override;
39
40 // Player interface
41 void Reset();
42 bool Open(const std::string& gamePath);
43 bool IsConfirmed() const { return m_bConfirmed; }
44 bool IsNewPressed() const { return m_bNewPressed; }
45 std::string GetSelectedItemPath();
46
47 protected:
48 // implementation of CGUIWIndow via CGUIDialog
49 void OnInitWindow() override;
50 void OnDeinitWindow(int nextWindowID) override;
51 void OnWindowLoaded() override;
52 void OnWindowUnload() override;
53
54 private:
55 using CGUIControl::OnFocus;
56
57 /*!
58 * \breif Called when opening to set the item list
59 */
60 void SetItems(const CFileItemList& itemList);
61
62 /*!
63 * \brief Called when an item has been selected
64 */
65 void OnSelect(const CFileItem& item);
66
67 /*!
68 * \brief Called every frame with the item being focused
69 */
70 void OnFocus(const CFileItem& item);
71
72 /*!
73 * \brief Called every frame if no item is focused
74 */
75 void OnFocusLost();
76
77 /*!
78 * \brief Called when a context menu is opened for an item
79 */
80 void OnContextMenu(CFileItem& item);
81
82 /*!
83 * \brief Called when "Rename" is selected from the context menu
84 */
85 void OnRename(CFileItem& item);
86
87 /*!
88 * \brief Called when "Delete" is selected from the context menu
89 */
90 void OnDelete(CFileItem& item);
91
92 /*!
93 * \brief Called every frame with the caption to set
94 */
95 void HandleCaption(const std::string& caption);
96
97 /*!
98 * \brief Called every frame with the game client to set
99 */
100 void HandleGameClient(const std::string& gameClientId);
101
102 // Dialog parameters
103 std::unique_ptr<CGUIViewControl> m_viewControl;
104 std::unique_ptr<CFileItemList> m_vecList;
105 std::shared_ptr<CFileItem> m_selectedItem;
106
107 // Player parameters
108 bool m_bConfirmed{false};
109 bool m_bNewPressed{false};
110
111 // State parameters
112 std::string m_currentCaption;
113 std::string m_currentGameClient;
114 };
115 } // namespace GAME
116 } // namespace KODI