Wt  4.13.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Wt::WFavicon Class Referenceabstract

An abstract class representing a favicon. More...

#include <Wt/WFavicon.h>

Inheritance diagram for Wt::WFavicon:
[legend]

Public Member Functions

virtual std::string url () const =0
 Returns the url to the favicon.
 
void update ()
 Sets the favicon in its update state.
 
void reset ()
 Sets the favicon in its default state.
 
bool isUpdated () const
 Returns whether the favicon is in its update state or not.
 

Protected Member Functions

virtual void doUpdate ()
 Updates the favicon.
 
virtual void doReset ()
 Resets the favicon.
 

Detailed Description

An abstract class representing a favicon.

The favicon of a page is an icon that is used by the browser to represent the page in its user interface. In modern browsers, this is usualy showed on the browser tab of the page.

Changing the favicon of a page can be used to notify the user that something happend on the page without the having to use notifications, which can feel invasive and requires the user's approval to be used. This class is designed with this idea in mind.

A WFavicon can be in 2 states:

  1. Updated: used to notify the user
  2. Default: used otherwise

The state of the WFavicon can be changed using update() and reset().

See also
WApplication::setFavicon()

Member Function Documentation

◆ doReset()

void Wt::WFavicon::doReset ( )
protectedvirtual

Resets the favicon.

This is called at the end of reset() and should be overriden to make it clean up what was done in doUpdate().

Note
If you want those changes to be pushed to the client, you have to make sure that this updates the url of the favicon.
See also
doUpdate(), reset(), url()

Reimplemented in Wt::WRasterFavicon.

◆ doUpdate()

void Wt::WFavicon::doUpdate ( )
protectedvirtual

Updates the favicon.

This is called at the end of update() and does nothing by default. You can override this function to make changes to the favicon when update() is called.

If you do so, you will likely want to clean up those changes in doReset().

Note
If you want those changes to be pushed to the client, you have to make sure that this updates the url of the favicon.
See also
doReset(), update(), url()

Reimplemented in Wt::WRasterFavicon.

◆ isUpdated()

bool Wt::WFavicon::isUpdated ( ) const

Returns whether the favicon is in its update state or not.

See also
update(), reset()

◆ reset()

void Wt::WFavicon::reset ( )

Sets the favicon in its default state.

Sets the favicon in its default state.

If you did any changes in doUpdate(), you should clean up those changes in doReset(), which is called at the end of this function.

Note
This does not push any updates to the browser unless it changes the url of the favicon.
See also
update(), url()

◆ update()

void Wt::WFavicon::update ( )

Sets the favicon in its update state.

This sets the favicon in its update state.

If you want the favicon to be different in its updated state, you should override doUpdate(), which is called at the end of this function.

Note
Despite its name, this does not push any updates to the browser unless it changes the url of the favicon.
See also
reset(), url()

◆ url()

virtual std::string Wt::WFavicon::url ( ) const
pure virtual

Returns the url to the favicon.

This should return the absolute url to the favicon.

Implemented in Wt::WFaviconPair, Wt::WRasterFavicon, Wt::WResourceFavicon, and Wt::WUrlFavicon.