TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_file_icons.h
Go to the documentation of this file.
1#pragma once
2
3// The icons the OS shows for files and folders, as picture icons for a file view.
4
6
7#include <cstdint>
8#include <string>
9#include <string_view>
10#include <unordered_map>
11#include <vector>
12
13namespace tachyon
14{
15 class ITextSystem;
16
19
26 {
27 public:
28 explicit FileIcons(ITextSystem& textSystem, uint32_t pixels = 48);
32 FileIcons(const FileIcons&) = delete;
33 FileIcons& operator=(const FileIcons&) = delete;
34
35 IconID Get(std::string_view name, bool isFolder);
38
41 static std::string Extension(std::string_view name);
42
43 private:
44 IconID Read(const std::string& key, bool isFolder, bool open);
45
46 ITextSystem& m_textSystem;
47 [[maybe_unused]] uint32_t m_pixels;
48 std::unordered_map<std::string, IconID> m_icons;
49 };
50
51#ifdef _WIN32
52 namespace detail
53 {
56 bool IconPixels(void* icon, uint32_t& width, uint32_t& height, std::vector<uint8_t>& rgba);
57 }
58#endif
59
61}
FileIcons(const FileIcons &)=delete
static std::string Extension(std::string_view name)
The extension Get goes by: from the last '.
FileIcons & operator=(const FileIcons &)=delete
IconID Get(std::string_view name, bool isFolder)
IconID OpenFolder()
A folder's icon while it's open, or while something is dragged over it.
~FileIcons()
Lets go of the icons it registered (ITextSystem::UnregisterIcon); another cache's registrations of th...
FileIcons(ITextSystem &textSystem, uint32_t pixels=48)
Text and icon registration, measurement, rendering and editing.
Definition gui_text_system.h:189
IconID
Handle for an icon registered with ITextSystem::RegisterIconFromSVG / RegisterIconFromSVGFile.
Definition gui_style_text.h:15
Definition gui_logging.h:24