89
89
* @param aCommandObserver command observer
90
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 );
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
104
* Construct the control (second phase).
105
105
* Creates a window to contain the controls and activates it.
106
106
* @param aRect bounding rectangle
107
107
* @param aCommandObserver command observer
108
108
* @param aParent owning parent, or NULL
110
void CSymbian_ua_guiContainer::ConstructL(
112
const CCoeControl* aParent,
113
MEikCommandObserver* aCommandObserver )
115
if ( aParent == NULL )
121
SetContainerWindowL( *aParent );
123
iFocusControl = NULL;
124
iCommandObserver = aCommandObserver;
125
InitializeControlsL();
128
// [[[ begin generated region: do not modify [Post-ActivateL initializations]
129
// ]]] end generated region [Post-ActivateL initializations]
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]
134
132
* Return the number of controls in the container (override)
137
135
TInt CSymbian_ua_guiContainer::CountComponentControls() const
139
return ( int ) ELastControl;
137
return (int) ELastControl;
143
141
* Get the control with the given index (override)
144
142
* @param aIndex Control index [0...n) (limited by #CountComponentControls)
145
143
* @return Pointer to control
147
CCoeControl* CSymbian_ua_guiContainer::ComponentControl( TInt aIndex ) const
149
// [[[ begin generated region: do not modify [Generated Contents]
159
// ]]] end generated region [Generated Contents]
161
// handle any user controls here...
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...
167
165
* Handle resizing of the container. This implementation will lay out
168
166
* full-sized controls like list boxes for any screen size, and will layout
169
167
* labels, editors, etc. to the size they were given in the UI designer.
170
168
* This code will need to be modified to adjust arbitrary controls to
171
169
* any screen size.
173
171
void CSymbian_ua_guiContainer::SizeChanged()
175
CCoeControl::SizeChanged();
177
// [[[ begin generated region: do not modify [Generated Contents]
179
// ]]] end generated region [Generated Contents]
173
CCoeControl::SizeChanged();
175
// [[[ begin generated region: do not modify [Generated Contents]
177
// ]]] end generated region [Generated Contents]
183
181
// [[[ begin generated function: do not modify
185
183
* Layout components as specified in the UI Designer
187
185
void CSymbian_ua_guiContainer::LayoutControls()
189
iLabel1->SetExtent( TPoint( 2, 23 ), TSize( 32, 28 ) );
190
iEd_url->SetExtent( TPoint( 49, 25 ), TSize( 197, 28 ) );
191
iEd_info->SetExtent( TPoint( 3, 78 ), TSize( 235, 143 ) );
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));
193
191
// ]]] end generated function
196
194
* Handle key events.
198
TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL(
199
const TKeyEvent& aKeyEvent,
202
// [[[ begin generated region: do not modify [Generated Contents]
204
// ]]] end generated region [Generated Contents]
206
if ( iFocusControl != NULL
207
&& iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
209
return EKeyWasConsumed;
211
return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
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);
214
212
// [[[ begin generated function: do not modify
216
214
* Initialize each control upon creation.
218
216
void CSymbian_ua_guiContainer::InitializeControlsL()
220
iLabel1 = new ( ELeave ) CEikLabel;
221
iLabel1->SetContainerWindowL( *this );
223
TResourceReader reader;
224
iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1 );
225
iLabel1->ConstructFromResourceL( reader );
226
CleanupStack::PopAndDestroy(); // reader internal state
228
iEd_url = new ( ELeave ) CEikEdwin;
229
iEd_url->SetContainerWindowL( *this );
231
TResourceReader reader;
232
iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_URL );
233
iEd_url->ConstructFromResourceL( reader );
234
CleanupStack::PopAndDestroy(); // reader internal state
237
HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2 );
238
iEd_url->SetTextL( text );
239
CleanupStack::PopAndDestroy( text );
241
iEd_info = new ( ELeave ) CEikEdwin;
242
iEd_info->SetContainerWindowL( *this );
244
TResourceReader reader;
245
iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO );
246
iEd_info->ConstructFromResourceL( reader );
247
CleanupStack::PopAndDestroy(); // reader internal state
250
HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2 );
251
iEd_info->SetTextL( text );
252
CleanupStack::PopAndDestroy( text );
255
iEd_url->SetFocus( ETrue );
256
iFocusControl = iEd_url;
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;
259
257
// ]]] end generated function
262
260
* Handle global resource changes, such as scalable UI or skin events (override)
264
void CSymbian_ua_guiContainer::HandleResourceChange( TInt aType )
266
CCoeControl::HandleResourceChange( aType );
267
SetRect( iAvkonViewAppUi->View( TUid::Uid( ESymbian_ua_guiContainerViewId ) )->ClientRect() );
268
// [[[ begin generated region: do not modify [Generated Contents]
269
// ]]] end generated region [Generated Contents]
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]
274
272
* Draw container contents.
276
void CSymbian_ua_guiContainer::Draw( const TRect& aRect ) const
278
// [[[ begin generated region: do not modify [Generated Contents]
279
CWindowGc& gc = SystemGc();
282
// ]]] end generated region [Generated 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]