photosgallery/viewframework/dataprovider/inc/glxcommandbindingutility.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:    collect binding handling here
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef _GLXCOMMANDVARIANTTYPE_H_
       
    22 #define _GLXCOMMANDVARIANTTYPE_H_
       
    23 
       
    24 #include <e32base.h>                   // Container Base Class
       
    25 #include <mul/mulvarianttype.h>        // create data for data model
       
    26 
       
    27 //Forward declaration
       
    28 class MGlxBoundCommand;                // Handles user commands
       
    29 
       
    30 namespace Alf
       
    31     {
       
    32     class MulVisualItem;               // Client need to use this class to add data in data model
       
    33     }
       
    34     
       
    35 /**
       
    36  * CommandVariantType
       
    37  */
       
    38 NONSHARABLE_CLASS( CommandVariantType ) :  public Alf::MulVariantType
       
    39     {
       
    40 public:
       
    41 
       
    42 	/**
       
    43 	 * Constructor
       
    44 	 */
       
    45     CommandVariantType( MGlxBoundCommand& aCommand );
       
    46     
       
    47    	/**
       
    48 	 * Command
       
    49 	 * @return MGlxBoundCommand the command binded
       
    50 	 */
       
    51 	MGlxBoundCommand& Command() const;
       
    52 	
       
    53     /**
       
    54      * Destructor
       
    55      */	
       
    56 	~CommandVariantType();
       
    57 	
       
    58 private: 
       
    59 	// From MulVariantType
       
    60     /** Should not be called, but in case of misbehaving model code */
       
    61     int integer() const;
       
    62     
       
    63     TMulType Type() const; 
       
    64     
       
    65     std::auto_ptr< IMulVariantType > Clone();
       
    66 
       
    67 private:
       
    68     MGlxBoundCommand& iCommand;
       
    69     };
       
    70 
       
    71 /**
       
    72  * GlxCommandBindingUtility
       
    73  * collect binding handling here, so that nasty command attribute (tag) name usage remains in one class
       
    74  */
       
    75 NONSHARABLE_CLASS( GlxCommandBindingUtility )
       
    76     {
       
    77 public:
       
    78 
       
    79 	/**
       
    80 	 * SetT
       
    81 	 * set the binding for the visual item
       
    82 	 * @param MulVisualItem the visual item
       
    83 	 * @param aCommand MGlxBoundCommand to set for visual item
       
    84 	 */
       
    85     static void SetT( Alf::MulVisualItem& aItem, MGlxBoundCommand& aCommand );
       
    86     
       
    87    	/**
       
    88 	 * Get
       
    89 	 * Get BoundCommand for a visual item
       
    90 	 * @param MulVisualItem the visual item
       
    91 	 * @return MGlxBoundCommand
       
    92 	 * returns NULL if command value was not added 
       
    93 	 */
       
    94     static MGlxBoundCommand* Get( const Alf::MulVisualItem& aItem );
       
    95     };
       
    96     
       
    97 #endif // _GLXCOMMANDVARIANTTYPE_H_