inc/alf/alfrecyclinggridelement.h
branchRCL_3
changeset 26 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     1 /*
       
     2 * Copyright (c) 2007 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:  The implementation for presentation elements.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALF_RECYCLINGGRIDELEMENT_H
       
    20 #define ALF_RECYCLINGGRIDELEMENT_H
       
    21 
       
    22 
       
    23 //INCLUDES
       
    24 #include <e32cmn.h> // TPoint
       
    25 #include <osn/osndefines.h>
       
    26 #include "alf/alfelement.h"
       
    27 #include <alf/ialfwidgeteventhandler.h>
       
    28 
       
    29 class CAlfControl;
       
    30 
       
    31 
       
    32 namespace Alf
       
    33     {
       
    34 class CAlfWidgetControl;
       
    35 class AlfRecyclingGridElementImpl;
       
    36 
       
    37 namespace alfrecyclinggridelement
       
    38     {
       
    39 static const IfId Ident=
       
    40     {
       
    41     0,"alfrecyclinggridelement"
       
    42     };
       
    43     }
       
    44 
       
    45 /** @class AlfRecyclingGridElement alfrecyclinggridelement.h "alf/alfrecyclinggridelement.h"
       
    46  * The implementation of a generic element with a functionality
       
    47  * for recyclign the created visual trees. This is commonly used
       
    48  * in scrolling list-like components, where only few of the items
       
    49  * are visible at the same time. Scrolling is supported in both
       
    50  * dimensions (rows / columns).
       
    51  *
       
    52  *  @interfaces IAlfElement
       
    53  *  @lib alfwidgetmodel.lib
       
    54  *  @since S60 ?S60_version
       
    55  *  @status Draft
       
    56  */
       
    57 class AlfRecyclingGridElement : public AlfElement, public IAlfWidgetEventHandler
       
    58     {
       
    59 public:
       
    60     static inline const IfId& type()
       
    61         {
       
    62         return alfrecyclinggridelement::Ident;
       
    63         }
       
    64     /**
       
    65      * Enumerations of the Fill Style
       
    66      */
       
    67     OSN_IMPORT enum FillStyle{EColumnsFirst, ERowsFirst};
       
    68 
       
    69 
       
    70 
       
    71     /**
       
    72      * Constructor.
       
    73 	 * @exception std::bad_alloc     
       
    74      * @param aControl - Widget Control
       
    75      * @param aName    - Name of the Recycling grid element
       
    76      * @param aNumColumns - Number of Columns
       
    77      * @param aNumRows  - Number of Rows
       
    78      * @since S60 ?S60_version
       
    79      * @return New object. The widgets are owned by Alfred. The objects is pushed on to the cleanup stack
       
    80      */
       
    81     OSN_IMPORT AlfRecyclingGridElement(CAlfWidgetControl& aControl, const char* aName, int aNumColumns, int aNumRows);
       
    82 
       
    83 
       
    84     /** Class Destructor estructor.
       
    85     *
       
    86     *  @since S60 ?S60_version
       
    87     */
       
    88     OSN_IMPORT virtual ~AlfRecyclingGridElement();
       
    89 
       
    90     /**
       
    91      * Constructor.
       
    92      * @param aFillStyle - style to be used to fill the grid
       
    93      * @param aFillStyleParam -
       
    94      * @since S60 ?S60_version
       
    95      * @return New object. The widgets are owned by Alfred. The objects is pushed on to the cleanup stack
       
    96      */
       
    97     OSN_IMPORT void setFillStyle(FillStyle aFillStyle, int aFillStyleParam);
       
    98     /*
       
    99      * Sets the animation times for diferent visual changes
       
   100      * @param aScrollingTime - animation time while scrolling
       
   101      * @param aFadeInTime - amination time for fading in 
       
   102      * @param aFadeinDelay - a delay time after which fade in starts
       
   103      * @param aFadeOutTime - animation time for fading out
       
   104      * @param aFadeOutDelay - a delay time after which fade out will start
       
   105      */ 
       
   106 
       
   107     OSN_IMPORT void setAnimationTimes( int aScrollingTime,
       
   108                                        int aFadeInTime, int aFadeInDelay,
       
   109                                        int aFadeOutTime, int aFadeOutDelay );
       
   110 
       
   111     /**
       
   112      * Creates a visual tree with the data given for visuals.
       
   113      *
       
   114      * @exception std::bad_alloc 
       
   115      * @exception osncore::AlfVisualException Thrown with the error code osncore::ECanNotCreateVisual\n 
       
   116      *                                        when creation of visual fails.
       
   117      * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n 
       
   118      *                                        when wrond data id is supplied.
       
   119      * @exception std::bad_alloc     
       
   120      * @since S60 ?S60_version
       
   121      * @param aData Data for visual tree to be created
       
   122      * @param aDataID Parent visual tree's data id
       
   123      * @param aParentLayout Parent layout to which newly created visual tree will be added
       
   124      * @param aLayoutIndex Position in parent layout at which new visual tree will be added
       
   125      */
       
   126 
       
   127     OSN_IMPORT virtual CAlfVisual* createVisualTree(
       
   128         IAlfVariantType& aData, uint aDataID,
       
   129         CAlfLayout* aParentLayout, int aLayoutIndex );
       
   130 
       
   131     //Implementation of IAlfWidgetEventHandler
       
   132 
       
   133     /**
       
   134      * Used to identify event handlers that are capable of handling
       
   135      * a specified key or custom event. Pointer event handlers cannot be
       
   136      * identified directly, since they are dependent on the presentation.
       
   137      * Therefore, pointer event handlers should be associated with
       
   138      * a custom event ID that can be used to simulate the actual pointer event.
       
   139      *
       
   140      * @since S60 ?S60_version
       
   141      * @param aEvent The event.
       
   142      * @return <code>ETrue</code> if the event can be processed. Otherwise <code>EFalse</code>.
       
   143      */
       
   144     OSN_IMPORT virtual bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const;
       
   145 
       
   146     /**
       
   147      * Called when an input event is being offered to this event handler.
       
   148      * The return value is used to indicate if the event was processed.
       
   149      * Processed events may not be offered to other event handlers.
       
   150      *
       
   151      * @since S60 ?S60_version
       
   152      * @param aControl The parent control of this event handler.
       
   153      * @param aEvent The event.
       
   154      * @return Result of event processing. See AlfEventStatus.
       
   155      */
       
   156    OSN_IMPORT AlfEventStatus offerEvent( CAlfWidgetControl& aControl,const TAlfEvent& aEvent );
       
   157    
       
   158     /**
       
   159      * @see MAlfWidgetEventHandler
       
   160      */
       
   161     OSN_IMPORT void setActiveStates( unsigned int aStates );
       
   162     
       
   163     /**
       
   164      * Sets AlfWidgetEventHandlerInitData to event handler.
       
   165      *
       
   166      * @param aData A data structure which contains for example id of the event
       
   167      * handler.
       
   168      */
       
   169     OSN_IMPORT void setEventHandlerData( const AlfWidgetEventHandlerInitData& aData );
       
   170     
       
   171     /**
       
   172      * Returns AlfWidgetEventHandlerInitData.
       
   173      *
       
   174      * @return  A pointer to AlfWidgetEventHandlerInitData structure which contains
       
   175      * for example id of the event handler.
       
   176      */
       
   177     OSN_IMPORT AlfWidgetEventHandlerInitData* eventHandlerData();
       
   178 
       
   179     /**
       
   180      * Returns the type of EventHandler. 
       
   181      * @see IAlfWidgetEventHandler::AlfEventHandlerType
       
   182      *
       
   183      * @return The type of event handler.
       
   184      */
       
   185     IAlfWidgetEventHandler::AlfEventHandlerType eventHandlerType();
       
   186 
       
   187     /**
       
   188      * Returns information about the phase in the event handling cycle in
       
   189      * which the event hadler will be executed.
       
   190      * @see IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase
       
   191      *
       
   192      * @return Event handler execution phase.
       
   193      */
       
   194     IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase eventExecutionPhase();
       
   195 
       
   196     /**
       
   197      * From @see MAlfInterfaceBase.
       
   198      * @since S60 ?S60_version
       
   199      * @param aType The type of interface requested.
       
   200     * @return Returns the new Interface
       
   201      */
       
   202     OSN_IMPORT virtual  IAlfInterfaceBase* makeInterface( const IfId& aType );
       
   203 
       
   204 
       
   205     /**
       
   206      * Creates a visual tree with the data given for visuals.
       
   207      *
       
   208      * @exception std::bad_alloc 
       
   209      * @exception osncore::AlfVisualException Thrown with the error code osncore::ECanNotCreateVisual\n 
       
   210      *                                        when creation of visual fails.
       
   211      * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidElement\n 
       
   212      *                                        when wrond data id is supplied.
       
   213      * @exception std::bad_alloc     
       
   214      * @since S60 ?S60_version
       
   215      * @param aData Data for visual tree to be created
       
   216      * @param aDataID Parent visual tree's data id
       
   217      * @param aParentLayout Parent layout to which newly created visual tree will be added
       
   218      * @param aLayoutIndex Position in parent layout at which new visual tree will be added
       
   219      */
       
   220     OSN_IMPORT virtual void createChildVisualTree( IAlfElement* aElement,
       
   221             IAlfVariantType& aChildData,
       
   222             IAlfBranch& aData,
       
   223             int aIndex, uint aDataID );
       
   224     /**
       
   225      * Removes visual tree from given element.
       
   226      *
       
   227      * @since S60 ?S60_version
       
   228      * @param aElement Element from which visual tree is to be removed
       
   229      * @param aData
       
   230      * @param aIndex 
       
   231      * @param aDataID 
       
   232      */
       
   233     OSN_IMPORT virtual void removeChildVisualTree( IAlfElement* aElement, IAlfBranch& aData, int aIndex, uint aDataID );
       
   234 
       
   235     /**
       
   236      * removes and destroys all the visuals.
       
   237      *
       
   238      * @param aTimeMilliseconds animation time for remove.
       
   239      */
       
   240     OSN_IMPORT void removeAndDestroyVisuals( int aTimeMilliseconds );
       
   241 
       
   242 private:
       
   243     friend class AlfRecyclingGridElementImpl;
       
   244     auto_ptr<AlfRecyclingGridElementImpl> mImpl;
       
   245     };
       
   246 
       
   247     } // namespace
       
   248 
       
   249 #endif // ALF_RECYCLINGGRIDELEMENT_H