|
1 /* |
|
2 * Copyright (c) 2002 - 2007 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: Test api in eikcba.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] |
|
21 #include <e32svr.h> |
|
22 #include <stifparser.h> |
|
23 #include <stiftestinterface.h> |
|
24 #include <testsdkbuttons.rsg> |
|
25 #include <aknsconstants.h> |
|
26 #include <avkon.hrh> |
|
27 #include <avkon.rsg> |
|
28 |
|
29 #include "testsdkbuttons.hrh" |
|
30 #include "testsdkbuttons.h" |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KArraySize = 10; |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CTestSDKButtons::TestCEikCbaOfferCommandListL |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 |
|
42 TInt CTestSDKButtons::TestCEikCbaOfferCommandListL( CStifItemParser& /*aItem*/ ) |
|
43 { |
|
44 CEikButtonGroupContainer* btgroupcontainer = CEikButtonGroupContainer::NewL( |
|
45 CEikButtonGroupContainer::ECba, |
|
46 CEikButtonGroupContainer::EHorizontal, |
|
47 iContainer, |
|
48 R_GPS_CBABUTTON ); |
|
49 CleanupStack::PushL( btgroupcontainer ); |
|
50 CEikCba *eikcba = static_cast<CEikCba*>( btgroupcontainer->ButtonGroup() ); |
|
51 RArray<TInt> cmdlist( KArraySize ); |
|
52 cmdlist.AppendL( EBckBt ); |
|
53 cmdlist.AppendL( ESingle ); |
|
54 cmdlist.AppendL( EEnhance ); |
|
55 TInt err = KErrNone; |
|
56 TRAP( err, eikcba->OfferCommandListL( R_ENHANCED_BUTTON ) );// leave directly |
|
57 TRAP( err, eikcba->OfferCommandListL( cmdlist ) );// leave directly |
|
58 CleanupStack::PopAndDestroy( btgroupcontainer ); |
|
59 if ( err != KErrNone ) |
|
60 { |
|
61 return KErrNone; |
|
62 } |
|
63 |
|
64 return KErrNone; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CTestSDKButtons::TestCEikCbaSetButtonGroupFlagsL |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 |
|
72 TInt CTestSDKButtons::TestCEikCbaSetButtonGroupFlagsL( CStifItemParser& /*aItem*/ ) |
|
73 { |
|
74 CEikButtonGroupContainer* btgroupcontainer = CEikButtonGroupContainer::NewL( |
|
75 CEikButtonGroupContainer::ECba, |
|
76 CEikButtonGroupContainer::EHorizontal, |
|
77 iContainer, |
|
78 R_GPS_CBABUTTON ); |
|
79 CleanupStack::PushL( btgroupcontainer ); |
|
80 CEikCba *eikcba = static_cast<CEikCba*>( btgroupcontainer->ButtonGroup() ); |
|
81 eikcba->SetButtonGroupFlags( 0 ); |
|
82 CleanupStack::PopAndDestroy( btgroupcontainer ); |
|
83 return KErrNone; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CTestSDKButtons::TestCEikCbaIsCommandInGroupL |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 |
|
91 TInt CTestSDKButtons::TestCEikCbaIsCommandInGroupL( CStifItemParser& /*aItem*/ ) |
|
92 { |
|
93 CEikButtonGroupContainer* btgroupcontainer = CEikButtonGroupContainer::NewL( |
|
94 CEikButtonGroupContainer::ECba, |
|
95 CEikButtonGroupContainer::EHorizontal, |
|
96 iContainer, |
|
97 R_GPS_CBABUTTON ); |
|
98 CleanupStack::PushL( btgroupcontainer ); |
|
99 |
|
100 CEikCba *eikcba = static_cast<CEikCba*>( btgroupcontainer->ButtonGroup() ); |
|
101 STIF_ASSERT_FALSE( eikcba->IsCommandInGroup( EBckBt ) ); |
|
102 CleanupStack::PopAndDestroy( btgroupcontainer ); |
|
103 return KErrNone; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CTestSDKButtons::TestCEikCbaReplaceCommandL |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 |
|
111 TInt CTestSDKButtons::TestCEikCbaReplaceCommandL( CStifItemParser& /*aItem*/ ) |
|
112 { |
|
113 CEikButtonGroupContainer* btgroupcontainer = CEikButtonGroupContainer::NewL( |
|
114 CEikButtonGroupContainer::ECba, |
|
115 CEikButtonGroupContainer::EHorizontal, |
|
116 iContainer, |
|
117 R_GPS_CBABUTTON ); |
|
118 CleanupStack::PushL( btgroupcontainer ); |
|
119 |
|
120 CEikCba *eikcba = static_cast<CEikCba*>( btgroupcontainer->ButtonGroup() ); |
|
121 eikcba->ReplaceCommand( ELeftBt, R_ENHANCED_BUTTON ); |
|
122 CleanupStack::PopAndDestroy( btgroupcontainer ); |
|
123 return KErrNone; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CTestSDKButtons::TestCEikCbaEnableItemSpecificSoftkey |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TInt CTestSDKButtons::TestCEikCbaEnableItemSpecificSoftkey( CStifItemParser& /*aItem*/ ) |
|
131 { |
|
132 CEikButtonGroupContainer* btgroupcontainer = CEikButtonGroupContainer::NewL( |
|
133 CEikButtonGroupContainer::ECba, |
|
134 CEikButtonGroupContainer::EHorizontal, |
|
135 iContainer, |
|
136 R_AVKON_SOFTKEYS_OK_CANCEL ); |
|
137 CleanupStack::PushL( btgroupcontainer ); |
|
138 |
|
139 CEikCba *eikcba = static_cast<CEikCba*>( btgroupcontainer->ButtonGroup() ); |
|
140 eikcba->EnableItemSpecificSoftkey( EFalse ); |
|
141 eikcba->EnableItemSpecificSoftkey( ETrue ); |
|
142 CleanupStack::PopAndDestroy( btgroupcontainer ); |
|
143 return KErrNone; |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CTestSDKButtons::TestCEikCbaSetSkinBackgroundIdL |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 |
|
151 TInt CTestSDKButtons::TestCEikCbaSetSkinBackgroundIdL( CStifItemParser& /*aItem*/ ) |
|
152 { |
|
153 CEikButtonGroupContainer* btgroupcontainer = CEikButtonGroupContainer::NewL( |
|
154 CEikButtonGroupContainer::ECba, |
|
155 CEikButtonGroupContainer::EHorizontal, |
|
156 iContainer, |
|
157 R_GPS_CBABUTTON ); |
|
158 CleanupStack::PushL( btgroupcontainer ); |
|
159 |
|
160 CEikCba *eikcba = static_cast<CEikCba*>( btgroupcontainer->ButtonGroup() ); |
|
161 eikcba->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlIdle ); |
|
162 TPointerEvent event; |
|
163 eikcba->HandlePointerEventL( event ); |
|
164 CleanupStack::PopAndDestroy( btgroupcontainer ); |
|
165 return KErrNone; |
|
166 } |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CTestSDKButtons::TestCEikCbaIsEmptyL |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 |
|
173 TInt CTestSDKButtons::TestCEikCbaIsEmptyL( CStifItemParser& /*aItem*/ ) |
|
174 { |
|
175 CEikButtonGroupContainer* btgroupcontainer = CEikButtonGroupContainer::NewL( |
|
176 CEikButtonGroupContainer::ECba, |
|
177 CEikButtonGroupContainer::EHorizontal, |
|
178 iContainer, |
|
179 R_GPS_CBABUTTON ); |
|
180 CleanupStack::PushL( btgroupcontainer ); |
|
181 |
|
182 CEikCba *eikcba = static_cast<CEikCba*>( btgroupcontainer->ButtonGroup() ); |
|
183 eikcba->IsEmpty(); |
|
184 CleanupStack::PopAndDestroy( btgroupcontainer ); |
|
185 return KErrNone; |
|
186 } |
|
187 |
|
188 |
|
189 // End of file |