idlehomescreen/xmluirendering/uiengine/inc/xnplugindata.h
changeset 0 f72a12da539e
child 9 f966699dea19
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Data class to hold widget info
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _XNPLUGINDATA_H
       
    20 #define _XNPLUGINDATA_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 #include <babitflags.h>
       
    25 
       
    26 // Forward declarations
       
    27 class CXnNode;
       
    28 class CXnDomNode;
       
    29 class CXnResource;
       
    30 class CXnControlAdapter;
       
    31 class CXnViewData;
       
    32 class CXnODT;
       
    33 class CXnDataPluginLoader;
       
    34 class CXnViewManager;
       
    35 class CPeriodic;
       
    36 // Constants
       
    37 
       
    38 // Class declaration
       
    39 
       
    40 /**
       
    41  * Holds plugin data in UiEngine
       
    42  * 
       
    43  * @ingroup group_xnlayoutengine
       
    44  * @lib xn3layoutengine.lib
       
    45  * @since S60 5.0
       
    46  */
       
    47 NONSHARABLE_CLASS( CXnPluginData ) : public CBase
       
    48     {
       
    49 public:
       
    50     // Data types
       
    51     enum
       
    52         {
       
    53         EUseEmpty,
       
    54         EIsDispose,
       
    55         EIsOccupied,   
       
    56         EIsEmpty,
       
    57         EIsRemovable,
       
    58         EIsActive,             
       
    59         EIsInitial,
       
    60         EIsDataPluginsReady
       
    61         };
       
    62         
       
    63 public:    
       
    64     // Constructors and destructor
       
    65     
       
    66     /**
       
    67      * Two-phased constructor.
       
    68      * 
       
    69      * @param aParent Parent     
       
    70      */
       
    71     static CXnPluginData* NewL( CXnPluginData& aParent );
       
    72 
       
    73     /**
       
    74      * Two-phased constructor. Leaving on stack
       
    75      * 
       
    76      * @param aParent Parent
       
    77      */
       
    78     static CXnPluginData* NewLC( CXnPluginData& aParent );
       
    79 
       
    80     /**
       
    81      * Destructor
       
    82      */
       
    83     ~CXnPluginData();
       
    84        
       
    85 protected:
       
    86     
       
    87     /**
       
    88      * C++ constructor
       
    89      * 
       
    90      * @param aParent
       
    91      */
       
    92     CXnPluginData( CXnPluginData& aParent );
       
    93 
       
    94     /**
       
    95      * C++ constructor
       
    96      *      
       
    97      * @param aManager 
       
    98      */    
       
    99     CXnPluginData( CXnViewManager& aManager );
       
   100                    
       
   101     /**
       
   102      * C++ constructor
       
   103      */
       
   104     CXnPluginData();
       
   105 
       
   106     /**
       
   107      * Leaving constructor
       
   108      */
       
   109     void ConstructL();
       
   110 
       
   111 public:
       
   112     // New functions
       
   113 
       
   114     /**
       
   115      * Loads content to plugin          
       
   116      */    
       
   117     virtual void LoadL();
       
   118 
       
   119     /**
       
   120      * Destroys content from plugin          
       
   121      */    
       
   122     virtual void Destroy();
       
   123     
       
   124     /**
       
   125      * Sets plugindata node
       
   126      * 
       
   127      * @param aNode Node to be set.
       
   128      */
       
   129     inline void SetNode( CXnDomNode* aNode );
       
   130     
       
   131     /**
       
   132      * Returns plugindata node
       
   133      * 
       
   134      * @return Dom Node
       
   135      */
       
   136     inline CXnDomNode* Node() const;
       
   137 
       
   138     /**
       
   139      * Sets Owner
       
   140      * 
       
   141      * @param Dom node owner
       
   142      */
       
   143     inline void SetOwner( CXnDomNode* aOwner );
       
   144     
       
   145     /**
       
   146      * Returns owner
       
   147      * 
       
   148      * @return Returns the owning dom node
       
   149      */
       
   150     inline CXnDomNode* Owner() const;
       
   151 
       
   152     /**
       
   153      * Returns parent
       
   154      * 
       
   155      * @return ViewData Parent
       
   156      */
       
   157     inline CXnPluginData* Parent() const;
       
   158 
       
   159     /**
       
   160      * Returns View Manager
       
   161      * 
       
   162      * @return View manager
       
   163      */
       
   164     inline CXnViewManager& ViewManager() const;
       
   165     
       
   166     /**
       
   167      * Returns state of the parent - active/ not active
       
   168      * 
       
   169      * @return ETrue - parent active 
       
   170      *         EFalse - parent not active
       
   171      */
       
   172     inline virtual TBool Active() const;
       
   173 
       
   174     /**
       
   175      * Sets new configuration ID
       
   176      * 
       
   177      * @param aConfigurationId Config ID
       
   178      */
       
   179     void SetConfigurationIdL( const TDesC8& aConfigurationId );
       
   180     
       
   181     /**
       
   182      * Returns Config. ID
       
   183      * 
       
   184      * @return Id
       
   185      */
       
   186     inline const TDesC8& ConfigurationId() const;
       
   187     
       
   188     /**
       
   189      * Sets new plugin ID
       
   190      * 
       
   191      * @param aPluginId Plugin ID
       
   192      */
       
   193     void SetPluginIdL( const TDesC8& aPluginId );
       
   194     
       
   195     /**
       
   196      * Returns plugin ID
       
   197      * 
       
   198      * @return Plugin ID
       
   199      */
       
   200     inline const TDesC8& PluginId() const;
       
   201 
       
   202     /**
       
   203      * Sets new plugin UID
       
   204      * 
       
   205      * @param aPluginUid Plugin UID
       
   206      */
       
   207     void SetPluginUidL( const TDesC8& aPluginUid );
       
   208     
       
   209     /**
       
   210      * Returns plugin UID
       
   211      * 
       
   212      * @return Plugin Uid
       
   213      */
       
   214     inline const TDesC8& PluginUid() const;
       
   215 
       
   216     /**
       
   217      * Sets new plugin name
       
   218      * 
       
   219      * @param aPluginName Plugin name
       
   220      */
       
   221     void SetPluginNameL( const TDesC8& aPluginName );
       
   222     
       
   223     /**
       
   224      * Returns plugin name
       
   225      * 
       
   226      * @return Plugin name
       
   227      */
       
   228     inline const TDesC8& PluginName() const;
       
   229     
       
   230     /**
       
   231      * Sets new plugin type
       
   232      * 
       
   233      * @param aPluginType Plugin type
       
   234      */
       
   235     void SetPluginTypeL( const TDesC8& aPluginType );
       
   236     
       
   237     /**
       
   238      * Returns plugin type
       
   239      * 
       
   240      * @return Plugin type
       
   241      */    
       
   242     inline const TDesC8& Type() const;
       
   243 
       
   244     /**
       
   245      * Sets new plugin state
       
   246      * 
       
   247      * @param aConfigurationState Plugin state     
       
   248      */    
       
   249     void SetPluginStateL( const TDesC8& aPluginState );
       
   250 
       
   251     /*
       
   252      * Reverts plugin state back to confirmed from wait for confirmation
       
   253      */
       
   254     void RevertPluginState();
       
   255         
       
   256     /**
       
   257      * Returns plugin state
       
   258      * 
       
   259      * @return Plugin state
       
   260      */    
       
   261     inline const TDesC8& PluginState() const;
       
   262 
       
   263     /**
       
   264 	 * void SetPublisherNameL( const TDesC8& aPublisherName )
       
   265 	 * Sets the name of the publisher
       
   266 	 *
       
   267 	 * @param const TDesC& aPublisherName - Publisher name
       
   268 	 */
       
   269 	void SetPublisherNameL( const TDesC8& aPublisherName );
       
   270         
       
   271     /**
       
   272      * void SetPublisherNameL( const TDesC& aPublisherName )
       
   273      * Sets the name of the publisher
       
   274      *
       
   275      * @param const TDesC& aPublisherName - Publisher name
       
   276      */
       
   277     void SetPublisherNameL( const TDesC& aPublisherName );
       
   278 
       
   279     /**
       
   280      * inline const TDesC16& PublisherName()
       
   281      * Returns the publisher name
       
   282      *
       
   283      * @param
       
   284      * @return - *iPublisherName or KNullDesC16()       
       
   285      */
       
   286     inline const TDesC& PublisherName() const;
       
   287 
       
   288     /**
       
   289      * Sets new resources.     
       
   290      * 
       
   291      * @param aResources resource list
       
   292      */
       
   293     void SetResources( CArrayPtrSeg< CXnResource >* aResources );
       
   294     
       
   295     /**
       
   296      * Adds resources to the list
       
   297      * 
       
   298      * @param aList List are added to
       
   299      */
       
   300     virtual void ResourcesL( CArrayPtrSeg< CXnResource >& aList ) const;
       
   301 
       
   302     /**
       
   303      * Adds control from Node's control
       
   304      * 
       
   305      * @param aNode Node which control should be added
       
   306      */
       
   307     void SetControlL( CXnNode* aNode );
       
   308     
       
   309     /**
       
   310      * Returns list of controls
       
   311      * 
       
   312      * @param aList List where controls are added
       
   313      */
       
   314     virtual void ControlsL( RPointerArray< CXnControlAdapter >& aList ) const;
       
   315 
       
   316     /**
       
   317      * Sets content source
       
   318      * 
       
   319      * @param aNode Node to be added
       
   320      */
       
   321     void SetContentSourceNodeL( CXnNode* aNode );
       
   322     
       
   323     /**
       
   324      * Returns all content source nodes
       
   325      * 
       
   326      * @param aList List where they are returned
       
   327      */
       
   328     virtual void ContentSourceNodesL( RPointerArray< CXnNode >& aList ) const;
       
   329 
       
   330     /**
       
   331      * Adds appearance nodes
       
   332      * 
       
   333      * @param aNode Node to be added
       
   334      */
       
   335     void SetAppearanceNodeL( CXnNode* aNode );
       
   336     
       
   337     /**
       
   338      * Returns list of appearance nodes
       
   339      * 
       
   340      * @param aList List of apperance nodes
       
   341      */
       
   342     virtual void AppearanceNodesL( RPointerArray< CXnNode >& aList ) const;
       
   343 
       
   344     /**
       
   345      * Adds an initial focus node
       
   346      * 
       
   347      * @param aNode Node
       
   348      */
       
   349     void SetInitialFocusNodeL( CXnNode* aNode );
       
   350     
       
   351     /**
       
   352      * Returns list of focus nodes
       
   353      * 
       
   354      * @param aList List of focus nodes
       
   355      */
       
   356     virtual void InitialFocusNodesL( RPointerArray< CXnNode >& aList ) const;
       
   357 
       
   358     /**
       
   359      * Sets the plugin occupied     
       
   360      */
       
   361     inline void SetOccupied();
       
   362     
       
   363     /*
       
   364      * Checks whether occupied
       
   365      * 
       
   366      * @return ETrue when occupied EFalse when not
       
   367      */
       
   368     inline TBool Occupied() const;
       
   369     
       
   370     /*
       
   371      * Sets the plugin removable
       
   372      * 
       
   373      * @param aRemovable ETrue when removable EFalse when not
       
   374      */    
       
   375     inline void SetRemovable( TBool aRemovable );
       
   376     
       
   377     /*
       
   378      * Checks whether removable
       
   379      * 
       
   380      * @return ETrue when removable EFalse when not
       
   381      */    
       
   382     inline TBool Removable() const;
       
   383     
       
   384     /*
       
   385      * Queries whether this plugin is holding "empty" widget
       
   386      * 
       
   387      * @return ETrue if empty, EFalse otherwise     
       
   388      */                
       
   389     TBool Empty() const;
       
   390     
       
   391     /*
       
   392      * Sets this plugin to hold "empty" widget
       
   393      * 
       
   394      * @param aPluginId PluginId for later usage     
       
   395      */            
       
   396     void SetEmptyL( const TDesC8& aPluginId );
       
   397     
       
   398     /**
       
   399      * Flushes plugin data         
       
   400      */
       
   401     void Flush();
       
   402 
       
   403     /**
       
   404      * Sets/Unsets the popup
       
   405      * @param aVisible sets the popup visible or invisible
       
   406      * @param aNode a pointer to the popup node
       
   407      */
       
   408     void SetIsDisplayingPopup ( TBool aVisible, CXnNode* aNode );
       
   409 
       
   410     /**
       
   411      * Checks if the popup is displayed
       
   412      */
       
   413     TBool IsDisplayingPopup () const;
       
   414     
       
   415     
       
   416     /**
       
   417      * Returns list of plugindata
       
   418      * 
       
   419      * @return List of plugindata
       
   420      */
       
   421     inline RPointerArray< CXnPluginData >& PluginData() const;
       
   422 
       
   423     /**
       
   424      * Loads data plugins associated to the plugin data
       
   425      * 
       
   426      */
       
   427     virtual void LoadDataPluginsL();
       
   428 
       
   429     /**
       
   430      * Deletes data plugins associated to the plugin data
       
   431      */
       
   432     virtual void DestroyDataPluginsL();
       
   433     
       
   434     /**
       
   435      * Indicates that all data plugins are loaded by data plugin loader
       
   436      * 
       
   437      * @param aStatus Loading status
       
   438      */
       
   439     virtual void DataPluginsLoadCompletedL( TInt aStatus );
       
   440 
       
   441     /**
       
   442      * Returns data plugin loading status
       
   443      * 
       
   444      * @return ETrue if data plugins are loaded or there is no data
       
   445      *               plugins associated to the plugin.
       
   446      *         EFalse otherwise
       
   447      */
       
   448     virtual TBool DataPluginsLoaded() const;
       
   449 
       
   450 
       
   451 private:
       
   452     // New functions
       
   453     
       
   454     static TInt RunL( TAny* aAny );
       
   455     
       
   456 protected:
       
   457     // data
       
   458         
       
   459     /** Data plugin loader, Owned */
       
   460     CPeriodic* iLoader;
       
   461     /** Data plugin load index */
       
   462     TInt iLoadIndex;  
       
   463     /** Plugins data */
       
   464     mutable RPointerArray< CXnPluginData > iPluginsData;
       
   465     /** List of plugin resources, Owned */
       
   466     CArrayPtrSeg< CXnResource >* iResources;
       
   467     /** List of controls, Not owned */
       
   468     RPointerArray< CXnControlAdapter > iControls;
       
   469     /** List of content source nodes, Not owned */
       
   470     RPointerArray< CXnNode > iContentSourceNodes;       
       
   471     /** List of appearance nodes, Not owned */
       
   472     RPointerArray< CXnNode > iAppearanceNodes;
       
   473     /** List of initial focus nodes, Not owned */
       
   474     RPointerArray< CXnNode > iInitialFocusNodes;   
       
   475     /** List of popup focus nodes, Not owned */
       
   476     RPointerArray< CXnNode > iPopupNodes;
       
   477 
       
   478     /** Parent, Not owned */
       
   479     CXnPluginData* iParent;
       
   480     /** View manager, Not owned */
       
   481     CXnViewManager& iManager;
       
   482     /** This plugin's node, Not owned */
       
   483     CXnDomNode* iNode;
       
   484     /** This plugin's owner, Not owned */
       
   485     CXnDomNode* iOwner;
       
   486     /** config ID, Owned */ 
       
   487     HBufC8* iConfigurationId;
       
   488     /** Plugin ID, Owned */
       
   489     HBufC8* iPluginId;
       
   490     /** Plugin UID, Owned */
       
   491     HBufC8* iPluginUid;
       
   492     /** Plugin name, Owned */
       
   493     HBufC8* iPluginName;    
       
   494     /** Plugin type, Owned */
       
   495     HBufC8* iPluginType;
       
   496     /** Plugin state, Owned */
       
   497     HBufC8* iPluginState;
       
   498     /** Publisher name, Owned */
       
   499     HBufC* iPublisherName;
       
   500     /** Flags to define this plugin's state */
       
   501     TBitFlags32 iFlags;
       
   502     };
       
   503 
       
   504 // Inline functions
       
   505 #include "xnplugindata.inl"
       
   506 
       
   507 #endif // _XNPLUGINDATA_H