TGUI  1.0-rc2
Loading...
Searching...
No Matches
FileDialogIconLoader.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2023 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
53
63 TGUI_NODISCARD static std::shared_ptr<FileDialogIconLoader> createInstance();
64
65
71 TGUI_NODISCARD virtual bool update();
72
73
79 TGUI_NODISCARD virtual bool supportsSystemIcons() const;
80
81
89 TGUI_NODISCARD virtual bool hasGenericIcons() const;
90
91
99 TGUI_NODISCARD virtual Texture getGenericFileIcon(const Filesystem::FileInfo& file);
100
101
110 virtual void requestFileIcons(const std::vector<Filesystem::FileInfo>& files);
111
112
118 TGUI_NODISCARD virtual std::vector<Texture> retrieveFileIcons();
119
120
122 protected:
123
128 };
129}
130
132
133#endif // TGUI_FILE_DIALOG_ICON_LOADER_HPP
Definition FileDialogIconLoader.hpp:45
virtual TGUI_NODISCARD bool supportsSystemIcons() const
Returns whether this icon loader does something or whether its functions are no-ops.
virtual TGUI_NODISCARD bool hasGenericIcons() const
Returns whether generic icons (one folder and one file icon) are available.
virtual TGUI_NODISCARD std::vector< Texture > retrieveFileIcons()
Access the file icons that where loaded in the thread that was started in requestFileIcons()
virtual void requestFileIcons(const std::vector< Filesystem::FileInfo > &files)
Starts a thread to load the icons for all given files.
virtual TGUI_NODISCARD Texture getGenericFileIcon(const Filesystem::FileInfo &file)
Returns the generic file/folder icon, which is used until the file-specific icons are finished loadin...
virtual ~FileDialogIconLoader()=default
Default virtual destructor.
static TGUI_NODISCARD std::shared_ptr< FileDialogIconLoader > createInstance()
Returns the shared instance to the loader (and creates it if it didn't exist yet).
FileDialogIconLoader()=default
Protected constructor, the createInstance() function should be used to construct the icon loader.
virtual TGUI_NODISCARD bool update()
Called every frame to check if the background thread has finished.
Texture wrapper that internally reuses resources when multiple Texture objects are loaded from the sa...
Definition Texture.hpp:58
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39
Information about a file or directory, used to return data from the listFilesInDirectory function.
Definition Filesystem.hpp:263