TGUI  0.10-dev

Public Member Functions

virtual ~FileDialogIconLoader ()=default
 Default virtual destructor.
 
virtual bool update ()
 Called every frame to check if the background thread has finished. More...
 
virtual bool supportsSystemIcons () const
 Returns whether this icon loader does something or whether its functions are no-ops. More...
 
virtual bool hasGenericIcons () const
 Returns whether generic icons (one folder and one file icon) are available. More...
 
virtual Texture getGenericFileIcon (const Filesystem::FileInfo &file)
 Returns the generic file/folder icon, which is used until the file-specific icons are finished loading. More...
 
virtual void requestFileIcons (const std::vector< Filesystem::FileInfo > &files)
 Starts a thread to load the icons for all given files. More...
 
virtual std::vector< TextureretrieveFileIcons ()
 Access the file icons that where loaded in the thread that was started in requestFileIcons() More...
 

Static Public Member Functions

static std::shared_ptr< FileDialogIconLoadercreateInstance ()
 Returns the shared instance to the loader (and creates it if it didn't exist yet). More...
 

Protected Member Functions

 FileDialogIconLoader ()=default
 Protected constructor, the createInstance() function should be used to construct the icon loader.
 

Member Function Documentation

◆ createInstance()

static std::shared_ptr< FileDialogIconLoader > tgui::FileDialogIconLoader::createInstance ( )
static

Returns the shared instance to the loader (and creates it if it didn't exist yet).

Returns
Shared icon loader instance

The caller of this function should call incrementReferenceCount() directly after the first call to this function and call decrementReferenceCount() when it no longer needs the icon loader. The caller can call this function multiple times inbetween the incrementReferenceCount and decrementReferenceCount calls.

◆ getGenericFileIcon()

virtual Texture tgui::FileDialogIconLoader::getGenericFileIcon ( const Filesystem::FileInfo file)
virtual

Returns the generic file/folder icon, which is used until the file-specific icons are finished loading.

Parameters
fileInformation about the file, used to check if a folder or file icon needs to be returned
Returns
File or folder icon

◆ hasGenericIcons()

virtual bool tgui::FileDialogIconLoader::hasGenericIcons ( ) const
virtual

Returns whether generic icons (one folder and one file icon) are available.

Returns true when a folder and file icon can be returned

Generic icons can be shows while waiting for the per-file icons to finish loading

◆ requestFileIcons()

virtual void tgui::FileDialogIconLoader::requestFileIcons ( const std::vector< Filesystem::FileInfo > &  files)
virtual

Starts a thread to load the icons for all given files.

Parameters
filesList of files for which icons should be loaded

If the thread was still running then it will be cancelled. Once the thread finished, the update() function will return true and retrieveFileIcons() should be called.

◆ retrieveFileIcons()

virtual std::vector< Texture > tgui::FileDialogIconLoader::retrieveFileIcons ( )
virtual

Access the file icons that where loaded in the thread that was started in requestFileIcons()

Returns
Loaded icons for all files passed to requestFileIcons

◆ supportsSystemIcons()

virtual bool tgui::FileDialogIconLoader::supportsSystemIcons ( ) const
virtual

Returns whether this icon loader does something or whether its functions are no-ops.

Returns
True if the platform supports loading icons

◆ update()

virtual bool tgui::FileDialogIconLoader::update ( )
virtual

Called every frame to check if the background thread has finished.

Returns
Whether icons are available and retrieveFileIcons can be called

The documentation for this class was generated from the following file: