author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:44:03 +0100 | |
branch | GCC_SURGE |
changeset 63 | ef2686f7597e |
parent 3 | 47c263f7e521 |
parent 38 | 218231f2b3b3 |
permissions | -rw-r--r-- |
35 | 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 for UI |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
//INCLUDES |
|
21 |
#include <AknsDrawUtils.h> |
|
22 |
#include <AknsBasicBackgroundControlContext.h> |
|
23 |
#include <AknsConstants.h> |
|
24 |
#include <AknUtils.h> |
|
25 |
#include <eikenv.h> |
|
26 |
#include <eiklbo.h> |
|
27 |
||
28 |
||
29 |
#include "imageprintuidocument.h" |
|
30 |
#include "imageprintuiappui.h" |
|
31 |
#include "imageprintuiapp.h" |
|
32 |
#include "capabilitymanager.h" |
|
33 |
#include "imageprintui.hrh" |
|
34 |
#include "settingscontainer.h" |
|
35 |
#include "imageprintuidebug.h" |
|
36 |
#include "settingsitems.h" |
|
37 |
#include "settingstables.h" |
|
38 |
#ifdef __SERIES60_HELP |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
39 |
//#include <csxhelp/usb.hlp.hrh> // Help id |
35 | 40 |
#endif |
41 |
||
42 |
||
43 |
// ======== MEMBER FUNCTIONS ======== |
|
44 |
||
45 |
// --------------------------------------------------------------------------- |
|
46 |
// |
|
47 |
// --------------------------------------------------------------------------- |
|
48 |
// |
|
49 |
CSettingsContainer::CSettingsContainer() |
|
50 |
{ |
|
51 |
} |
|
52 |
||
53 |
// --------------------------------------------------------------------------- |
|
54 |
// |
|
55 |
// --------------------------------------------------------------------------- |
|
56 |
// |
|
57 |
void CSettingsContainer::ConstructL( const TRect& aRect, CImagePrintUiAppUi* aAppUi) |
|
58 |
{ |
|
59 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::ConstructL")); |
|
60 |
||
61 |
CreateWindowL(); |
|
62 |
||
63 |
||
64 |
// Create main itemlist |
|
65 |
iSettingsMainListBox = new (ELeave) CAknSettingStyleListBox; |
|
66 |
iSettingsMainListBox->SetContainerWindowL( *this ); |
|
67 |
iSettingsMainListBox->ConstructL( this, EAknListBoxMarkableList ); |
|
68 |
iAppUi = aAppUi; |
|
69 |
||
70 |
iSettingsItems = CSettingsItems::NewL( aAppUi->CapabilityManager(), aAppUi->Notes() ); |
|
71 |
||
72 |
// Set up/down arrows at bottom of the screen (scrollbar) |
|
73 |
iSettingsMainListBox->CreateScrollBarFrameL( ETrue ); |
|
74 |
iSettingsMainListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
75 |
CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto ); |
|
76 |
||
77 |
// Set up the observer (events listener) |
|
78 |
iSettingsMainListBox->SetListBoxObserver( iSettingsItems ); |
|
79 |
// Set text labels for list items |
|
80 |
iSettingsMainListBox->Model()->SetItemTextArray( iSettingsItems ); |
|
81 |
iSettingsMainListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Does not delete items array |
|
82 |
||
83 |
SetRect(aRect); |
|
84 |
ActivateL(); |
|
85 |
||
86 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::ConstructL complete")); |
|
87 |
||
88 |
} |
|
89 |
||
90 |
||
91 |
// --------------------------------------------------------------------------- |
|
92 |
// |
|
93 |
// --------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
CSettingsContainer* CSettingsContainer::NewL( |
|
96 |
const TRect& aRect, CImagePrintUiAppUi* aAppUi ) |
|
97 |
{ |
|
98 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::NewL")); |
|
99 |
CSettingsContainer* self = CSettingsContainer::NewLC( aRect, aAppUi ); |
|
100 |
CleanupStack::Pop( self ); |
|
101 |
return self; |
|
102 |
} |
|
103 |
||
104 |
||
105 |
// --------------------------------------------------------------------------- |
|
106 |
// |
|
107 |
// --------------------------------------------------------------------------- |
|
108 |
// |
|
109 |
CSettingsContainer* CSettingsContainer::NewLC( |
|
110 |
const TRect& aRect, CImagePrintUiAppUi* aAppUi) |
|
111 |
{ |
|
112 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::NewLC")); |
|
113 |
||
114 |
CSettingsContainer* self = new( ELeave ) CSettingsContainer; |
|
115 |
CleanupStack::PushL( self ); |
|
116 |
self->ConstructL( aRect, aAppUi ); |
|
117 |
return self; |
|
118 |
} |
|
119 |
||
120 |
||
121 |
||
122 |
// --------------------------------------------------------------------------- |
|
123 |
// |
|
124 |
// --------------------------------------------------------------------------- |
|
125 |
// |
|
126 |
CSettingsContainer::~CSettingsContainer() |
|
127 |
{ |
|
128 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::Destructor")); |
|
129 |
delete iSettingsMainListBox; |
|
130 |
delete iSettingsItems; |
|
131 |
} |
|
132 |
||
133 |
||
134 |
// --------------------------------------------------------------------------- |
|
135 |
// From class CCoeControl |
|
136 |
// --------------------------------------------------------------------------- |
|
137 |
// |
|
138 |
void CSettingsContainer::SizeChanged() |
|
139 |
{ |
|
140 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::SizeChanged()")); |
|
141 |
||
142 |
iSettingsMainListBox->SetRect( Rect() ); |
|
143 |
iSettingsMainListBox->SetFocus( ETrue ); |
|
144 |
||
145 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::SizeChanged() complete")); |
|
146 |
} |
|
147 |
||
148 |
||
149 |
// --------------------------------------------------------------------------- |
|
150 |
// |
|
151 |
// --------------------------------------------------------------------------- |
|
152 |
// |
|
153 |
void CSettingsContainer::HandleResourceChange(TInt aType) |
|
154 |
{ |
|
155 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::HandleResourceChange")); |
|
156 |
CCoeControl::HandleResourceChange( aType ); |
|
157 |
if( aType == KEikDynamicLayoutVariantSwitch ) |
|
158 |
{ |
|
159 |
TRect mainPaneRect; |
|
160 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
161 |
SetRect(mainPaneRect); |
|
162 |
||
163 |
DrawNow(); |
|
164 |
} |
|
165 |
else if ( aType == KAknsMessageSkinChange ) |
|
166 |
{ |
|
167 |
iSettingsMainListBox->HandleResourceChange(aType); |
|
168 |
} |
|
169 |
||
170 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::HandleResourceChange complete")); |
|
171 |
} |
|
172 |
||
173 |
||
174 |
||
175 |
// --------------------------------------------------------------------------- |
|
176 |
// Returns the number of controls inside this container |
|
177 |
// ---------------------------------------------------------------------------- |
|
178 |
// |
|
179 |
TInt CSettingsContainer::CountComponentControls() const |
|
180 |
{ |
|
181 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::CountComponentControls")); |
|
182 |
||
183 |
return KImagePrintComponentCount; |
|
184 |
} |
|
185 |
||
186 |
||
187 |
// --------------------------------------------------------------------------- |
|
188 |
// Returns the control inside this container |
|
189 |
// ---------------------------------------------------------------------------- |
|
190 |
// |
|
191 |
CCoeControl* CSettingsContainer::ComponentControl( TInt aIndex ) const |
|
192 |
{ |
|
193 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::ComponentControl")); |
|
194 |
||
195 |
switch ( aIndex ) |
|
196 |
{ |
|
197 |
case 0: |
|
198 |
{ |
|
199 |
return iSettingsMainListBox; |
|
200 |
} |
|
201 |
default: |
|
202 |
{ |
|
203 |
return NULL; |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
||
209 |
||
210 |
// --------------------------------------------------------------------------- |
|
211 |
// Redirects keypresses to the listbox |
|
212 |
// ---------------------------------------------------------------------------- |
|
213 |
// |
|
214 |
TKeyResponse CSettingsContainer::OfferKeyEventL( |
|
215 |
const TKeyEvent& aKeyEvent,TEventCode aType ) |
|
216 |
{ |
|
217 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::OfferKeyEventL()")); |
|
218 |
||
219 |
if( ( iSettingsMainListBox ) && ( aKeyEvent.iCode != EKeyLeftArrow ) |
|
220 |
&& ( aKeyEvent.iCode != EKeyRightArrow ) ) |
|
221 |
{ |
|
222 |
TKeyResponse res = iSettingsMainListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
223 |
// Store current item index for options list usage later |
|
224 |
return res; |
|
225 |
} |
|
226 |
||
227 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::OfferKeyEventL complete")); |
|
228 |
||
229 |
return EKeyWasNotConsumed; |
|
230 |
||
231 |
} |
|
232 |
||
233 |
// --------------------------------------------------------------------------- |
|
234 |
// This is called by view class when user has selected Change from Options menu |
|
235 |
// ---------------------------------------------------------------------------- |
|
236 |
void CSettingsContainer::HandleChange() |
|
237 |
{ |
|
238 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::HandleChange")); |
|
239 |
TRAPD(err, iSettingsItems->HandleListBoxEventL( iSettingsMainListBox, |
|
240 |
MEikListBoxObserver::EEventEnterKeyPressed )); |
|
241 |
if(err) |
|
242 |
{ |
|
243 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::error at HandleChange")); |
|
244 |
} |
|
245 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::HandleChange complete")); |
|
246 |
} |
|
247 |
||
248 |
||
249 |
#ifdef __SERIES60_HELP |
|
250 |
// ----------------------------------------------------------------------------- |
|
251 |
// From class CCoeControl |
|
252 |
// For getting help context |
|
253 |
// ----------------------------------------------------------------------------- |
|
254 |
// |
|
255 |
void CSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
256 |
{ |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
257 |
/* |
35 | 258 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::GetHelpContext")); |
259 |
aContext.iMajor = KUidUSB; |
|
260 |
aContext.iContext = KUSB_HLP_PRINT_SETTINGS; |
|
261 |
FLOG(_L("[IMAGEPRINTUI]\t CSettingsContainer::GetHelpContext complete")); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
262 |
*/ |
35 | 263 |
} |
264 |
||
265 |
||
266 |
#endif //__SERIES60_HELP |
|
267 |
||
268 |
//End of File |
|
269 |