TGUI  1.6.1
Loading...
Searching...
No Matches
FileDialogIconLoader.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2024 Bruno Van de Velde (vdv_b@tgui.eu)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef TGUI_FILE_DIALOG_ICON_LOADER_HPP
26#define TGUI_FILE_DIALOG_ICON_LOADER_HPP
27
28#include <TGUI/Texture.hpp>
29#include <TGUI/Filesystem.hpp>
30
31#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
32 #include <memory>
33 #include <vector>
34#endif
35
37
38TGUI_MODULE_EXPORT namespace tgui
39{
44 class TGUI_API FileDialogIconLoader
45 {
46 public:
47
51 virtual ~FileDialogIconLoader() = default;
52
62 TGUI_NODISCARD static std::shared_ptr<FileDialogIconLoader> createInstance();
63
69 TGUI_NODISCARD virtual bool update();
70
76 TGUI_NODISCARD virtual bool supportsSystemIcons() const;
77
85 TGUI_NODISCARD virtual bool hasGenericIcons() const;
86
94 TGUI_NODISCARD virtual Texture getGenericFileIcon(const Filesystem::FileInfo& file);
95
104 virtual void requestFileIcons(const std::vector<Filesystem::FileInfo>& files);
105
111 TGUI_NODISCARD virtual std::vector<Texture> retrieveFileIcons();
112
114 protected:
115
120 };
121}
122
124
125#endif // TGUI_FILE_DIALOG_ICON_LOADER_HPP
Definition FileDialogIconLoader.hpp:45
virtual bool supportsSystemIcons() const
Returns whether this icon loader does something or whether its functions are no-ops.
virtual std::vector< Texture > retrieveFileIcons()
Access the file icons that where loaded in the thread that was started in requestFileIcons()
virtual bool hasGenericIcons() const
Returns whether generic icons (one folder and one file icon) are available.
virtual void requestFileIcons(const std::vector< Filesystem::FileInfo > &files)
Starts a thread to load the icons for all given files.
static std::shared_ptr< FileDialogIconLoader > createInstance()
Returns the shared instance to the loader (and creates it if it didn't exist yet).
virtual ~FileDialogIconLoader()=default
Default virtual destructor.
FileDialogIconLoader()=default
Protected constructor, the createInstance() function should be used to construct the icon loader.
virtual bool update()
Called every frame to check if the background thread has finished.
virtual Texture getGenericFileIcon(const Filesystem::FileInfo &file)
Returns the generic file/folder icon, which is used until the file-specific icons are finished loadin...
Texture wrapper that internally reuses resources when multiple Texture objects are loaded from the sa...
Definition Texture.hpp:57
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
Information about a file or directory, used to return data from the listFilesInDirectory function.
Definition Filesystem.hpp:247