2
========================================================================
3
Name : PjsuaContainerView.cpp
5
Copyright : Copyright (C) 2013 Teluu Inc. (http://www.teluu.com)
7
========================================================================
9
// [[[ begin generated region: do not modify [Generated System Includes]
10
#include <aknviewappui.h>
16
#include <stringloader.h>
18
#include <akncontext.h>
22
// ]]] end generated region [Generated System Includes]
24
// [[[ begin generated region: do not modify [Generated User Includes]
27
#include "pjsuaContainerView.h"
28
#include "pjsuaContainer.h"
29
// ]]] end generated region [Generated User Includes]
31
// [[[ begin generated region: do not modify [Generated Constants]
32
// ]]] end generated region [Generated Constants]
35
* First phase of Symbian two-phase construction. Should not contain any
36
* code that could leave.
38
CpjsuaContainerView::CpjsuaContainerView()
40
// [[[ begin generated region: do not modify [Generated Contents]
41
iPjsuaContainer = NULL;
42
// ]]] end generated region [Generated Contents]
47
* The view's destructor removes the container from the control
48
* stack and destroys it.
50
CpjsuaContainerView::~CpjsuaContainerView()
52
// [[[ begin generated region: do not modify [Generated Contents]
53
delete iPjsuaContainer;
54
iPjsuaContainer = NULL;
55
// ]]] end generated region [Generated Contents]
60
* Symbian two-phase constructor.
61
* This creates an instance then calls the second-phase constructor
62
* without leaving the instance on the cleanup stack.
63
* @return new instance of CpjsuaContainerView
65
CpjsuaContainerView* CpjsuaContainerView::NewL()
67
CpjsuaContainerView* self = CpjsuaContainerView::NewLC();
68
CleanupStack::Pop( self );
73
* Symbian two-phase constructor.
74
* This creates an instance, pushes it on the cleanup stack,
75
* then calls the second-phase constructor.
76
* @return new instance of CpjsuaContainerView
78
CpjsuaContainerView* CpjsuaContainerView::NewLC()
80
CpjsuaContainerView* self = new ( ELeave ) CpjsuaContainerView();
81
CleanupStack::PushL( self );
88
* Second-phase constructor for view.
89
* Initialize contents from resource.
91
void CpjsuaContainerView::ConstructL()
93
// [[[ begin generated region: do not modify [Generated Code]
94
BaseConstructL( R_PJSUA_CONTAINER_PJSUA_CONTAINER_VIEW );
96
// ]]] end generated region [Generated Code]
98
// add your own initialization code here
102
* @return The UID for this view
104
TUid CpjsuaContainerView::Id() const
106
return TUid::Uid( EPjsuaContainerViewId );
110
* Handle a command for this view (override)
111
* @param aCommand command id to be handled
113
void CpjsuaContainerView::HandleCommandL( TInt aCommand )
115
// [[[ begin generated region: do not modify [Generated Code]
116
TBool commandHandled = EFalse;
118
{ // code to dispatch to the AknView's menu and CBA commands is generated here
124
if ( !commandHandled )
127
if ( aCommand == EAknSoftkeyBack )
129
AppUi()->HandleCommandL( EEikCmdExit );
133
// ]]] end generated region [Generated Code]
138
* Handles user actions during activation of the view,
139
* such as initializing the content.
141
void CpjsuaContainerView::DoActivateL(
142
const TVwsViewId& /*aPrevViewId*/,
143
TUid /*aCustomMessageId*/,
144
const TDesC8& /*aCustomMessage*/ )
146
// [[[ begin generated region: do not modify [Generated Contents]
152
if ( iPjsuaContainer == NULL )
154
iPjsuaContainer = CreateContainerL();
155
iPjsuaContainer->SetMopParent( this );
156
AppUi()->AddToStackL( *this, iPjsuaContainer );
158
// ]]] end generated region [Generated Contents]
164
void CpjsuaContainerView::DoDeactivate()
166
// [[[ begin generated region: do not modify [Generated Contents]
169
if ( iPjsuaContainer != NULL )
171
AppUi()->RemoveFromViewStack( *this, iPjsuaContainer );
172
delete iPjsuaContainer;
173
iPjsuaContainer = NULL;
175
// ]]] end generated region [Generated Contents]
180
* Handle status pane size change for this view (override)
182
void CpjsuaContainerView::HandleStatusPaneSizeChange()
184
CAknView::HandleStatusPaneSizeChange();
186
// this may fail, but we're not able to propagate exceptions here
188
AppUi()->GetActiveViewId( view );
189
if ( view.iViewUid == Id() )
192
TRAP( result, SetupStatusPaneL() );
196
Cba()->MakeVisible(EFalse);
198
//PutMessage("HandleStatusPaneSizeChange()");
200
// [[[ begin generated region: do not modify [Generated Code]
201
// ]]] end generated region [Generated Code]
205
// [[[ begin generated function: do not modify
206
void CpjsuaContainerView::SetupStatusPaneL()
208
// reset the context pane
209
TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext );
210
CEikStatusPaneBase::TPaneCapabilities subPaneContext =
211
StatusPane()->PaneCapabilities( contextPaneUid );
212
if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() )
214
CAknContextPane* context = static_cast< CAknContextPane* > (
215
StatusPane()->ControlL( contextPaneUid ) );
216
context->SetPictureToDefaultL();
219
// setup the title pane
220
TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle );
221
CEikStatusPaneBase::TPaneCapabilities subPaneTitle =
222
StatusPane()->PaneCapabilities( titlePaneUid );
223
if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() )
225
CAknTitlePane* title = static_cast< CAknTitlePane* >(
226
StatusPane()->ControlL( titlePaneUid ) );
227
TResourceReader reader;
228
iEikonEnv->CreateResourceReaderLC( reader, R_PJSUA_CONTAINER_TITLE_RESOURCE );
229
title->SetFromResourceL( reader );
230
CleanupStack::PopAndDestroy(); // reader internal state
235
// ]]] end generated function
237
// [[[ begin generated function: do not modify
238
void CpjsuaContainerView::CleanupStatusPane()
242
// ]]] end generated function
245
* Creates the top-level container for the view. You may modify this method's
246
* contents and the CPjsuaContainer::NewL() signature as needed to initialize the
247
* container, but the signature for this method is fixed.
248
* @return new initialized instance of CPjsuaContainer
250
CPjsuaContainer* CpjsuaContainerView::CreateContainerL()
252
return CPjsuaContainer::NewL( ClientRect(), NULL, this );
255
void CpjsuaContainerView::PutMessage( const char *msg )
257
if (!iPjsuaContainer)
260
TRAPD(result, iPjsuaContainer->PutMessageL(msg));