idlehomescreen/inc/xnlistquerydialogadapter.h
changeset 0 f72a12da539e
child 15 ff572dfe6d86
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2009 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:  List query dialog adapter and data interface
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __XNLISTQUERYDIALOGADAPTER_H__
       
    19 #define __XNLISTQUERYDIALOGADAPTER_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include "xncontroladapter.h"
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "xncomponent.h"
       
    26 #include "xnnode.h"
       
    27 #include "mxncomponentinterface.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CXnNodePluginIf;
       
    31 class CXnUiEngine;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 namespace XnListQueryDialogInterface
       
    36 {
       
    37 _LIT8(KType, "listquerydialog");
       
    38 class MXnListQueryDialogInterface : public XnComponentInterface::MXnComponentInterface
       
    39    {
       
    40 
       
    41 public:
       
    42         
       
    43     static inline const TDesC8& Type()
       
    44         {
       
    45         return KType;
       
    46         }
       
    47         
       
    48 public: // New functions
       
    49 
       
    50     /**
       
    51      * Replaces or appends new item into list
       
    52      * @param aText The new text line
       
    53      * @param aIndex index
       
    54      */
       
    55     virtual void ReplaceItemL(const TDesC& aText, TInt aIndex ) = 0;
       
    56     
       
    57     /**
       
    58      * Inserts or appends new item into list
       
    59      * @param aText The new text line
       
    60      * @param aIndex index
       
    61      */
       
    62     virtual void InsertItemL(const TDesC& aText, TInt aIndex ) = 0;
       
    63     
       
    64     /**
       
    65      * Deletes the item from the given index
       
    66      * @param aIndex list index
       
    67      */
       
    68     virtual void DeleteItem( TInt aIndex ) = 0;
       
    69    };
       
    70  }   
       
    71 
       
    72 /**
       
    73  *  List query dialog data interface 
       
    74  *  @ingroup group_xnlayoutengine
       
    75  *  @lib xnlayoutengine.lib
       
    76  *  @since 9.2
       
    77  */
       
    78 class CXnListQueryDialog : public CXnComponent, public XnListQueryDialogInterface::MXnListQueryDialogInterface
       
    79    {
       
    80 
       
    81 public:
       
    82 
       
    83 
       
    84     /**
       
    85      * 2 phase construction.
       
    86      */
       
    87     static CXnListQueryDialog* NewL();
       
    88 
       
    89 
       
    90     /**
       
    91      * Destructor.
       
    92      */
       
    93     virtual ~CXnListQueryDialog();
       
    94 
       
    95 public: // From MXnListQueryDialogInterface
       
    96 
       
    97     /**
       
    98      * Replaces or appends new item into list
       
    99      * @param aText The new text line
       
   100      * @param aIndex index
       
   101      */
       
   102     void ReplaceItemL(const TDesC& aText, TInt aIndex );
       
   103 
       
   104     /**
       
   105      * Inserts or appends new item into list
       
   106      * @param aText The new text line
       
   107      * @param aIndex index
       
   108      */
       
   109     void InsertItemL(const TDesC& aText, TInt aIndex );
       
   110     
       
   111     /**
       
   112      * Deletes the item from the given index
       
   113      * @param aIndex list index
       
   114      */
       
   115     void DeleteItem( TInt aIndex );
       
   116     
       
   117 
       
   118 public: // from MXnComponentInterface
       
   119 
       
   120     /**
       
   121       * Create a component interface according to the given type.
       
   122       * @param aType Type of the interface to create
       
   123       * @return Created interface or NULL if the provided type is not supported.
       
   124       */ 
       
   125     XnComponentInterface::MXnComponentInterface* MakeInterfaceL(const TDesC8& aType);
       
   126     
       
   127 private:
       
   128 
       
   129     CXnListQueryDialog();
       
   130     void ConstructL();
       
   131 
       
   132    };
       
   133 
       
   134 // CLASS DECLARATION
       
   135 
       
   136 /**
       
   137 *  @ingroup group_xnlayoutengine
       
   138 *  List query dialog adapter interface class
       
   139 *  @lib xnlayoutengine.lib
       
   140 *  @since Series 60 5.0
       
   141 */
       
   142 NONSHARABLE_CLASS( CXnListQueryDialogAdapter ) : public CXnControlAdapter
       
   143 	{
       
   144 	public: // Constructors and destructor
       
   145 		/**
       
   146         * Two-phased constructor.
       
   147         */
       
   148 		static CXnListQueryDialogAdapter* NewL( CXnNodePluginIf& aNode );
       
   149 		
       
   150         /**
       
   151         * Destructor.
       
   152         */
       
   153 		~CXnListQueryDialogAdapter();
       
   154 		
       
   155 		/**
       
   156          * Replaces or appends new item into list
       
   157          * @param aText The new text line
       
   158          * @param aIndex index
       
   159          */
       
   160 	    void ReplaceItemL(const TDesC& aText, TInt aIndex );
       
   161 	    
       
   162 	    /**
       
   163          * Inserts or appends new item into list
       
   164          * @param aText The new text line
       
   165          * @param aIndex index
       
   166          */
       
   167 	    void InsertItemL(const TDesC& aText, TInt aIndex );
       
   168 	    
       
   169 	    /**
       
   170          * Deletes the item from the given index
       
   171          * @param aIndex list index
       
   172          */
       
   173 	    void DeleteItem( TInt aIndex );
       
   174 	    
       
   175 	    /**
       
   176 	     * Displays the dialog
       
   177 	     */
       
   178 		void TryDisplayingDialogL();      
       
   179 
       
   180     private: // Constructors
       
   181 		/**
       
   182         * C++ default constructor.
       
   183         */
       
   184         CXnListQueryDialogAdapter( CXnNodePluginIf& aNode );
       
   185 
       
   186 	   	/**
       
   187         * Two-phased constructor.        
       
   188         */ 
       
   189 	    void ConstructL();	   
       
   190 	    
       
   191     private: // New functions
       
   192         /**
       
   193         * Sets the selected item active, which runs associated event.
       
   194         */ 
       
   195         void ActivateItemL( TInt aIndex );
       
   196         
       
   197         /**
       
   198         * Inserts the index into event.
       
   199         */ 
       
   200         void ModifyDynamicEventL( TInt aIndex );
       
   201             
       
   202     private:    // Data	
       
   203         // Node 
       
   204         CXnNodePluginIf& iNode;
       
   205         /**
       
   206          * List items
       
   207          * own
       
   208          */
       
   209         CDesCArrayFlat* iItemArray;
       
   210         
       
   211         /**
       
   212          * Array of static item nodes
       
   213          * Not own
       
   214          */
       
   215         RPointerArray< CXnNodePluginIf > iStaticItems;
       
   216         
       
   217         /**
       
   218          * Dynamic item node
       
   219          * Not own
       
   220          */
       
   221         CXnNodePluginIf* iDynamicItem;
       
   222         
       
   223 	};
       
   224 
       
   225 #endif // __XNLISTQUERYDIALOGADAPTER_H__
       
   226 
       
   227 // End of File