summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2017-07-23 16:59:43 +0200
committermanuel <manuel@mausz.at>2017-07-23 16:59:43 +0200
commit4c3251ec645c8b71820dab7e51e612e5919d4e75 (patch)
tree9533268a93e58fc2e16de1b8ee3fafe3784e5225 /xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h
parentf44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (diff)
downloadkodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.gz
kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.tar.bz2
kodi-pvr-build-4c3251ec645c8b71820dab7e51e612e5919d4e75.zip
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h95
1 files changed, 0 insertions, 95 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h
deleted file mode 100644
index 66a1c90..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h
+++ /dev/null
@@ -1,95 +0,0 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "definitions.h"
23#include "../AddonBase.h"
24
25namespace kodi
26{
27namespace gui
28{
29
30 //============================================================================
31 ///
32 /// \defgroup cpp_kodi_gui_DialogContextMenu Dialog Context Menu
33 /// \ingroup cpp_kodi_gui
34 /// @brief \cpp_namespace{ kodi::gui::DialogContextMenu }
35 /// **Context menu dialog**
36 ///
37 /// The function listed below permits the call of a dialogue as context menu to
38 /// select of an entry as a key
39 ///
40 /// It has the header \ref DialogContextMenu.h "#include <kodi/gui/DialogContextMenu.h>"
41 /// be included to enjoy it.
42 ///
43 ///
44 namespace DialogContextMenu
45 {
46 //==========================================================================
47 ///
48 /// \ingroup cpp_kodi_gui_DialogContextMenu
49 /// @brief Show a context menu dialog about given parts.
50 ///
51 /// @param[in] heading Dialog heading name
52 /// @param[in] entries String list about entries
53 /// @return The selected entry, if return <tt>-1</tt> was nothing selected or canceled
54 ///
55 ///
56 ///-------------------------------------------------------------------------
57 ///
58 /// **Example:**
59 /// ~~~~~~~~~~~~~{.cpp}
60 /// #include <kodi/gui/DialogContextMenu.h>
61 ///
62 /// const std::vector<std::string> entries
63 /// {
64 /// "Test 1",
65 /// "Test 2",
66 /// "Test 3",
67 /// "Test 4",
68 /// "Test 5"
69 /// };
70 ///
71 /// int selected = kodi::gui::DialogContextMenu::Show("Test selection", entries);
72 /// if (selected < 0)
73 /// fprintf(stderr, "Item selection canceled\n");
74 /// else
75 /// fprintf(stderr, "Selected item is: %i\n", selected);
76 /// ~~~~~~~~~~~~~
77 ///
78 inline int Show(const std::string& heading, const std::vector<std::string>& entries)
79 {
80 using namespace ::kodi::addon;
81 unsigned int size = entries.size();
82 const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**)));
83 for (unsigned int i = 0; i < size; ++i)
84 {
85 cEntries[i] = entries[i].c_str();
86 }
87 int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size);
88 free(cEntries);
89 return ret;
90 }
91 //--------------------------------------------------------------------------
92 };
93
94} /* namespace gui */
95} /* namespace kodi */