Files
MuditaOS/module-apps/apps-common/options/OptionsList.cpp
Lefucjusz 773f2c7eb1 [BH-2069] Update license URL in headers
Update outdated license file URL in
license headers across all project.
2024-09-18 11:53:01 +02:00

67 lines
1.8 KiB
C++

// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md
#include "OptionsList.hpp"
namespace gui
{
template <class ListType>
OptionsList<ListType>::OptionsList(std::shared_ptr<OptionsModel> model, std::list<Option> options)
: optionsModel{std::move(model)}, options(std::move(options))
{}
template <class ListType>
void OptionsList<ListType>::createOptions()
{
optionsModel->createData(options);
}
template <class ListType>
void OptionsList<ListType>::refreshOptions(std::list<Option> &&optionList)
{
options = std::move(optionList);
optionsList->rebuildList(listview::RebuildType::InPlace);
}
template <class ListType>
void OptionsList<ListType>::refreshOptions(std::list<Option> &&optionList, unsigned int pageIndex)
{
options = std::move(optionList);
optionsList->rebuildList(listview::RebuildType::OnPageElement, pageIndex);
}
template <class ListType>
void OptionsList<ListType>::addOptions(std::list<Option> &&optionList)
{
options = std::move(optionList);
createOptions();
optionsList->rebuildList();
}
template <class ListType>
void OptionsList<ListType>::changeOptions(std::list<Option> &&optionList)
{
clearOptions();
addOptions(std::move(optionList));
}
template <class ListType>
void OptionsList<ListType>::recreateOptions()
{
clearOptions();
createOptions();
}
template <class ListType>
void OptionsList<ListType>::clearOptions()
{
optionsList->clear();
optionsModel->clearData();
}
template class OptionsList<ListView>;
template class OptionsList<ListViewWithArrows>;
} // namespace gui