widgetmodel/alfwidgetmodel/src/alfwidgetcommand.cpp
changeset 0 e83bab7cf002
equal deleted inserted replaced
-1:000000000000 0:e83bab7cf002
       
     1 /*
       
     2 * Copyright (c) 2006 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:  widget command implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //INCLUDES
       
    21 #include <alf/alfwidgetcommand.h>
       
    22 #include <alf/alfwidgetevents.h>
       
    23 #include <alf/alfevent.h>
       
    24 #include "alf/alfwidget.h"
       
    25 #include "alf/alfattribute.h"
       
    26 
       
    27 namespace Alf
       
    28 {
       
    29 TAlfWidgetAttributeCommand::TAlfWidgetAttributeCommand(  
       
    30     AlfAttribute* aAttribute, 
       
    31     UString& aTarget,
       
    32     AlfWidget* aRecipient
       
    33     ) : TAlfObjectCommand(EAlfCommandTypeNone, aRecipient, EAlfOpNone),
       
    34         mOwnedAttribute( aAttribute ),
       
    35         mTarget( aTarget )
       
    36     {
       
    37     }
       
    38 
       
    39 void TAlfWidgetAttributeCommand::ExecuteL(CAlfEnv& /*aEnv*/) const
       
    40     {
       
    41     TAlfEvent newEvent( EEventWidgetAttributeChanged, (TInt)this );
       
    42     AlfWidget* widget = ((AlfWidget*) Object());
       
    43     if (widget)
       
    44         {
       
    45         CAlfControl* control = widget->control(); // Widgets are guaranteed to have controls
       
    46         control->OfferEventL(newEvent);
       
    47         }
       
    48     }
       
    49 
       
    50 TAlfWidgetAttributeCommand::~TAlfWidgetAttributeCommand()
       
    51     {
       
    52     delete mOwnedAttribute;
       
    53     mOwnedAttribute = NULL;
       
    54     }
       
    55 
       
    56 TInt TAlfWidgetAttributeCommand::Size() const
       
    57     {
       
    58     return sizeof(*this);
       
    59     }
       
    60 
       
    61 }//namespace Alf;
       
    62