Namespace: kodi::gui::dialogs::ContextMenu
Context menu dialog
The function listed below permits the call of a dialogue as context menu to select of an entry as a key
It has the header #include <kodi/gui/dialogs/ContextMenu.h> be included to enjoy it.
◆ Show() [1/3]
int ATTR_DLL_LOCAL Show |
( |
const std::string & | heading, |
|
|
const std::vector< std::string > & | entries ) |
|
inline |
Show a context menu dialog about given parts.
- Parameters
-
[in] | heading | Dialog heading name |
[in] | entries | String list about entries |
- Returns
- The selected entry, if return
-1
was nothing selected or canceled
Example:
#include <kodi/gui/dialogs/ContextMenu.h>
const std::vector<std::string> entries
{
"Test 1",
"Test 2",
"Test 3",
"Test 4",
"Test 5"
};
if (selected < 0)
fprintf(stderr, "Item selection canceled\n");
else
fprintf(stderr, "Selected item is: %i\n", selected);
◆ Show() [2/3]
int ATTR_DLL_LOCAL Show |
( |
const std::string & | heading, |
|
|
const std::vector< std::pair< std::string, std::string > > & | entries ) |
|
inline |
Show a context menu dialog about given parts.
- Parameters
-
[in] | heading | Dialog heading name |
[in] | entries | String list about entries |
- Returns
- The selected entry, if return
-1
was nothing selected or canceled
Example:
#include <kodi/gui/dialogs/ContextMenu.h>
const std::vector<std::pair<std::string, std::string>> entries
{
{ "ID 1", "Test 1" },
{ "ID 2", "Test 2" },
{ "ID 3", "Test 3" },
{ "ID 4", "Test 4" },
{ "ID 5", "Test 5" }
};
if (selected < 0)
fprintf(stderr, "Item selection canceled\n");
else
fprintf(stderr, "Selected item is: %i\n", selected);
◆ Show() [3/3]
int ATTR_DLL_LOCAL Show |
( |
const std::string & | heading, |
|
|
const std::vector< std::pair< int, std::string > > & | entries ) |
|
inline |
Show a context menu dialog about given parts.
- Parameters
-
[in] | heading | Dialog heading name |
[in] | entries | String list about entries |
- Returns
- The selected entry, if return
-1
was nothing selected or canceled
Example:
#include <kodi/gui/dialogs/ContextMenu.h>
const std::vector<std::pair<int, std::string>> entries
{
{ 1, "Test 1" },
{ 2, "Test 2" },
{ 3, "Test 3" },
{ 4, "Test 4" },
{ 5, "Test 5" }
};
if (selected < 0)
fprintf(stderr, "Item selection canceled\n");
else
fprintf(stderr, "Selected item is: %i\n", selected);