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

Namespace: kodi::gui::dialogs::Select

Selection dialog
The function listed below permits the call of a dialogue to select of an entry as a key More...

Topics

 Definitions, structures and enumerators
 Dialog Select definition values
Data structures associated with this dialog.
 

Namespaces

namespace  kodi::gui::dialogs::Select
 

Functions

int ATTR_DLL_LOCAL kodi::gui::dialogs::Select::Show (const std::string &heading, const std::vector< std::string > &entries, int selected=-1, unsigned int autoclose=0)
 Show a selection dialog about given parts.
 
int ATTR_DLL_LOCAL kodi::gui::dialogs::Select::Show (const std::string &heading, std::vector< kodi::gui::dialogs::SSelectionEntry > &entries, int selected=-1, unsigned int autoclose=0)
 Show a selection dialog about given parts.
 
bool ATTR_DLL_LOCAL kodi::gui::dialogs::Select::ShowMultiSelect (const std::string &heading, std::vector< kodi::gui::dialogs::SSelectionEntry > &entries, int autoclose=0)
 Show a multiple selection dialog about given parts.
 

Detailed Description

Namespace: kodi::gui::dialogs::Select

Selection dialog
The function listed below permits the call of a dialogue to select of an entry as a key

It has the header #include <kodi/gui/dialogs/Select.h> be included to enjoy it.

Function Documentation

◆ Show() [1/2]

int ATTR_DLL_LOCAL kodi::gui::dialogs::Select::Show ( const std::string & heading,
const std::vector< std::string > & entries,
int selected = -1,
unsigned int autoclose = 0 )
inline

Show a selection dialog about given parts.

Parameters
[in]headingDialog heading name
[in]entriesString list about entries
[in]selected[opt] Predefined selection (default is -1 for the first)
[in]autoclose[opt] To close dialog automatic after the given time in ms. As '0' it stays open.
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::Select::Show("Test selection", entries, -1);
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, int selected=-1, unsigned int autoclose=0)
Show a selection dialog about given parts.
Definition addons/kodi-dev-kit/include/kodi/gui/dialogs/select.h:106

◆ Show() [2/2]

int ATTR_DLL_LOCAL kodi::gui::dialogs::Select::Show ( const std::string & heading,
std::vector< kodi::gui::dialogs::SSelectionEntry > & entries,
int selected = -1,
unsigned int autoclose = 0 )
inline

Show a selection dialog about given parts.

This function is mostly equal to the other, only becomes the string list here done by a SSelectionEntry, where a ID string can be defined.

Parameters
[in]headingDialog heading name
[in]entriesSSelectionEntry list about entries
[in]selected[opt] Predefined selection (default is -1 for the first)
[in]autoclose[opt] To close dialog automatic after the given time in ms. As '0' it stays open.
Returns
The selected entry, if return -1 was nothing selected or canceled

Example:

std::vector<kodi::gui::dialogs::SSelectionEntry> entries
{
{ "ID 1", "Test 1", false },
{ "ID 2", "Test 2", false },
{ "ID 3", "Test 3", false },
{ "ID 4", "Test 4", false },
{ "ID 5", "Test 5", false }
};
int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1);
if (selected < 0)
fprintf(stderr, "Item selection canceled\n");
else
fprintf(stderr, "Selected item is: %i\n", selected);

◆ ShowMultiSelect()

bool ATTR_DLL_LOCAL kodi::gui::dialogs::Select::ShowMultiSelect ( const std::string & heading,
std::vector< kodi::gui::dialogs::SSelectionEntry > & entries,
int autoclose = 0 )
inline

Show a multiple selection dialog about given parts.

Parameters
[in]headingDialog heading name
[in]entriesSSelectionEntry list about entries
[in]autoclose[opt] To close dialog automatic after the given time in ms. As '0' it stays open.
Returns
The selected entries, if return empty was nothing selected or canceled

With selected on SSelectionEntry can be a pre selection defined.


Example:

std::vector<kodi::gui::dialogs::SSelectionEntry> entries
{
{ "ID 1", "Test 1", false },
{ "ID 2", "Test 2", false },
{ "ID 3", "Test 3", false },
{ "ID 4", "Test 4", false },
{ "ID 5", "Test 5", false }
};
bool ret = kodi::gui::dialogs::Select::ShowMultiSelect("Test selection", entries);
if (!ret)
fprintf(stderr, "Selection canceled\n");
else
{
fprintf(stderr, "Selected items:\n");
for (const auto& entry : entries)
{
if (entry.selected)
fprintf(stderr, " - %s\n", entry.selected.id.c_str());
}
}
bool ATTR_DLL_LOCAL ShowMultiSelect(const std::string &heading, std::vector< kodi::gui::dialogs::SSelectionEntry > &entries, int autoclose=0)
Show a multiple selection dialog about given parts.
Definition addons/kodi-dev-kit/include/kodi/gui/dialogs/select.h:234