Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
Dialog Context Menu

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 More...

Functions

int ATTR_DLL_LOCAL kodi::gui::dialogs::ContextMenu::Show (const std::string &heading, const std::vector< std::string > &entries)
 Show a context menu dialog about given parts.
 
int ATTR_DLL_LOCAL kodi::gui::dialogs::ContextMenu::Show (const std::string &heading, const std::vector< std::pair< std::string, std::string > > &entries)
 Show a context menu dialog about given parts.
 
int ATTR_DLL_LOCAL kodi::gui::dialogs::ContextMenu::Show (const std::string &heading, const std::vector< std::pair< int, std::string > > &entries)
 Show a context menu dialog about given parts.
 

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 ATTR_DLL_LOCAL 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:

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);
int ATTR_DLL_LOCAL Show(const std::string &heading, const std::vector< std::string > &entries)
Show a context menu dialog about given parts.
Definition kodi-dev-kit/include/kodi/gui/dialogs/ContextMenu.h:68

◆ Show() [2/3]

int ATTR_DLL_LOCAL 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:

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 ATTR_DLL_LOCAL 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:

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);