GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
BaseLoadableHolder.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace gui_framework
9{
10 namespace utility
11 {
12 enum class iconListViewType : uint32_t
13 {
14 icon,
15 smallIcon = 2
16 };
17
20 public interfaces::IIterable<std::filesystem::path, iterators::loadable_forward_iterator, iterators::loadable_const_forward_iterator>,
22 {
23 public:
24 enum class imageType : uint32_t
25 {
26 bitmap,
27 icon,
28 cursor
29 };
30
31 protected:
32 struct imageData
33 {
34 uint16_t index;
36 std::any data;
37
38 imageData(uint16_t index, imageType type, std::any&& data);
39
40 imageData(const imageData& other);
41
42 imageData(imageData&& other) noexcept;
43
44 imageData& operator = (const imageData& other);
45
46 imageData& operator = (imageData&& other) noexcept;
47
48 ~imageData();
49 };
50
51 private:
52 virtual json::JSONBuilder getStructure() const final override;
53
54 protected:
55 HIMAGELIST imageList;
56 std::unordered_map<std::wstring, imageData> images;
57 uint16_t imagesWidth;
58 uint16_t imagesHeight;
59
60 protected:
61 virtual uint16_t insertImage(const std::filesystem::path& pathToImage, imageType type) final;
62
63 public:
64 BaseLoadableHolder(uint16_t imagesWidth, uint16_t imagesHeight, size_t count = standard_sizes::defaultImagesCount);
65
66 virtual uint16_t addImage(const std::filesystem::path& pathToImage) = 0;
67
68 virtual void removeImage(const std::filesystem::path& pathToImage) final;
69
70 virtual void removeImage(uint16_t imageIndex) final;
71
72 virtual bool contains(const std::filesystem::path& pathToImage) const final;
73
74 virtual uint16_t getImagesWidth() const final;
75
76 virtual uint16_t getImagesHeight() const final;
77
82 virtual uint16_t getImageIndex(const std::filesystem::path& pathToImage) const final;
83
84 virtual imageType getImageType(const std::filesystem::path& pathToImage) const final;
85
90 virtual imageType getImageType(uint16_t imageIndex) const final;
91
92 virtual HIMAGELIST getImageList() const final;
93
98 virtual uint16_t operator [] (const std::filesystem::path& pathToImage) const final;
99
104 virtual std::filesystem::path operator [] (uint16_t index) const final;
105
107 virtual iterators::loadable_forward_iterator begin() noexcept final override;
108
109 virtual iterators::loadable_const_forward_iterator cbegin() const noexcept final override;
110
111 virtual iterators::loadable_forward_iterator end() noexcept final override;
112
113 virtual iterators::loadable_const_forward_iterator cend() const noexcept final override;
114
115 virtual std::pair<std::string, json::utility::jsonObject::variantType>& loadBaseLoadableHolderStructure(json::utility::jsonObject& current) const final;
116
117 virtual ~BaseLoadableHolder();
118 };
119 }
120}
#define GUI_FRAMEWORK_API
Specify iterable class.
Definition IIterable.h:15
Provides interface for serializable to JSON format.
Base class for all visual asset loaders.
imageData(uint16_t index, imageType type, std::any &&data)