~ubuntu-branches/ubuntu/natty/sflphone/natty

« back to all changes in this revision

Viewing changes to sflphone-common/libs/pjproject/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 Name        : symbian_ua_guiContainer.cpp
4
4
 Author      : nanang
5
5
 Copyright   : (c) 2008-2009 Teluu Inc.
6
 
 Description : 
 
6
 Description :
7
7
========================================================================
8
8
*/
9
9
// [[[ begin generated region: do not modify [Generated System Includes]
30
30
// ]]] end generated region [Generated Constants]
31
31
 
32
32
/**
33
 
 * First phase of Symbian two-phase construction. Should not 
 
33
 * First phase of Symbian two-phase construction. Should not
34
34
 * contain any code that could leave.
35
35
 */
36
36
CSymbian_ua_guiContainer::CSymbian_ua_guiContainer()
37
 
        {
38
 
        // [[[ begin generated region: do not modify [Generated Contents]
39
 
        iLabel1 = NULL;
40
 
        iEd_url = NULL;
41
 
        iEd_info = NULL;
42
 
        // ]]] end generated region [Generated Contents]
43
 
        
44
 
        }
45
 
/** 
 
37
{
 
38
    // [[[ begin generated region: do not modify [Generated Contents]
 
39
    iLabel1 = NULL;
 
40
    iEd_url = NULL;
 
41
    iEd_info = NULL;
 
42
    // ]]] end generated region [Generated Contents]
 
43
 
 
44
}
 
45
/**
46
46
 * Destroy child controls.
47
47
 */
48
48
CSymbian_ua_guiContainer::~CSymbian_ua_guiContainer()
49
 
        {
50
 
        // [[[ begin generated region: do not modify [Generated Contents]
51
 
        delete iLabel1;
52
 
        iLabel1 = NULL;
53
 
        delete iEd_url;
54
 
        iEd_url = NULL;
55
 
        delete iEd_info;
56
 
        iEd_info = NULL;
57
 
        // ]]] end generated region [Generated Contents]
58
 
        
59
 
        }
60
 
                                
 
49
{
 
50
    // [[[ begin generated region: do not modify [Generated Contents]
 
51
    delete iLabel1;
 
52
    iLabel1 = NULL;
 
53
    delete iEd_url;
 
54
    iEd_url = NULL;
 
55
    delete iEd_info;
 
56
    iEd_info = NULL;
 
57
    // ]]] end generated region [Generated Contents]
 
58
 
 
59
}
 
60
 
61
61
/**
62
62
 * Construct the control (first phase).
63
63
 *  Creates an instance and initializes it.
67
67
 * @param aCommandObserver command observer
68
68
 * @return initialized instance of CSymbian_ua_guiContainer
69
69
 */
70
 
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewL( 
71
 
                const TRect& aRect, 
72
 
                const CCoeControl* aParent, 
73
 
                MEikCommandObserver* aCommandObserver )
74
 
        {
75
 
        CSymbian_ua_guiContainer* self = CSymbian_ua_guiContainer::NewLC( 
76
 
                        aRect, 
77
 
                        aParent, 
78
 
                        aCommandObserver );
79
 
        CleanupStack::Pop( self );
80
 
        return self;
81
 
        }
 
70
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewL (
 
71
    const TRect& aRect,
 
72
    const CCoeControl* aParent,
 
73
    MEikCommandObserver* aCommandObserver)
 
74
{
 
75
    CSymbian_ua_guiContainer* self = CSymbian_ua_guiContainer::NewLC (
 
76
                                         aRect,
 
77
                                         aParent,
 
78
                                         aCommandObserver);
 
79
    CleanupStack::Pop (self);
 
80
    return self;
 
81
}
82
82
 
83
83
/**
84
84
 * Construct the control (first phase).
89
89
 * @param aCommandObserver command observer
90
90
 * @return new instance of CSymbian_ua_guiContainer
91
91
 */
92
 
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewLC( 
93
 
                const TRect& aRect, 
94
 
                const CCoeControl* aParent, 
95
 
                MEikCommandObserver* aCommandObserver )
96
 
        {
97
 
        CSymbian_ua_guiContainer* self = new ( ELeave ) CSymbian_ua_guiContainer();
98
 
        CleanupStack::PushL( self );
99
 
        self->ConstructL( aRect, aParent, aCommandObserver );
100
 
        return self;
101
 
        }
102
 
                        
 
92
CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewLC (
 
93
    const TRect& aRect,
 
94
    const CCoeControl* aParent,
 
95
    MEikCommandObserver* aCommandObserver)
 
96
{
 
97
    CSymbian_ua_guiContainer* self = new (ELeave) CSymbian_ua_guiContainer();
 
98
    CleanupStack::PushL (self);
 
99
    self->ConstructL (aRect, aParent, aCommandObserver);
 
100
    return self;
 
101
}
 
102
 
103
103
/**
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
109
 
 */ 
110
 
void CSymbian_ua_guiContainer::ConstructL( 
111
 
                const TRect& aRect, 
112
 
                const CCoeControl* aParent, 
113
 
                MEikCommandObserver* aCommandObserver )
114
 
        {
115
 
        if ( aParent == NULL )
116
 
            {
117
 
                CreateWindowL();
118
 
            }
119
 
        else
120
 
            {
121
 
            SetContainerWindowL( *aParent );
122
 
            }
123
 
        iFocusControl = NULL;
124
 
        iCommandObserver = aCommandObserver;
125
 
        InitializeControlsL();
126
 
        SetRect( aRect );
127
 
        ActivateL();
128
 
        // [[[ begin generated region: do not modify [Post-ActivateL initializations]
129
 
        // ]]] end generated region [Post-ActivateL initializations]
130
 
        
131
 
        }
132
 
                        
 
109
 */
 
110
void CSymbian_ua_guiContainer::ConstructL (
 
111
    const TRect& aRect,
 
112
    const CCoeControl* aParent,
 
113
    MEikCommandObserver* aCommandObserver)
 
114
{
 
115
    if (aParent == NULL) {
 
116
        CreateWindowL();
 
117
    } else {
 
118
        SetContainerWindowL (*aParent);
 
119
    }
 
120
 
 
121
    iFocusControl = NULL;
 
122
    iCommandObserver = aCommandObserver;
 
123
    InitializeControlsL();
 
124
    SetRect (aRect);
 
125
    ActivateL();
 
126
    // [[[ begin generated region: do not modify [Post-ActivateL initializations]
 
127
    // ]]] end generated region [Post-ActivateL initializations]
 
128
 
 
129
}
 
130
 
133
131
/**
134
132
* Return the number of controls in the container (override)
135
133
* @return count
136
134
*/
137
135
TInt CSymbian_ua_guiContainer::CountComponentControls() const
138
 
        {
139
 
        return ( int ) ELastControl;
140
 
        }
141
 
                                
 
136
{
 
137
    return (int) ELastControl;
 
138
}
 
139
 
142
140
/**
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
146
144
*/
147
 
CCoeControl* CSymbian_ua_guiContainer::ComponentControl( TInt aIndex ) const
148
 
        {
149
 
        // [[[ begin generated region: do not modify [Generated Contents]
150
 
        switch ( aIndex )
151
 
                {
152
 
                case ELabel1:
153
 
                        return iLabel1;
154
 
                case EEd_url:
155
 
                        return iEd_url;
156
 
                case EEd_info:
157
 
                        return iEd_info;
158
 
                }
159
 
        // ]]] end generated region [Generated Contents]
160
 
        
161
 
        // handle any user controls here...
162
 
        
163
 
        return NULL;
164
 
        }
165
 
                                
 
145
CCoeControl* CSymbian_ua_guiContainer::ComponentControl (TInt aIndex) const
 
146
{
 
147
    // [[[ begin generated region: do not modify [Generated Contents]
 
148
    switch (aIndex) {
 
149
        case ELabel1:
 
150
            return iLabel1;
 
151
        case EEd_url:
 
152
            return iEd_url;
 
153
        case EEd_info:
 
154
            return iEd_info;
 
155
    }
 
156
 
 
157
    // ]]] end generated region [Generated Contents]
 
158
 
 
159
    // handle any user controls here...
 
160
 
 
161
    return NULL;
 
162
}
 
163
 
166
164
/**
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.
172
 
 */                             
 
170
 */
173
171
void CSymbian_ua_guiContainer::SizeChanged()
174
 
        {
175
 
        CCoeControl::SizeChanged();
176
 
        LayoutControls();
177
 
        // [[[ begin generated region: do not modify [Generated Contents]
178
 
                        
179
 
        // ]]] end generated region [Generated Contents]
180
 
        
181
 
        }
182
 
                                
 
172
{
 
173
    CCoeControl::SizeChanged();
 
174
    LayoutControls();
 
175
    // [[[ begin generated region: do not modify [Generated Contents]
 
176
 
 
177
    // ]]] end generated region [Generated Contents]
 
178
 
 
179
}
 
180
 
183
181
// [[[ begin generated function: do not modify
184
182
/**
185
183
 * Layout components as specified in the UI Designer
186
184
 */
187
185
void CSymbian_ua_guiContainer::LayoutControls()
188
 
        {
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 ) );
192
 
        }
 
186
{
 
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));
 
190
}
193
191
// ]]] end generated function
194
192
 
195
193
/**
196
194
 *      Handle key events.
197
 
 */                             
198
 
TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL( 
199
 
                const TKeyEvent& aKeyEvent, 
200
 
                TEventCode aType )
201
 
        {
202
 
        // [[[ begin generated region: do not modify [Generated Contents]
203
 
        
204
 
        // ]]] end generated region [Generated Contents]
205
 
        
206
 
        if ( iFocusControl != NULL
207
 
                && iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
208
 
                {
209
 
                return EKeyWasConsumed;
210
 
                }
211
 
        return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
212
 
        }
213
 
                                
 
195
 */
 
196
TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL (
 
197
    const TKeyEvent& aKeyEvent,
 
198
    TEventCode aType)
 
199
{
 
200
    // [[[ begin generated region: do not modify [Generated Contents]
 
201
 
 
202
    // ]]] end generated region [Generated Contents]
 
203
 
 
204
    if (iFocusControl != NULL
 
205
            && iFocusControl->OfferKeyEventL (aKeyEvent, aType) == EKeyWasConsumed) {
 
206
        return EKeyWasConsumed;
 
207
    }
 
208
 
 
209
    return CCoeControl::OfferKeyEventL (aKeyEvent, aType);
 
210
}
 
211
 
214
212
// [[[ begin generated function: do not modify
215
213
/**
216
214
 *      Initialize each control upon creation.
217
 
 */                             
 
215
 */
218
216
void CSymbian_ua_guiContainer::InitializeControlsL()
219
 
        {
220
 
        iLabel1 = new ( ELeave ) CEikLabel;
221
 
        iLabel1->SetContainerWindowL( *this );
222
 
                {
223
 
                TResourceReader reader;
224
 
                iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1 );
225
 
                iLabel1->ConstructFromResourceL( reader );
226
 
                CleanupStack::PopAndDestroy(); // reader internal state
227
 
                }
228
 
        iEd_url = new ( ELeave ) CEikEdwin;
229
 
        iEd_url->SetContainerWindowL( *this );
230
 
                {
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
235
 
                }
236
 
                {
237
 
                HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2 );
238
 
                iEd_url->SetTextL( text );
239
 
                CleanupStack::PopAndDestroy( text );
240
 
                }
241
 
        iEd_info = new ( ELeave ) CEikEdwin;
242
 
        iEd_info->SetContainerWindowL( *this );
243
 
                {
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
248
 
                }
249
 
                {
250
 
                HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2 );
251
 
                iEd_info->SetTextL( text );
252
 
                CleanupStack::PopAndDestroy( text );
253
 
                }
254
 
        
255
 
        iEd_url->SetFocus( ETrue );
256
 
        iFocusControl = iEd_url;
257
 
        
258
 
        }
 
217
{
 
218
    iLabel1 = new (ELeave) CEikLabel;
 
219
    iLabel1->SetContainerWindowL (*this);
 
220
    {
 
221
        TResourceReader reader;
 
222
        iEikonEnv->CreateResourceReaderLC (reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1);
 
223
        iLabel1->ConstructFromResourceL (reader);
 
224
        CleanupStack::PopAndDestroy(); // reader internal state
 
225
    }
 
226
    iEd_url = new (ELeave) CEikEdwin;
 
227
    iEd_url->SetContainerWindowL (*this);
 
228
    {
 
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
 
233
    }
 
234
    {
 
235
        HBufC* text = StringLoader::LoadLC (R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2);
 
236
        iEd_url->SetTextL (text);
 
237
        CleanupStack::PopAndDestroy (text);
 
238
    }
 
239
    iEd_info = new (ELeave) CEikEdwin;
 
240
    iEd_info->SetContainerWindowL (*this);
 
241
    {
 
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
 
246
    }
 
247
    {
 
248
        HBufC* text = StringLoader::LoadLC (R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2);
 
249
        iEd_info->SetTextL (text);
 
250
        CleanupStack::PopAndDestroy (text);
 
251
    }
 
252
 
 
253
    iEd_url->SetFocus (ETrue);
 
254
    iFocusControl = iEd_url;
 
255
 
 
256
}
259
257
// ]]] end generated function
260
258
 
261
 
/** 
 
259
/**
262
260
 * Handle global resource changes, such as scalable UI or skin events (override)
263
261
 */
264
 
void CSymbian_ua_guiContainer::HandleResourceChange( TInt aType )
265
 
        {
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]
270
 
        
271
 
        }
272
 
                                
 
262
void CSymbian_ua_guiContainer::HandleResourceChange (TInt aType)
 
263
{
 
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]
 
268
 
 
269
}
 
270
 
273
271
/**
274
272
 *      Draw container contents.
275
 
 */                             
276
 
void CSymbian_ua_guiContainer::Draw( const TRect& aRect ) const
277
 
        {
278
 
        // [[[ begin generated region: do not modify [Generated Contents]
279
 
        CWindowGc& gc = SystemGc();
280
 
        gc.Clear( aRect );
281
 
        
282
 
        // ]]] end generated region [Generated Contents]
283
 
        
284
 
        }
285
 
                                
 
273
 */
 
274
void CSymbian_ua_guiContainer::Draw (const TRect& aRect) const
 
275
{
 
276
    // [[[ begin generated region: do not modify [Generated Contents]
 
277
    CWindowGc& gc = SystemGc();
 
278
    gc.Clear (aRect);
 
279
 
 
280
    // ]]] end generated region [Generated Contents]
 
281
 
 
282
}
 
283