9 void ITextIconListView::onRemove(
size_t index)
11 textData.erase(index);
14 LVITEMW ITextIconListView::makeItem(std::wstring_view text,
const std::filesystem::path& pathToIcon,
size_t index)
23 item.mask = LVIF_TEXT | LVIF_IMAGE;
24 item.pszText =
const_cast<wchar_t*
>(text.data());
25 item.cchTextMax =
static_cast<int>(text.size());
26 item.iImage = icons[pathToIcon];
27 item.iItem =
static_cast<int>(index);
46 return this->
addTextIconItem(localization::WTextLocalization::get()[localizationKey], pathToIcon);
51 LRESULT result = this->
addItem(this->makeItem(text, pathToIcon, index));
55 textData[index] = text.size();
63 return this->
insertTextIconItem(localization::WTextLocalization::get()[localizationKey], pathToIcon, index);
68 LRESULT result = this->
setItem(this->makeItem(text, pathToIcon, index));
72 textData[index] = text.size();
80 return this->
changeTextIconItem(localization::WTextLocalization::get()[localizationKey], pathToIcon, index);
90 text.resize(textData.at(index) + 1);
92 catch (
const out_of_range&)
97 item.iItem =
static_cast<int>(index);
98 item.mask = LVIF_TEXT | LVIF_IMAGE;
99 item.pszText = text.data();
100 item.cchTextMax =
static_cast<int>(text.size());
106 return { text,
static_cast<uint16_t
>(item.iImage), icons[item.iImage] };
Provides adding, deleting, setting, getting items for other list view interfaces.
virtual void getItem(LVITEMW &item) const
virtual size_t size() const final
virtual LRESULT addItem(const LVITEMW &item)
virtual LRESULT setItem(const LVITEMW &item)
virtual LRESULT addTextIconItem(std::wstring_view text, const std::filesystem::path &pathToIcon)
virtual LRESULT changeTextIconItem(std::wstring_view text, const std::filesystem::path &pathToIcon, size_t index)
ITextIconListView(HWND handle, utility::IconsHolder &icons)
virtual std::tuple< std::wstring, uint16_t, std::filesystem::path > getTextIconItem(size_t index) const
virtual LRESULT insertTextIconItem(std::wstring_view text, const std::filesystem::path &pathToIcon, size_t index)
virtual bool contains(const std::filesystem::path &pathToImage) const final
uint16_t addImage(const std::filesystem::path &pathToIcon) override