TGUI  0.9.1
FileDialogIconLoader.hpp
1 //
3 // TGUI - Texus' Graphical User Interface
4 // Copyright (C) 2012-2021 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 #include <memory>
31 #include <vector>
32 
34 
35 namespace tgui
36 {
41  class TGUI_API FileDialogIconLoader
42  {
43  public:
44 
48  virtual ~FileDialogIconLoader() = default;
49 
50 
60  static std::shared_ptr<FileDialogIconLoader> createInstance();
61 
62 
68  virtual bool update();
69 
70 
76  virtual bool supportsSystemIcons() const;
77 
78 
86  virtual bool hasGenericIcons() const;
87 
88 
97 
98 
107  virtual void requestFileIcons(const std::vector<Filesystem::FileInfo>& files);
108 
109 
115  virtual std::vector<Texture> retrieveFileIcons();
116 
117 
119  protected:
120 
124  FileDialogIconLoader() = default;
125  };
126 }
127 
129 
130 #endif // TGUI_FILE_DIALOG_ICON_LOADER_HPP
Definition: FileDialogIconLoader.hpp:42
virtual bool supportsSystemIcons() const
Returns whether this icon loader does something or whether its functions are no-ops.
virtual bool hasGenericIcons() const
Returns whether generic icons (one folder and one file icon) are available.
static std::shared_ptr< FileDialogIconLoader > createInstance()
Returns the shared instance to the loader (and creates it if it didn't exist yet).
virtual void requestFileIcons(const std::vector< Filesystem::FileInfo > &files)
Starts a thread to load the icons for all given files.
virtual std::vector< Texture > retrieveFileIcons()
Access the file icons that where loaded in the thread that was started in requestFileIcons()
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...
Definition: Texture.hpp:48
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:36
Information about a file or directory, used to return data from the listFilesInDirectory function.
Definition: Filesystem.hpp:238