mulwidgets/alfviewwidget/src/alfviewcontrol.cpp
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     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 // Local Includes
       
    20 #include "alfviewcontrol.h"
       
    21 #include "alfviewwidget.h"
       
    22 
       
    23 // AlfClient Includes
       
    24 #include <alf/alfevent.h>
       
    25 
       
    26 // Widget Model
       
    27 #include <alf/alfwidgetevents.h>
       
    28 
       
    29 using namespace Alf;
       
    30 
       
    31 CAlfViewControl::CAlfViewControl(CAlfEnv& aEnv, AlfViewWidget& aViewWidget)
       
    32     : CAlfWidgetControl(aEnv), mViewWidget(aViewWidget)
       
    33     {
       
    34     }
       
    35 
       
    36 CAlfViewControl::~CAlfViewControl()
       
    37     {
       
    38     while(mViewWidget.widgetCount())
       
    39 	    {
       
    40 	    mViewWidget.setChildNameToDelete(UString(mViewWidget.getWidget(0)->widgetName()));
       
    41 	    mViewWidget.removeWidget(0);
       
    42 	    }
       
    43     }
       
    44 
       
    45 AlfEventStatus CAlfViewControl::handleEvent(const TAlfEvent& aEvent)
       
    46     {
       
    47     AlfEventStatus ret = CAlfWidgetControl::handleEvent(aEvent);
       
    48     if(ret == EEventNotHandled && aEvent.IsKeyEvent())
       
    49 		{
       
    50 		if(aEvent.KeyEvent().iScanCode == EStdKeyRightArrow ||
       
    51 		   aEvent.KeyEvent().iScanCode == EStdKeyDownArrow )
       
    52 			{
       
    53 			if(aEvent.Code() == EEventKey)
       
    54 				{
       
    55 				TAlfEvent focusNext(EEventFocusNextWidget);
       
    56 				return CAlfWidgetControl::processEvent(focusNext);							
       
    57 				}
       
    58 			}
       
    59 		else if(aEvent.KeyEvent().iScanCode == EStdKeyLeftArrow ||
       
    60 		        aEvent.KeyEvent().iScanCode == EStdKeyUpArrow)
       
    61 			{
       
    62 			if(aEvent.Code() == EEventKey)
       
    63 				{
       
    64 				TAlfEvent focusPrevious(EEventFocusPreviousWidget);
       
    65 				return CAlfWidgetControl::processEvent(focusPrevious);
       
    66 				}
       
    67 			}
       
    68 		}
       
    69 	return ret;
       
    70     }
       
    71 
       
    72 AlfViewWidget& CAlfViewControl::viewWidget()
       
    73     {
       
    74     return mViewWidget;
       
    75     }