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