Hs::HsWidget Class Reference

Link against: hswidgetpublisher.lib


#include <
hswidget.h>

Detailed Description

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

Public Member Functions

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.
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.
IMPORT_C void removeItem (std::string aItemName)
 Method removes widget's item.
 HsWidget (std::string &aTemplateName, std::string &aWidgetName, std::string &aIdentifier)
virtual ~HsWidget ()
HsWidgetItem * getWidgetItem (std::string &aItemName)
const std::string & getWidgetName ()
const std::string & getTemplateName ()
const std::string & getIdentifier ()
int itemsCount ()
HsWidgetItem * getWidgetItem (int aIndex)
bool checkIfWidgetItemExist (std::string &aItemName)

Constructor & Destructor Documentation

Hs::HsWidget::HsWidget std::string &  aTemplateName,
std::string &  aWidgetName,
std::string &  aIdentifier
 
virtual Hs::HsWidget::~HsWidget  )  [virtual]
 

Member Function Documentation

bool Hs::HsWidget::checkIfWidgetItemExist std::string &  aItemName  ) 
 
const std::string& Hs::HsWidget::getIdentifier  ) 
 
const std::string& Hs::HsWidget::getTemplateName  ) 
 
HsWidgetItem* Hs::HsWidget::getWidgetItem int  aIndex  ) 
 
HsWidgetItem* Hs::HsWidget::getWidgetItem std::string &  aItemName  ) 
 
const std::string& Hs::HsWidget::getWidgetName  ) 
 
int Hs::HsWidget::itemsCount  ) 
 
IMPORT_C void Hs::HsWidget::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" );
Parameters:
aItemName Name of the Item.
aWidgetName Name of the Widget
aIdentifier Unique identification of the content.
Exceptions:
HsException 
IMPORT_C void Hs::HsWidget::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--;
 }
Parameters:
aItemName,Name of the widget item.
aValue Integer value of the widget item.
Exceptions:
HsException 
IMPORT_C void Hs::HsWidget::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--;
 }
Parameters:
aItemName,Name of the widget item.
aValue Integer value of the widget item.
Exceptions:
HsException 

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

Copyright © Nokia Corporation 2001-2007
Back to top