Hs::HsWidget Class Reference

class Hs::HsWidget

Class defining a Homescreen Widget. A widget is identified by its templateName, widgetName, uniqueIdentifier.

 @code
 class ObserverClass : public IHsDataObserver
 {
      void handleEvent( std::string aWidgetName, 
			IHsDataObserver::EEvent aEvent)
      {
      }
 
      void handleItemEvent( std::string aWidgetName,
        	std::string aWidgetItemName,
       	IHsDataObserver::EItemEvent aEvent)
      {
      }
 }
 
 ObserverClass* dataObserver = new ObserverClass();
 HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver );
 HsWidget& widget =  hsPublisher->createHsWidget( 
     "templateName", "widgetName", "uniqueIdentifier" );
 hsPublisher->publishHsWidget( widget ); 

Constructor & Destructor Documentation

HsWidget(std::string &, std::string &, std::string &, std::string &, std::string &)

HsWidget(std::string &aTemplateName,
std::string &aWidgetName,
std::string &aIdentifier,
std::string &aDescription,
std::string &aIconLocation
)

Parameters

std::string & aTemplateName
std::string & aWidgetName
std::string & aIdentifier
std::string & aDescription
std::string & aIconLocation

~HsWidget()

~HsWidget()[virtual]

Member Functions Documentation

checkIfWidgetItemExist(std::string &)

boolcheckIfWidgetItemExist(std::string &aItemName)

Parameters

std::string & aItemName

getDescription()

const std::string &getDescription()const

getIconLocation()

const std::string &getIconLocation()const

getIdentifier()

const std::string &getIdentifier()

getTemplateName()

const std::string &getTemplateName()

getWidgetItem(std::string &)

HsWidgetItem *getWidgetItem(std::string &aItemName)

Parameters

std::string & aItemName

getWidgetItem(int)

HsWidgetItem *getWidgetItem(intaIndex)

Parameters

int aIndex

getWidgetName()

const std::string &getWidgetName()

itemsCount()

intitemsCount()

removeItem(std::string)

IMPORT_C voidremoveItem(std::stringaItemName)

Method removes widget's item. An attempt to remove not existing item causes exception with KErrNotFound reason;

 HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver );
 HsWidget& widget =  hsPublisher->createHsWidget( 
     "templateName", "widgetName", "uniqueIdentifier" );
 widget.setItem( "myItem", "value" );
 widget.removeItem( "myItem" );
 hsPublisher->removeHsWidget(
     "templateName", "widgetName", "uniqueIdentifier" );
Exceptions
HsException

Parameters

std::string aItemNameName of the Item.

setItem(std::string, std::string)

IMPORT_C voidsetItem(std::stringaItemName,
std::stringaValue
)

Adds a new widget item to the widget if it wasn't created previously or set a new value to the existing one. Widget item is identified by the name with the value provided. The value is a string.

 HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver );
 HsWidget& widget =  hsPublisher->createHsWidget( 
     "templateName", "widgetName", "uniqueIdentifier" );
 // assuming count and values[] are defined
 while ( count )
 {
    widget->setItem("image", values[count] );
    count--;
 }
Exceptions
HsException

Parameters

std::string aItemName
std::string aValueInteger value of the widget item.

setItem(std::string, int)

IMPORT_C voidsetItem(std::stringaItemName,
intaValue
)

Adds a new widget item to the widget if it wasn't created previously or set a new value to the existing one. Widget item is identified by the name with the value provided. The value is a int.

 HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver );
 HsWidget& widget =  hsPublisher->createHsWidget( 
     "templateName", "widgetName", "uniqueIdentifier" );
 // assuming count and values[] are defined
 while ( count )
 {
    widget->setItem("image", values[count] );
    count--;
 }
Exceptions
HsException

Parameters

std::string aItemName
int aValueInteger value of the widget item.

Member Data Documentation

std::string mDescription

std::string mDescription[private]

std::string mIconLocation

std::string mIconLocation[private]

std::string mIdentifier

std::string mIdentifier[private]

std::vector< HsWidgetItem * > mItems

std::vector< HsWidgetItem * >mItems[private]

std::string mTemplateName

std::string mTemplateName[private]

std::string mWidgetName

std::string mWidgetName[private]