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 &)

bool checkIfWidgetItemExist ( 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 ( int aIndex )

Parameters

int aIndex

getWidgetName()

const std::string & getWidgetName ( )

itemsCount()

int itemsCount ( )

removeItem(std::string)

IMPORT_C void removeItem ( std::string aItemName )

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 aItemName Name of the Item.

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

IMPORT_C void setItem ( std::string aItemName,
std::string aValue
)

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 aValue Integer value of the widget item.

setItem(std::string, int)

IMPORT_C void setItem ( std::string aItemName,
int aValue
)

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 aValue Integer 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]