uiacceltk/hitchcock/Client/src/alfflowlayout.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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:   Flow layout
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "alf/alfflowlayout.h"
       
    21 #include "alf/alfcontrol.h"
       
    22 #include "alf/alfenv.h"
       
    23 #include "alfclient.h"
       
    24 #include "alf/alfconstants.h"
       
    25 #include "alf/alfgencomponent.h"
       
    26 #include "alflogger.h"
       
    27 
       
    28 #include <uiacceltk/HuiUtil.h>
       
    29 
       
    30 // Private structure
       
    31 struct CAlfFlowLayout::TFlowLayoutPrivateData
       
    32     {
       
    33     TInt iMode; // flow mode flags
       
    34     };
       
    35 
       
    36 
       
    37 // ======== LOCAL FUNCTIONS ========
       
    38 
       
    39 
       
    40 // ======== MEMBER FUNCTIONS ========
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // 1st phase constructor
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 EXPORT_C CAlfFlowLayout::CAlfFlowLayout()
       
    47     : CAlfLayout()
       
    48     {
       
    49     }
       
    50 
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // 2nd phase constructor
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C void CAlfFlowLayout::ConstructL(CAlfControl& aOwner)
       
    57     {
       
    58     CAlfLayout::ConstructL(aOwner);
       
    59     
       
    60     iFlowLayoutData = new (ELeave) TFlowLayoutPrivateData;
       
    61     iFlowLayoutData->iMode = 0;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // Destructor
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C CAlfFlowLayout::~CAlfFlowLayout()
       
    69     {
       
    70     delete iFlowLayoutData;
       
    71     iFlowLayoutData = NULL;
       
    72     }
       
    73 
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Creates new anchor layout for the control.
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 EXPORT_C CAlfFlowLayout* CAlfFlowLayout::AddNewL(
       
    80     CAlfControl& aOwnerControl,
       
    81     CAlfLayout* aParentLayout )
       
    82     {
       
    83     CAlfFlowLayout* layout = STATIC_CAST(CAlfFlowLayout*,
       
    84         aOwnerControl.AppendLayoutL(EAlfLayoutTypeFlow, aParentLayout));
       
    85     return layout;
       
    86     }
       
    87 
       
    88 EXPORT_C void CAlfFlowLayout::SetFlowDirection(TFlowDirection aDirection)
       
    89     {
       
    90     TPckgC<TFlowDirection> inBuf(aDirection);
       
    91 
       
    92     TInt err = Comms()->DoCmdNoReply( EAlfFlowLayoutSetFlowDirection, inBuf );
       
    93     
       
    94     if ( err )
       
    95         {
       
    96         __ALFLOGSTRING1( "CAlfFlowLayout::SetFlowDirection panic error %d", err )
       
    97         USER_INVARIANT();
       
    98         }
       
    99     }
       
   100     
       
   101 EXPORT_C void CAlfFlowLayout::SetCentering(TBool aCentering)
       
   102     {
       
   103     TPckgC<TBool> inBuf(aCentering);
       
   104 
       
   105     TInt err = Comms()->DoCmdNoReply( EAlfFlowLayoutSetCentering, inBuf );
       
   106     
       
   107     if ( err )
       
   108         {
       
   109         __ALFLOGSTRING1( "CAlfFlowLayout::SetCentering panic error %d", err )
       
   110         USER_INVARIANT();
       
   111         }
       
   112         
       
   113 	// Update client side data
       
   114     if(aCentering)
       
   115         {
       
   116         iFlowLayoutData->iMode |= EModeCenterPerpendicular;
       
   117         }
       
   118     else
       
   119         {
       
   120         iFlowLayoutData->iMode &= ~EModeCenterPerpendicular;
       
   121         }
       
   122         
       
   123     }
       
   124 
       
   125 EXPORT_C void CAlfFlowLayout::SetMode(TInt aMode)
       
   126     {
       
   127     TPckgC<TInt> inBuf(aMode);
       
   128 
       
   129     TInt err = Comms()->DoCmdNoReply( EAlfFlowLayoutSetMode, inBuf );
       
   130     
       
   131     if ( err )
       
   132         {
       
   133         __ALFLOGSTRING1( "CAlfFlowLayout::SetMode panic error %d", err )
       
   134         USER_INVARIANT();
       
   135         }
       
   136         
       
   137     // Update local copy of data.
       
   138     iFlowLayoutData->iMode = aMode;        
       
   139     }
       
   140     
       
   141 EXPORT_C TInt CAlfFlowLayout::Mode() const
       
   142     {
       
   143     return iFlowLayoutData->iMode;    
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 // Place holder from CAlfVisual
       
   148 // ---------------------------------------------------------------------------
       
   149 //     
       
   150 EXPORT_C void CAlfFlowLayout::RemoveAndDestroyAllD()
       
   151     {
       
   152     CAlfLayout::RemoveAndDestroyAllD();
       
   153     }
       
   154   
       
   155 // ---------------------------------------------------------------------------
       
   156 // Place holder from CAlfVisual
       
   157 // ---------------------------------------------------------------------------
       
   158 //  
       
   159 EXPORT_C void CAlfFlowLayout::UpdateChildrenLayout(TInt aTransitionTime )
       
   160     {
       
   161     CAlfLayout::UpdateChildrenLayout( aTransitionTime );
       
   162     }
       
   163   
       
   164 // ---------------------------------------------------------------------------
       
   165 // Place holder from CAlfVisual
       
   166 // ---------------------------------------------------------------------------
       
   167 //  
       
   168 EXPORT_C CAlfVisual* CAlfFlowLayout::FindTag(const TDesC8& aTag)
       
   169     {
       
   170     return CAlfLayout::FindTag( aTag );
       
   171     }
       
   172 // ---------------------------------------------------------------------------
       
   173 // Place holder from CAlfLayout
       
   174 // ---------------------------------------------------------------------------
       
   175 //  
       
   176 EXPORT_C TAlfXYMetric CAlfFlowLayout::BaseUnit() const
       
   177     {
       
   178     return CAlfLayout::BaseUnit();
       
   179     }
       
   180  
       
   181 // ---------------------------------------------------------------------------
       
   182 // Place holder from CAlfVisual
       
   183 // ---------------------------------------------------------------------------
       
   184 //  
       
   185 EXPORT_C void CAlfFlowLayout::DoRemoveAndDestroyAllD()
       
   186     {
       
   187     CAlfLayout::DoRemoveAndDestroyAllD();
       
   188     }
       
   189     
       
   190 // ---------------------------------------------------------------------------
       
   191 //  future proofing  
       
   192 // ---------------------------------------------------------------------------
       
   193 //  
       
   194 EXPORT_C void CAlfFlowLayout::PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams)
       
   195     {
       
   196     CAlfLayout::PropertyOwnerExtension(aExtensionUid,aExtensionParams);
       
   197     }
       
   198     
       
   199 
       
   200