voicerecorder/RecViewSrc/TVRState.cpp
branchRCL_3
changeset 20 072a5fa0c63b
parent 19 2f5c9ee7098c
child 21 c6bafb5162d8
equal deleted inserted replaced
19:2f5c9ee7098c 20:072a5fa0c63b
     1 /*
       
     2 * Copyright (c) 2002 - 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: 
       
    15 *     This class is a data container for a single RecView visual (UI) state
       
    16 *     It is able to read its parameters from a resource file.
       
    17 *     The run-time size of a single TVRState instance is 152 bytes
       
    18 *     (unicode build)
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <barsread.h>	// TResourceReader
       
    25 #include "TVRState.h"
       
    26 
       
    27 
       
    28 // ================= MEMBER FUNCTIONS ========================================
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // TVRState::ReadFromResource
       
    32 // 
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 // Reads a STRUCT VR_STATE
       
    36 void TVRState::ReadFromResource( TResourceReader& aReader )
       
    37 	{
       
    38 	iMenubarResourceId = aReader.ReadUint32();
       
    39 	iCbaResourceId = aReader.ReadUint32();
       
    40 	iStatus.Copy( aReader.ReadTPtrC() );
       
    41 	iLabelSetId = TUint8( aReader.ReadUint8() );
       
    42 	iHasVolumeControl = TUint8( aReader.ReadUint8() );
       
    43 	iHasProgressBar = TUint8( aReader.ReadUint8() );
       
    44 	iFocusButtonId = TUint8( aReader.ReadUint8() );
       
    45 	iStateId = aReader.ReadUint8();
       
    46 	
       
    47 	// Reads an array of STRUCT VR_BUTTON_INFO
       
    48 	iButtonCount = aReader.ReadInt16();
       
    49 	for ( TInt i = 0; i < iButtonCount; i++ )
       
    50 		{
       
    51 		iButtons[ i ].ReadFromResource( aReader );
       
    52 		}
       
    53 	}
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // TVRState::TButton::ReadFromResource
       
    58 // Reads a STRUCT VR_BUTTON 
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 void TVRState::TButton::ReadFromResource( TResourceReader& aReader )
       
    62 	{
       
    63 	iCommandId = aReader.ReadUint16();
       
    64 	iState = TUint8( aReader.ReadUint8() );
       
    65 	}
       
    66 
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // TVRState::ButtonState
       
    70 // 
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 TUint TVRState::ButtonState( TInt aButtonId ) const
       
    74 	{
       
    75 	// aButtonId cannot be out of bounds
       
    76 	return iButtons[ aButtonId ].iState;
       
    77 	}
       
    78 
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // TVRState::ButtonCommandId
       
    82 // 
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 TUint TVRState::ButtonCommandId( TInt aButtonId ) const
       
    86 	{
       
    87 	// aButtonId cannot be out of bounds
       
    88 	return iButtons[ aButtonId ].iCommandId;
       
    89 	}
       
    90