javauis/amms_qt/ammscontrol/src/cammspancontrolgroup.cpp
branchRCL_3
changeset 24 0fd27995241b
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Group for panning controls
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cammspancontrolgroup.h"
       
    21 #include "cammspancontrol.h"
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ===============================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CAMMSPanControlGroup::NewLC
       
    27 // Two-phased constructor.
       
    28 // -----------------------------------------------------------------------------
       
    29 CAMMSPanControlGroup* CAMMSPanControlGroup::NewLC()
       
    30 {
       
    31     CAMMSPanControlGroup* self = new(ELeave) CAMMSPanControlGroup;
       
    32 
       
    33     CleanupStack::PushL(self);
       
    34     self->ConstructL();
       
    35 
       
    36     return self;
       
    37 
       
    38 }
       
    39 
       
    40 // Destructor.
       
    41 CAMMSPanControlGroup::~CAMMSPanControlGroup()
       
    42 {
       
    43 }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CAMMSPanControlGroup::Pan
       
    47 // Gets the current panning set.
       
    48 // (other items were commented in a header).
       
    49 // -----------------------------------------------------------------------------
       
    50 TInt CAMMSPanControlGroup::Pan()
       
    51 {
       
    52     return iPan;
       
    53 }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CAMMSPanControlGroup::SetPanL
       
    57 // Sets the panning value
       
    58 // (other items were commented in a header).
       
    59 // -----------------------------------------------------------------------------
       
    60 void CAMMSPanControlGroup::SetPanL(TInt aPan, TInt& aSetPan)
       
    61 {
       
    62     TInt groups = ControlCount();
       
    63     TInt retVal = aPan;
       
    64 
       
    65     for (TInt i = 0; i < groups; i++)
       
    66     {
       
    67         retVal = TypeSafeControl(i)->SetPanL(aPan);
       
    68     }
       
    69 
       
    70     iPan = retVal;
       
    71 
       
    72     aSetPan = retVal;
       
    73 }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CAMMSPanControlGroup::TypeSafeControl
       
    77 // Gets control. Ownership is not tranferred.
       
    78 // (other items were commented in a header).
       
    79 // -----------------------------------------------------------------------------
       
    80 CAMMSPanControl* CAMMSPanControlGroup::TypeSafeControl(TInt aIndex) const
       
    81 {
       
    82     return static_cast<CAMMSPanControl*>(Control(aIndex));
       
    83 }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CAMMSPanControlGroup::ClassName
       
    87 // Returns class name that identifies this control group.
       
    88 // (other items were commented in a header).
       
    89 // -----------------------------------------------------------------------------
       
    90 const TDesC16& CAMMSPanControlGroup::ClassName()
       
    91 {
       
    92     return KAMMSPanControlClassName;
       
    93 }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CAMMSPanControlGroup::NotifyPlayerAddedL
       
    97 // Called by when a new player is added
       
    98 // (other items were commented in a header).
       
    99 // -----------------------------------------------------------------------------
       
   100 void CAMMSPanControlGroup::NotifyPlayerAddedL(
       
   101     CMMAPlayer *aPlayer,
       
   102     CMMAControl* aControl)
       
   103 {
       
   104     CAMMSControlGroup::NotifyPlayerAddedL(aPlayer, aControl);
       
   105 
       
   106     CAMMSPanControl* control = static_cast<CAMMSPanControl*>(aControl);
       
   107 
       
   108     // set the current parameters
       
   109     control->SetPanL(iPan);
       
   110 }
       
   111 
       
   112 // -----------------------------------------------------------------------------
       
   113 // CAMMSPanControlGroup::CAMMSPanControlGroup
       
   114 // C++ default constructor can NOT contain any code, that
       
   115 // might leave.
       
   116 // -----------------------------------------------------------------------------
       
   117 CAMMSPanControlGroup::CAMMSPanControlGroup()
       
   118         : CAMMSControlGroup(KAMMSPanControl)
       
   119 {
       
   120 }
       
   121 
       
   122 //  End of File