IconProvider Class Referenceabstract

#include <Pt/Forms/Icon.h>

Provides images for Icon objects. More...

Public Member Functions

 IconProvider ()
 Creates an unused provider.
 
virtual ~IconProvider ()
 Detaches remaining icons so they no longer use this provider.
 
virtual bool empty () const =0
 Returns true when no images are registered.
 
virtual void clear ()=0
 Removes all registered images.
 
virtual void addImage (const Gfx::SizeF &size, const Gfx::Image &image)=0
 Registers image at size.
 
virtual void addImage (const Gfx::SizeF &size, const System::Path &path)=0
 Registers a file path at size. More...
 
virtual Gfx::SizeF minimumSize () const =0
 Returns the smallest registered size, or an empty size.
 
virtual Gfx::SizeF maximumSize () const =0
 Returns the largest registered size, or an empty size.
 
virtual const Gfx::ImagegetImage (const Gfx::SizeF &area)=0
 Returns an image for the requested area.
 

Detailed Description

Derive from IconProvider only to provide a custom image source. Ordinary code uses the built-in provider created by a default Icon. A custom provider implements every pure virtual function. Its getImage() function selects and, when needed, loads an image for the requested size.

An Icon constructed with a provider does not own it. Keep the provider alive while an icon uses it. Destroying a provider detaches its remaining icons. Calling Icon::getImage() on a detached icon is invalid.

Member Function Documentation

◆ addImage()

virtual void addImage ( const Gfx::SizeF size,
const System::Path path 
)
pure virtual

The image loads on first use.