GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
IIconListView.cpp
Go to the documentation of this file.
1#include "IIconListView.h"
2
3using namespace std;
4
5namespace gui_framework
6{
7 namespace interfaces
8 {
11 icons(icons)
12 {
13
14 }
15
16 LRESULT IIconListView::addIconItem(const filesystem::path& pathToIcon)
17 {
18 return this->insertIconItem(pathToIcon, this->size());
19 }
20
21 LRESULT IIconListView::insertIconItem(const filesystem::path& pathToIcon, size_t index)
22 {
23 LVITEMW item = {};
24
25 if (!icons.contains(pathToIcon))
26 {
27 icons.addImage(pathToIcon);
28 }
29
30 item.mask = LVIF_IMAGE;
31 item.iImage = icons[pathToIcon];
32 item.iItem = static_cast<int>(index);
33
34 return this->addItem(item);
35 }
36
37 filesystem::path IIconListView::getIconPath(size_t index) const
38 {
39 LVITEMW item = {};
40
41 item.iItem = static_cast<int>(index);
42 item.mask = LVIF_IMAGE;
43
44 this->getItem(item);
45
46 return icons[item.iImage];
47 }
48
49 size_t IIconListView::getIconIndex(size_t index) const
50 {
51 LVITEMW item = {};
52
53 item.iItem = static_cast<int>(index);
54 item.mask = LVIF_IMAGE;
55
56 this->getItem(item);
57
58 return item.iImage;
59 }
60 }
61}
Provides adding, deleting, setting, getting items for other list view interfaces.
virtual LRESULT addIconItem(const std::filesystem::path &pathToIcon)
virtual std::filesystem::path getIconPath(size_t index) const
IIconListView(HWND handle, utility::IconsHolder &icons)
virtual LRESULT insertIconItem(const std::filesystem::path &pathToIcon, size_t index)
virtual size_t getIconIndex(size_t index) const
virtual bool contains(const std::filesystem::path &pathToImage) const final
uint16_t addImage(const std::filesystem::path &pathToIcon) override