Kodi Development  20.0
for Binary and Script based Add-Ons
Dialog Context Menu

Detailed Description

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.

Function Documentation

◆ Show() [1/3]

int ATTRIBUTE_HIDDEN kodi::gui::dialogs::ContextMenu::Show ( const std::string &  heading,
const std::vector< std::string > &  entries 
)
inline

Show a context menu dialog about given parts.

Parameters
[in]headingDialog heading name
[in]entriesString 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"
};
int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries);
if (selected < 0)
fprintf(stderr, "Item selection canceled\n");
else
fprintf(stderr, "Selected item is: %i\n", selected);
int ATTRIBUTE_HIDDEN Show(const std::string &heading, const std::vector< std::string > &entries)
Show a context menu dialog about given parts.
Definition: ContextMenu.h:68

◆ Show() [2/3]

int ATTRIBUTE_HIDDEN kodi::gui::dialogs::ContextMenu::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]headingDialog heading name
[in]entriesString 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" }
};
int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries);
if (selected < 0)
fprintf(stderr, "Item selection canceled\n");
else
fprintf(stderr, "Selected item is: %i\n", selected);

◆ Show() [3/3]

int ATTRIBUTE_HIDDEN kodi::gui::dialogs::ContextMenu::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]headingDialog heading name
[in]entriesString 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" }
};
int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries);
if (selected < 0)
fprintf(stderr, "Item selection canceled\n");
else
fprintf(stderr, "Selected item is: %i\n", selected);