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: Provides blid request container class methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <aknnavide.h> |
|
22 #include <aknlists.h> |
|
23 #include <Blid.rsg> |
|
24 #include <AknDef.h> |
|
25 #include <csxhelp/blid.hlp.hrh> |
|
26 |
|
27 #include "CBlidSettingsContainer.h" |
|
28 #include "CBlidSettingsLBModel.h" |
|
29 #include "Blid.hrh" |
|
30 |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ======================= |
|
33 // --------------------------------------------------------- |
|
34 // CBlidSettingsContainer::NewL |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 CBlidSettingsContainer* CBlidSettingsContainer::NewL( |
|
38 MKeyProcessor& aKeyProcessor, |
|
39 MObjectProvider* aParent, |
|
40 const TRect& aRect, |
|
41 MBlidSettings* aSettingsModel, |
|
42 CBlidBaseView& aView ) |
|
43 { |
|
44 CBlidSettingsContainer* view = |
|
45 new (ELeave) CBlidSettingsContainer( aKeyProcessor, aView ); |
|
46 CleanupStack::PushL(view); |
|
47 view->SetMopParent( aParent ); |
|
48 view->ConstructL(aRect, aSettingsModel ); |
|
49 CleanupStack::Pop( view ); // view |
|
50 return view; |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------- |
|
54 // CBlidSettingsContainer::CBlidSettingsContainer |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 CBlidSettingsContainer::CBlidSettingsContainer( MKeyProcessor& aKeyProcessor, |
|
58 CBlidBaseView& aView ) |
|
59 :CBlidBaseContainer( aKeyProcessor, KBLID_HLP_SETTINGS ), iView(aView) |
|
60 { |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CBlidSettingsContainer::ConstructL |
|
65 // EPOC two phased constructor |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 void CBlidSettingsContainer::ConstructL(const TRect& aRect, |
|
69 MBlidSettings* aSettingsModel) |
|
70 { |
|
71 CreateWindowL(); |
|
72 CreateNaviPaneL( ETrue ); |
|
73 |
|
74 iListBox = new( ELeave ) CAknSettingStyleListBox; |
|
75 iListBox->SetContainerWindowL( *this ); |
|
76 iListBox->ConstructL( this, EAknListBoxMenuList ); |
|
77 |
|
78 // Make scroll arrows |
|
79 iListBox->CreateScrollBarFrameL( ETrue ); |
|
80 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
81 CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOn ); |
|
82 |
|
83 |
|
84 // create engine model for listbox, pass ownership |
|
85 MDesCArray* model = CBlidSettingsLBModel::NewLC( aSettingsModel ); |
|
86 iListBox->Model()->SetItemTextArray( model ); |
|
87 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
88 CleanupStack::Pop(); // model |
|
89 |
|
90 MakeTitleL(R_BLID_TITLE_SETTINGS); |
|
91 SetRect(aRect); |
|
92 ActivateL(); |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------- |
|
96 // CBlidSettingsContainer::~CBlidSettingsContainer |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 CBlidSettingsContainer::~CBlidSettingsContainer() |
|
100 { |
|
101 delete iDecoratedTabGroup; |
|
102 delete iListBox; |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------- |
|
106 // CBlidSettingsContainer::ListBox |
|
107 // --------------------------------------------------------- |
|
108 // |
|
109 CAknSettingStyleListBox* CBlidSettingsContainer::ListBox() const |
|
110 { |
|
111 return iListBox; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------- |
|
115 // CBlidSettingsContainer::SizeChanged() |
|
116 // Called by framework when the view size is changed |
|
117 // --------------------------------------------------------- |
|
118 // |
|
119 void CBlidSettingsContainer::SizeChanged() |
|
120 { |
|
121 iListBox->SetRect( Rect() ); |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------- |
|
125 // CBlidSettingsContainer::CountComponentControls() const |
|
126 // --------------------------------------------------------- |
|
127 // |
|
128 TInt CBlidSettingsContainer::CountComponentControls() const |
|
129 { |
|
130 return 1; // return nbr of controls inside this container |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------- |
|
134 // CBlidSettingsContainer::ComponentControl(TInt aIndex) const |
|
135 // --------------------------------------------------------- |
|
136 // |
|
137 CCoeControl* CBlidSettingsContainer::ComponentControl(TInt /*aIndex*/ ) const |
|
138 { |
|
139 return iListBox; |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------- |
|
143 // CBlidSettingsContainer::HandleResourceChange |
|
144 // --------------------------------------------------------- |
|
145 // |
|
146 void CBlidSettingsContainer::HandleResourceChange(TInt aType) |
|
147 { |
|
148 CBlidBaseContainer::HandleResourceChange( aType ); |
|
149 switch(aType) |
|
150 { |
|
151 case KEikDynamicLayoutVariantSwitch: |
|
152 { |
|
153 iView.Update(this); |
|
154 break; |
|
155 } |
|
156 default: |
|
157 { |
|
158 break; |
|
159 } |
|
160 } |
|
161 } |
|
162 |
|
163 // ---------------------------------------------------------------------------- |
|
164 // CBlidSettingsContainer::FocuChanged() |
|
165 // ---------------------------------------------------------------------------- |
|
166 // |
|
167 void CBlidSettingsContainer::FocusChanged(TDrawNow aDrawNow) |
|
168 { |
|
169 if (iListBox) |
|
170 { |
|
171 iListBox->SetFocus(IsFocused(), aDrawNow); |
|
172 } |
|
173 } |
|
174 |
|
175 // ---------------------------------------------------------------------------- |
|
176 // CBlidSettingsContainer::OfferKeyEventL |
|
177 // ---------------------------------------------------------------------------- |
|
178 // |
|
179 TKeyResponse CBlidSettingsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
180 TEventCode aType) |
|
181 { |
|
182 if ( aType == EEventKeyUp || aType == EEventKeyDown ) |
|
183 { |
|
184 TInt lIndex = iListBox->CurrentItemIndex(); |
|
185 switch( lIndex ) |
|
186 { |
|
187 case EBlidSettingsResetOdometer: |
|
188 { |
|
189 iView.RemoveMiddleSoftKeyLabel( EBlidCmdMskChangeSetting ); |
|
190 iView.SetMiddleSoftKeyLabelL( R_BLID_MSK_RESET,EBlidCmdMskResetSetting ); |
|
191 break; |
|
192 } |
|
193 // Other values are not accepted. |
|
194 case EBlidSettingsBacklight: |
|
195 case EBlidSettingsArrivalTone: |
|
196 case EBlidSettingsCalibration: |
|
197 { |
|
198 iView.RemoveMiddleSoftKeyLabel( EBlidCmdMskResetSetting ); |
|
199 iView.SetMiddleSoftKeyLabelL( R_BLID_MSK_CHANGE, EBlidCmdMskChangeSetting ); |
|
200 break; |
|
201 } |
|
202 default: |
|
203 { |
|
204 break; |
|
205 } |
|
206 } |
|
207 return EKeyWasConsumed; |
|
208 } |
|
209 return CBlidBaseContainer::OfferKeyEventL( aKeyEvent, aType ); |
|
210 } |
|
211 |
|
212 #ifdef RD_SCALABLE_UI_V2 |
|
213 // --------------------------------------------------------------------------- |
|
214 // CBlidSettingsContainer::SetListBoxObserver |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 void CBlidSettingsContainer::SetListBoxObserver( MEikListBoxObserver* aObserver ) |
|
218 { |
|
219 iListBox->SetListBoxObserver( aObserver ); |
|
220 } |
|
221 #endif // RD_SCALABLE_UI_V2 |
|
222 |
|
223 // End of File |
|