~ubuntu-branches/ubuntu/raring/sflphone/raring

« 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: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2011-11-25 13:24:12 UTC
  • mfrom: (4.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20111125132412-dc4qvhyosk74cd42
Tags: 1.0.1-4
Don't assume that arch:all packages will get built (closes: #649726)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
========================================================================
3
 
 Name        : symbian_ua_guiContainer.cpp
4
 
 Author      : nanang
5
 
 Copyright   : (c) 2008-2009 Teluu Inc.
6
 
 Description :
7
 
========================================================================
8
 
*/
9
 
// [[[ begin generated region: do not modify [Generated System Includes]
10
 
#include <barsread.h>
11
 
#include <stringloader.h>
12
 
#include <eiklabel.h>
13
 
#include <eikenv.h>
14
 
#include <gdi.h>
15
 
#include <eikedwin.h>
16
 
#include <aknviewappui.h>
17
 
#include <eikappui.h>
18
 
#include <symbian_ua_gui.rsg>
19
 
// ]]] end generated region [Generated System Includes]
20
 
 
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]
28
 
 
29
 
// [[[ begin generated region: do not modify [Generated Constants]
30
 
// ]]] end generated region [Generated Constants]
31
 
 
32
 
/**
33
 
 * First phase of Symbian two-phase construction. Should not
34
 
 * contain any code that could leave.
35
 
 */
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
 
/**
46
 
 * Destroy child controls.
47
 
 */
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
 
 
61
 
/**
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
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
 
}
82
 
 
83
 
/**
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
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
 
 
103
 
/**
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
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
 
 
131
 
/**
132
 
* Return the number of controls in the container (override)
133
 
* @return count
134
 
*/
135
 
TInt CSymbian_ua_guiContainer::CountComponentControls() const
136
 
{
137
 
    return (int) ELastControl;
138
 
}
139
 
 
140
 
/**
141
 
* Get the control with the given index (override)
142
 
* @param aIndex Control index [0...n) (limited by #CountComponentControls)
143
 
* @return Pointer to control
144
 
*/
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
 
 
164
 
/**
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
169
 
 *  any screen size.
170
 
 */
171
 
void CSymbian_ua_guiContainer::SizeChanged()
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
 
 
181
 
// [[[ begin generated function: do not modify
182
 
/**
183
 
 * Layout components as specified in the UI Designer
184
 
 */
185
 
void CSymbian_ua_guiContainer::LayoutControls()
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
 
}
191
 
// ]]] end generated function
192
 
 
193
 
/**
194
 
 *      Handle key events.
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
 
 
212
 
// [[[ begin generated function: do not modify
213
 
/**
214
 
 *      Initialize each control upon creation.
215
 
 */
216
 
void CSymbian_ua_guiContainer::InitializeControlsL()
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
 
}
257
 
// ]]] end generated function
258
 
 
259
 
/**
260
 
 * Handle global resource changes, such as scalable UI or skin events (override)
261
 
 */
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
 
 
271
 
/**
272
 
 *      Draw container contents.
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