本文整理汇总了C++中CGUIDialogSelect::SetAutoClose方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogSelect::SetAutoClose方法的具体用法?C++ CGUIDialogSelect::SetAutoClose怎么用?C++ CGUIDialogSelect::SetAutoClose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogSelect
的用法示例。
在下文中一共展示了CGUIDialogSelect::SetAutoClose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
int Interface_GUIDialogSelect::open(void* kodiBase, const char *heading, const char *entries[], unsigned int size, int selected, unsigned int autoclose)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "Interface_GUIDialogSelect::%s - invalid data", __FUNCTION__);
return -1;
}
CGUIDialogSelect* dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (!heading || !entries || !dialog)
{
CLog::Log(LOGERROR,
"Interface_GUIDialogSelect::%s - invalid handler data (heading='%p', entries='%p', "
"dialog='%p') on addon '%s'",
__FUNCTION__, heading, static_cast<const void*>(entries), static_cast<void*>(dialog),
addon->ID().c_str());
return -1;
}
dialog->Reset();
dialog->SetHeading(CVariant{heading});
for (unsigned int i = 0; i < size; ++i)
dialog->Add(entries[i]);
if (selected > 0)
dialog->SetSelected(selected);
if (autoclose > 0)
dialog->SetAutoClose(autoclose);
dialog->Open();
return dialog->GetSelectedItem();
}
示例2: dcguard
std::vector<int>* Dialog::multiselect(const String& heading,
const std::vector<String>& options, int autoclose)
{
DelayedCallGuard dcguard(languageHook);
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (pDialog == nullptr)
throw WindowException("Error: Window is NULL");
pDialog->Reset();
pDialog->SetMultiSelection(true);
pDialog->SetHeading(CVariant{heading});
for (const auto& option : options)
pDialog->Add(option);
if (autoclose > 0)
pDialog->SetAutoClose(autoclose);
pDialog->Open();
if (pDialog->IsConfirmed())
return new std::vector<int>(pDialog->GetSelectedItems());
else
return nullptr;
}
示例3: open_multi_select
bool Interface_GUIDialogSelect::open_multi_select(void* kodiBase, const char *heading, const char *entryIDs[], const char *entryNames[],
bool entriesSelected[], unsigned int size, unsigned int autoclose)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
if (!addon)
{
CLog::Log(LOGERROR, "Interface_GUIDialogMultiSelect::%s - invalid data", __FUNCTION__);
return false;
}
CGUIDialogSelect* dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
if (!heading || !entryIDs || !entryNames || !entriesSelected || !dialog)
{
CLog::Log(LOGERROR,
"Interface_GUIDialogMultiSelect::%s - invalid handler data (heading='%p', "
"entryIDs='%p', entryNames='%p', entriesSelected='%p', dialog='%p') on addon '%s'",
__FUNCTION__, heading, static_cast<const void*>(entryIDs),
static_cast<const void*>(entryNames), static_cast<void*>(entriesSelected),
static_cast<void*>(dialog), addon->ID().c_str());
return false;
}
dialog->Reset();
dialog->SetMultiSelection(true);
dialog->SetHeading(CVariant{heading});
std::vector<int> selectedIndexes;
for (unsigned int i = 0; i < size; ++i)
{
dialog->Add(entryNames[i]);
if (entriesSelected[i])
selectedIndexes.push_back(i);
}
dialog->SetSelected(selectedIndexes);
if (autoclose > 0)
dialog->SetAutoClose(autoclose);
dialog->Open();
if (dialog->IsConfirmed())
{
for (unsigned int i = 0; i < size; ++i)
entriesSelected[i] = false;
selectedIndexes = dialog->GetSelectedItems();
for (unsigned int i = 0; i < selectedIndexes.size(); ++i)
{
if (selectedIndexes[i])
entriesSelected[selectedIndexes[i]] = true;
}
}
return true;
}