1
/* $Id: symbian_ua_guiContainer.cpp 3550 2011-05-05 05:33:27Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
// [[[ begin generated region: do not modify [Generated System Includes]
21
#include <stringloader.h>
26
#include <aknviewappui.h>
28
#include <symbian_ua_gui.rsg>
29
// ]]] end generated region [Generated System Includes]
31
// [[[ begin generated region: do not modify [Generated User Includes]
32
#include "symbian_ua_guiContainer.h"
33
#include "symbian_ua_guiContainerView.h"
34
#include "symbian_ua_gui.hrh"
35
#include "symbian_ua_guiContainer.hrh"
36
#include "symbian_ua_guiSettingItemList.hrh"
37
// ]]] end generated region [Generated User Includes]
39
// [[[ begin generated region: do not modify [Generated Constants]
40
// ]]] end generated region [Generated Constants]
43
* First phase of Symbian two-phase construction. Should not
44
* contain any code that could leave.
46
CSymbian_ua_guiContainer::CSymbian_ua_guiContainer()
48
// [[[ begin generated region: do not modify [Generated Contents]
52
// ]]] end generated region [Generated Contents]
56
* Destroy child controls.
58
CSymbian_ua_guiContainer::~CSymbian_ua_guiContainer()
60
// [[[ begin generated region: do not modify [Generated Contents]
67
// ]]] end generated region [Generated Contents]
72
* Construct the control (first phase).
73
* Creates an instance and initializes it.
74
* Instance is not left on cleanup stack.
75
* @param aRect bounding rectangle
76
* @param aParent owning parent, or NULL
77
* @param aCommandObserver command observer
78
* @return initialized instance of CSymbian_ua_guiContainer
80
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewL(
82
const CCoeControl* aParent,
83
MEikCommandObserver* aCommandObserver )
85
CSymbian_ua_guiContainer* self = CSymbian_ua_guiContainer::NewLC(
89
CleanupStack::Pop( self );
94
* Construct the control (first phase).
95
* Creates an instance and initializes it.
96
* Instance is left on cleanup stack.
97
* @param aRect The rectangle for this window
98
* @param aParent owning parent, or NULL
99
* @param aCommandObserver command observer
100
* @return new instance of CSymbian_ua_guiContainer
102
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewLC(
104
const CCoeControl* aParent,
105
MEikCommandObserver* aCommandObserver )
107
CSymbian_ua_guiContainer* self = new ( ELeave ) CSymbian_ua_guiContainer();
108
CleanupStack::PushL( self );
109
self->ConstructL( aRect, aParent, aCommandObserver );
114
* Construct the control (second phase).
115
* Creates a window to contain the controls and activates it.
116
* @param aRect bounding rectangle
117
* @param aCommandObserver command observer
118
* @param aParent owning parent, or NULL
120
void CSymbian_ua_guiContainer::ConstructL(
122
const CCoeControl* aParent,
123
MEikCommandObserver* aCommandObserver )
125
if ( aParent == NULL )
131
SetContainerWindowL( *aParent );
133
iFocusControl = NULL;
134
iCommandObserver = aCommandObserver;
135
InitializeControlsL();
138
// [[[ begin generated region: do not modify [Post-ActivateL initializations]
139
// ]]] end generated region [Post-ActivateL initializations]
144
* Return the number of controls in the container (override)
147
TInt CSymbian_ua_guiContainer::CountComponentControls() const
149
return ( int ) ELastControl;
153
* Get the control with the given index (override)
154
* @param aIndex Control index [0...n) (limited by #CountComponentControls)
155
* @return Pointer to control
157
CCoeControl* CSymbian_ua_guiContainer::ComponentControl( TInt aIndex ) const
159
// [[[ begin generated region: do not modify [Generated Contents]
169
// ]]] end generated region [Generated Contents]
171
// handle any user controls here...
177
* Handle resizing of the container. This implementation will lay out
178
* full-sized controls like list boxes for any screen size, and will layout
179
* labels, editors, etc. to the size they were given in the UI designer.
180
* This code will need to be modified to adjust arbitrary controls to
183
void CSymbian_ua_guiContainer::SizeChanged()
185
CCoeControl::SizeChanged();
187
// [[[ begin generated region: do not modify [Generated Contents]
189
// ]]] end generated region [Generated Contents]
193
// [[[ begin generated function: do not modify
195
* Layout components as specified in the UI Designer
197
void CSymbian_ua_guiContainer::LayoutControls()
199
iLabel1->SetExtent( TPoint( 2, 23 ), TSize( 32, 28 ) );
200
iEd_url->SetExtent( TPoint( 49, 25 ), TSize( 197, 28 ) );
201
iEd_info->SetExtent( TPoint( 3, 78 ), TSize( 235, 143 ) );
203
// ]]] end generated function
208
TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL(
209
const TKeyEvent& aKeyEvent,
212
// [[[ begin generated region: do not modify [Generated Contents]
214
// ]]] end generated region [Generated Contents]
216
if ( iFocusControl != NULL
217
&& iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
219
return EKeyWasConsumed;
221
return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
224
// [[[ begin generated function: do not modify
226
* Initialize each control upon creation.
228
void CSymbian_ua_guiContainer::InitializeControlsL()
230
iLabel1 = new ( ELeave ) CEikLabel;
231
iLabel1->SetContainerWindowL( *this );
233
TResourceReader reader;
234
iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1 );
235
iLabel1->ConstructFromResourceL( reader );
236
CleanupStack::PopAndDestroy(); // reader internal state
238
iEd_url = new ( ELeave ) CEikEdwin;
239
iEd_url->SetContainerWindowL( *this );
241
TResourceReader reader;
242
iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_URL );
243
iEd_url->ConstructFromResourceL( reader );
244
CleanupStack::PopAndDestroy(); // reader internal state
247
HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2 );
248
iEd_url->SetTextL( text );
249
CleanupStack::PopAndDestroy( text );
251
iEd_info = new ( ELeave ) CEikEdwin;
252
iEd_info->SetContainerWindowL( *this );
254
TResourceReader reader;
255
iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO );
256
iEd_info->ConstructFromResourceL( reader );
257
CleanupStack::PopAndDestroy(); // reader internal state
260
HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2 );
261
iEd_info->SetTextL( text );
262
CleanupStack::PopAndDestroy( text );
265
iEd_url->SetFocus( ETrue );
266
iFocusControl = iEd_url;
269
// ]]] end generated function
272
* Handle global resource changes, such as scalable UI or skin events (override)
274
void CSymbian_ua_guiContainer::HandleResourceChange( TInt aType )
276
CCoeControl::HandleResourceChange( aType );
277
SetRect( iAvkonViewAppUi->View( TUid::Uid( ESymbian_ua_guiContainerViewId ) )->ClientRect() );
278
// [[[ begin generated region: do not modify [Generated Contents]
279
// ]]] end generated region [Generated Contents]
284
* Draw container contents.
286
void CSymbian_ua_guiContainer::Draw( const TRect& aRect ) const
288
// [[[ begin generated region: do not modify [Generated Contents]
289
CWindowGc& gc = SystemGc();
292
// ]]] end generated region [Generated Contents]