|
1 /* |
|
2 * Copyright (c) 2003 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CMIDSoftKey.h" |
|
20 // CMIDCOmmand API for iMappedCommand |
|
21 #include "CMIDCommand.h" |
|
22 |
|
23 |
|
24 CMIDSoftKey* CMIDSoftKey::NewLC(TInt aIndex, const TInt* aAllowedCommandTypes, TInt aPositionInCBA) |
|
25 { |
|
26 CMIDSoftKey* self = new(ELeave) CMIDSoftKey(aIndex, aPositionInCBA); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(aAllowedCommandTypes); |
|
29 return self; |
|
30 } |
|
31 |
|
32 CMIDSoftKey::~CMIDSoftKey() |
|
33 { |
|
34 iAllowedCommandTypes.Close(); |
|
35 } |
|
36 |
|
37 CMIDSoftKey::CMIDSoftKey(TInt aIndex, TInt aPositionInCBA) |
|
38 : iIndex(aIndex), iPositionInCBA(aPositionInCBA) |
|
39 { |
|
40 } |
|
41 |
|
42 /** Initialise the valid command types for this softkey. Types are currently |
|
43 loaded from static tables |
|
44 */ |
|
45 void CMIDSoftKey::ConstructL(const TInt* aAllowedCommandTypes) |
|
46 { |
|
47 while (*aAllowedCommandTypes != -1) |
|
48 { |
|
49 User::LeaveIfError(iAllowedCommandTypes.Append( |
|
50 STATIC_CAST(MMIDCommand::TCommandType, *aAllowedCommandTypes))); |
|
51 aAllowedCommandTypes++; |
|
52 } |
|
53 } |
|
54 |
|
55 void CMIDSoftKey::Map(const CMIDCommand* aCommand) |
|
56 { |
|
57 iMappedCommand = aCommand; |
|
58 |
|
59 if (iMappedCommand) |
|
60 { |
|
61 iMappedCommand->SetMappedToSoftKey(ETrue); |
|
62 } |
|
63 } |
|
64 |
|
65 |