2
========================================================================
3
Name : symbian_ua_guiContainer.cpp
5
Copyright : (c) 2008-2009 Teluu Inc.
7
========================================================================
9
// [[[ begin generated region: do not modify [Generated System Includes]
11
#include <stringloader.h>
16
#include <aknviewappui.h>
18
#include <symbian_ua_gui.rsg>
19
// ]]] end generated region [Generated System Includes]
21
// [[[ begin generated region: do not modify [Generated User Includes]
22
#include "symbian_ua_guiContainer.h"
23
#include "symbian_ua_guiContainerView.h"
24
#include "symbian_ua_gui.hrh"
25
#include "symbian_ua_guiContainer.hrh"
26
#include "symbian_ua_guiSettingItemList.hrh"
27
// ]]] end generated region [Generated User Includes]
29
// [[[ begin generated region: do not modify [Generated Constants]
30
// ]]] end generated region [Generated Constants]
33
* First phase of Symbian two-phase construction. Should not
34
* contain any code that could leave.
36
CSymbian_ua_guiContainer::CSymbian_ua_guiContainer()
38
// [[[ begin generated region: do not modify [Generated Contents]
42
// ]]] end generated region [Generated Contents]
46
* Destroy child controls.
48
CSymbian_ua_guiContainer::~CSymbian_ua_guiContainer()
50
// [[[ begin generated region: do not modify [Generated Contents]
57
// ]]] end generated region [Generated Contents]
62
* Construct the control (first phase).
63
* Creates an instance and initializes it.
64
* Instance is not left on cleanup stack.
65
* @param aRect bounding rectangle
66
* @param aParent owning parent, or NULL
67
* @param aCommandObserver command observer
68
* @return initialized instance of CSymbian_ua_guiContainer
70
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewL (
72
const CCoeControl* aParent,
73
MEikCommandObserver* aCommandObserver)
75
CSymbian_ua_guiContainer* self = CSymbian_ua_guiContainer::NewLC (
79
CleanupStack::Pop (self);
84
* Construct the control (first phase).
85
* Creates an instance and initializes it.
86
* Instance is left on cleanup stack.
87
* @param aRect The rectangle for this window
88
* @param aParent owning parent, or NULL
89
* @param aCommandObserver command observer
90
* @return new instance of CSymbian_ua_guiContainer
92
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewLC (
94
const CCoeControl* aParent,
95
MEikCommandObserver* aCommandObserver)
97
CSymbian_ua_guiContainer* self = new (ELeave) CSymbian_ua_guiContainer();
98
CleanupStack::PushL (self);
99
self->ConstructL (aRect, aParent, aCommandObserver);
104
* Construct the control (second phase).
105
* Creates a window to contain the controls and activates it.
106
* @param aRect bounding rectangle
107
* @param aCommandObserver command observer
108
* @param aParent owning parent, or NULL
110
void CSymbian_ua_guiContainer::ConstructL (
112
const CCoeControl* aParent,
113
MEikCommandObserver* aCommandObserver)
115
if (aParent == NULL) {
118
SetContainerWindowL (*aParent);
121
iFocusControl = NULL;
122
iCommandObserver = aCommandObserver;
123
InitializeControlsL();
126
// [[[ begin generated region: do not modify [Post-ActivateL initializations]
127
// ]]] end generated region [Post-ActivateL initializations]
132
* Return the number of controls in the container (override)
135
TInt CSymbian_ua_guiContainer::CountComponentControls() const
137
return (int) ELastControl;
141
* Get the control with the given index (override)
142
* @param aIndex Control index [0...n) (limited by #CountComponentControls)
143
* @return Pointer to control
145
CCoeControl* CSymbian_ua_guiContainer::ComponentControl (TInt aIndex) const
147
// [[[ begin generated region: do not modify [Generated Contents]
157
// ]]] end generated region [Generated Contents]
159
// handle any user controls here...
165
* Handle resizing of the container. This implementation will lay out
166
* full-sized controls like list boxes for any screen size, and will layout
167
* labels, editors, etc. to the size they were given in the UI designer.
168
* This code will need to be modified to adjust arbitrary controls to
171
void CSymbian_ua_guiContainer::SizeChanged()
173
CCoeControl::SizeChanged();
175
// [[[ begin generated region: do not modify [Generated Contents]
177
// ]]] end generated region [Generated Contents]
181
// [[[ begin generated function: do not modify
183
* Layout components as specified in the UI Designer
185
void CSymbian_ua_guiContainer::LayoutControls()
187
iLabel1->SetExtent (TPoint (2, 23), TSize (32, 28));
188
iEd_url->SetExtent (TPoint (49, 25), TSize (197, 28));
189
iEd_info->SetExtent (TPoint (3, 78), TSize (235, 143));
191
// ]]] end generated function
196
TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL (
197
const TKeyEvent& aKeyEvent,
200
// [[[ begin generated region: do not modify [Generated Contents]
202
// ]]] end generated region [Generated Contents]
204
if (iFocusControl != NULL
205
&& iFocusControl->OfferKeyEventL (aKeyEvent, aType) == EKeyWasConsumed) {
206
return EKeyWasConsumed;
209
return CCoeControl::OfferKeyEventL (aKeyEvent, aType);
212
// [[[ begin generated function: do not modify
214
* Initialize each control upon creation.
216
void CSymbian_ua_guiContainer::InitializeControlsL()
218
iLabel1 = new (ELeave) CEikLabel;
219
iLabel1->SetContainerWindowL (*this);
221
TResourceReader reader;
222
iEikonEnv->CreateResourceReaderLC (reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1);
223
iLabel1->ConstructFromResourceL (reader);
224
CleanupStack::PopAndDestroy(); // reader internal state
226
iEd_url = new (ELeave) CEikEdwin;
227
iEd_url->SetContainerWindowL (*this);
229
TResourceReader reader;
230
iEikonEnv->CreateResourceReaderLC (reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_URL);
231
iEd_url->ConstructFromResourceL (reader);
232
CleanupStack::PopAndDestroy(); // reader internal state
235
HBufC* text = StringLoader::LoadLC (R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2);
236
iEd_url->SetTextL (text);
237
CleanupStack::PopAndDestroy (text);
239
iEd_info = new (ELeave) CEikEdwin;
240
iEd_info->SetContainerWindowL (*this);
242
TResourceReader reader;
243
iEikonEnv->CreateResourceReaderLC (reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO);
244
iEd_info->ConstructFromResourceL (reader);
245
CleanupStack::PopAndDestroy(); // reader internal state
248
HBufC* text = StringLoader::LoadLC (R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2);
249
iEd_info->SetTextL (text);
250
CleanupStack::PopAndDestroy (text);
253
iEd_url->SetFocus (ETrue);
254
iFocusControl = iEd_url;
257
// ]]] end generated function
260
* Handle global resource changes, such as scalable UI or skin events (override)
262
void CSymbian_ua_guiContainer::HandleResourceChange (TInt aType)
264
CCoeControl::HandleResourceChange (aType);
265
SetRect (iAvkonViewAppUi->View (TUid::Uid (ESymbian_ua_guiContainerViewId))->ClientRect());
266
// [[[ begin generated region: do not modify [Generated Contents]
267
// ]]] end generated region [Generated Contents]
272
* Draw container contents.
274
void CSymbian_ua_guiContainer::Draw (const TRect& aRect) const
276
// [[[ begin generated region: do not modify [Generated Contents]
277
CWindowGc& gc = SystemGc();
280
// ]]] end generated region [Generated Contents]