|
1 /* |
|
2 * Copyright (c) 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: Container class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <hlplch.h> |
|
22 #include <akntitle.h> |
|
23 #include <eikspane.h> |
|
24 #include <mpxaudioeffectsview.rsg> |
|
25 #include <mpxconstants.h> |
|
26 |
|
27 #include "mpxaudioeffectsview.hlp.hrh" |
|
28 #include "mpxaudioeffectsitems.h" |
|
29 #include "mpxaudioeffectsviewcontainer.h" |
|
30 #include "mpxaudioeffectsviewimp.h" |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ======================= |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CMPXAudioEffectsViewContainer::CMPXAudioEffectsViewContainer() |
|
40 { |
|
41 // Do nothing |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // Symbian OS 2nd phase constructor. Creates a Window for the controls, which |
|
46 // it contains. Constructs a label and adds it to the window, which it then |
|
47 // activates. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 void CMPXAudioEffectsViewContainer::ConstructL( |
|
51 const TRect& aRect, |
|
52 CMPXAudioEffectsModel* aModel ) |
|
53 { |
|
54 CreateWindowL(); |
|
55 SetRect( aRect ); |
|
56 |
|
57 iModel = aModel; |
|
58 |
|
59 //inserting title |
|
60 CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
61 ( iAvkonViewAppUi->StatusPane()->ControlL( |
|
62 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
63 |
|
64 HBufC* title = |
|
65 CEikonEnv::Static()->AllocReadResourceL( R_AUDIOEFFECT_CAPTION_TEXT ); |
|
66 titlePane->SetText( title ); // Ownership transferred |
|
67 |
|
68 //inserting setting list |
|
69 iSettingItems = new ( ELeave ) CMPXAudioEffectsItems( iModel ); |
|
70 iSettingItems->SetContainerWindowL( *this ); |
|
71 iSettingItems->ConstructFromResourceL( R_AUDIOEFFECTS_SETTING_ITEM_LIST ); |
|
72 // Layout setting list box |
|
73 SizeChanged(); |
|
74 ActivateL(); |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // Destructor. Frees up memory for the settings list. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CMPXAudioEffectsViewContainer::~CMPXAudioEffectsViewContainer() |
|
82 { |
|
83 delete iSettingItems; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // Asks the setting list to change the currently selected item |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CMPXAudioEffectsViewContainer::ChangeSelectedItemL() |
|
91 { |
|
92 if ( iSettingItems ) |
|
93 { |
|
94 iSettingItems->ChangeSelectedItemL(); |
|
95 } |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // From CCoeControl |
|
100 // Called by the framework in compound controls |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 TInt CMPXAudioEffectsViewContainer::CountComponentControls() const |
|
104 { |
|
105 return 1; // return number of controls inside this container |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // From CCoeControl |
|
110 // Called by the framework in compound controls |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 CCoeControl* CMPXAudioEffectsViewContainer::ComponentControl( |
|
114 TInt aIndex ) const |
|
115 { |
|
116 switch ( aIndex ) |
|
117 { |
|
118 case 0: |
|
119 { |
|
120 return iSettingItems; |
|
121 } |
|
122 default: |
|
123 { |
|
124 return NULL; |
|
125 } |
|
126 } |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // From CCoeControl |
|
131 // Process a key event |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 TKeyResponse CMPXAudioEffectsViewContainer::OfferKeyEventL( |
|
135 const TKeyEvent& aKeyEvent, |
|
136 TEventCode aType ) |
|
137 { |
|
138 // VC_PCC_MOD: Do not merge changes in this function, Music Player uses |
|
139 // the volumne popup instead of navi pane |
|
140 // |
|
141 if ( iSettingItems ) |
|
142 { |
|
143 return iSettingItems->OfferKeyEventL( aKeyEvent, aType ); |
|
144 } |
|
145 else |
|
146 { |
|
147 return EKeyWasNotConsumed; |
|
148 } |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // From CCoeControl |
|
153 // Responds to changes to the size and position of the contents of this |
|
154 // control. |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 void CMPXAudioEffectsViewContainer::SizeChanged() |
|
158 { |
|
159 if ( iSettingItems ) |
|
160 { |
|
161 iSettingItems->SetRect( Rect() ); |
|
162 } |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // From CCoeControl |
|
167 // Handles a change to the control's resources. |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 void CMPXAudioEffectsViewContainer::HandleResourceChange( TInt aType ) |
|
171 { |
|
172 CCoeControl::HandleResourceChange( aType ); |
|
173 |
|
174 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
175 { |
|
176 TRect mainPaneRect; |
|
177 AknLayoutUtils::LayoutMetricsRect( |
|
178 AknLayoutUtils::EMainPane, mainPaneRect ); |
|
179 SetRect( mainPaneRect ); |
|
180 } |
|
181 } |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // From CCoeControl |
|
185 // Gets Help |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 void CMPXAudioEffectsViewContainer::GetHelpContext( |
|
189 TCoeHelpContext& aContext ) const |
|
190 { |
|
191 aContext.iMajor = KAppUidMusicPlayerX; |
|
192 aContext.iContext = KMusHlpSoundCheckView; |
|
193 } |
|
194 |
|
195 // End of File |