diff options
Diffstat (limited to 'pjsip-apps/src/pjsua/symbian/src/PjsuaContainerView.cpp')
-rw-r--r-- | pjsip-apps/src/pjsua/symbian/src/PjsuaContainerView.cpp | 261 |
1 files changed, 261 insertions, 0 deletions
diff --git a/pjsip-apps/src/pjsua/symbian/src/PjsuaContainerView.cpp b/pjsip-apps/src/pjsua/symbian/src/PjsuaContainerView.cpp new file mode 100644 index 00000000..8595260f --- /dev/null +++ b/pjsip-apps/src/pjsua/symbian/src/PjsuaContainerView.cpp @@ -0,0 +1,261 @@ +/* +======================================================================== + Name : PjsuaContainerView.cpp + Author : nanang + Copyright : Copyright (C) 2013 Teluu Inc. (http://www.teluu.com) + Description : +======================================================================== +*/ +// [[[ begin generated region: do not modify [Generated System Includes] +#include <aknviewappui.h> +#include <eikmenub.h> +#include <avkon.hrh> +#include <barsread.h> +#include <eikimage.h> +#include <eikenv.h> +#include <stringloader.h> +#include <eiklabel.h> +#include <akncontext.h> +#include <akntitle.h> +#include <eikbtgpc.h> +#include <pjsua.rsg> +// ]]] end generated region [Generated System Includes] + +// [[[ begin generated region: do not modify [Generated User Includes] + +#include "pjsua.hrh" +#include "pjsuaContainerView.h" +#include "pjsuaContainer.h" +// ]]] end generated region [Generated User Includes] + +// [[[ begin generated region: do not modify [Generated Constants] +// ]]] end generated region [Generated Constants] + +/** + * First phase of Symbian two-phase construction. Should not contain any + * code that could leave. + */ +CpjsuaContainerView::CpjsuaContainerView() + { + // [[[ begin generated region: do not modify [Generated Contents] + iPjsuaContainer = NULL; + // ]]] end generated region [Generated Contents] + + } + +/** + * The view's destructor removes the container from the control + * stack and destroys it. + */ +CpjsuaContainerView::~CpjsuaContainerView() + { + // [[[ begin generated region: do not modify [Generated Contents] + delete iPjsuaContainer; + iPjsuaContainer = NULL; + // ]]] end generated region [Generated Contents] + + } + +/** + * Symbian two-phase constructor. + * This creates an instance then calls the second-phase constructor + * without leaving the instance on the cleanup stack. + * @return new instance of CpjsuaContainerView + */ +CpjsuaContainerView* CpjsuaContainerView::NewL() + { + CpjsuaContainerView* self = CpjsuaContainerView::NewLC(); + CleanupStack::Pop( self ); + return self; + } + +/** + * Symbian two-phase constructor. + * This creates an instance, pushes it on the cleanup stack, + * then calls the second-phase constructor. + * @return new instance of CpjsuaContainerView + */ +CpjsuaContainerView* CpjsuaContainerView::NewLC() + { + CpjsuaContainerView* self = new ( ELeave ) CpjsuaContainerView(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +/** + * Second-phase constructor for view. + * Initialize contents from resource. + */ +void CpjsuaContainerView::ConstructL() + { + // [[[ begin generated region: do not modify [Generated Code] + BaseConstructL( R_PJSUA_CONTAINER_PJSUA_CONTAINER_VIEW ); + + // ]]] end generated region [Generated Code] + + // add your own initialization code here + } + +/** + * @return The UID for this view + */ +TUid CpjsuaContainerView::Id() const + { + return TUid::Uid( EPjsuaContainerViewId ); + } + +/** + * Handle a command for this view (override) + * @param aCommand command id to be handled + */ +void CpjsuaContainerView::HandleCommandL( TInt aCommand ) + { + // [[[ begin generated region: do not modify [Generated Code] + TBool commandHandled = EFalse; + switch ( aCommand ) + { // code to dispatch to the AknView's menu and CBA commands is generated here + default: + break; + } + + + if ( !commandHandled ) + { + + if ( aCommand == EAknSoftkeyBack ) + { + AppUi()->HandleCommandL( EEikCmdExit ); + } + + } + // ]]] end generated region [Generated Code] + + } + +/** + * Handles user actions during activation of the view, + * such as initializing the content. + */ +void CpjsuaContainerView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/ ) + { + // [[[ begin generated region: do not modify [Generated Contents] + SetupStatusPaneL(); + + + + + if ( iPjsuaContainer == NULL ) + { + iPjsuaContainer = CreateContainerL(); + iPjsuaContainer->SetMopParent( this ); + AppUi()->AddToStackL( *this, iPjsuaContainer ); + } + // ]]] end generated region [Generated Contents] + + } + +/** + */ +void CpjsuaContainerView::DoDeactivate() + { + // [[[ begin generated region: do not modify [Generated Contents] + CleanupStatusPane(); + + if ( iPjsuaContainer != NULL ) + { + AppUi()->RemoveFromViewStack( *this, iPjsuaContainer ); + delete iPjsuaContainer; + iPjsuaContainer = NULL; + } + // ]]] end generated region [Generated Contents] + + } + +/** + * Handle status pane size change for this view (override) + */ +void CpjsuaContainerView::HandleStatusPaneSizeChange() + { + CAknView::HandleStatusPaneSizeChange(); + + // this may fail, but we're not able to propagate exceptions here + TVwsViewId view; + AppUi()->GetActiveViewId( view ); + if ( view.iViewUid == Id() ) + { + TInt result; + TRAP( result, SetupStatusPaneL() ); + } + + // Hide menu + Cba()->MakeVisible(EFalse); + + //PutMessage("HandleStatusPaneSizeChange()"); + + // [[[ begin generated region: do not modify [Generated Code] + // ]]] end generated region [Generated Code] + + } + +// [[[ begin generated function: do not modify +void CpjsuaContainerView::SetupStatusPaneL() + { + // reset the context pane + TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext ); + CEikStatusPaneBase::TPaneCapabilities subPaneContext = + StatusPane()->PaneCapabilities( contextPaneUid ); + if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() ) + { + CAknContextPane* context = static_cast< CAknContextPane* > ( + StatusPane()->ControlL( contextPaneUid ) ); + context->SetPictureToDefaultL(); + } + + // setup the title pane + TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle ); + CEikStatusPaneBase::TPaneCapabilities subPaneTitle = + StatusPane()->PaneCapabilities( titlePaneUid ); + if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) + { + CAknTitlePane* title = static_cast< CAknTitlePane* >( + StatusPane()->ControlL( titlePaneUid ) ); + TResourceReader reader; + iEikonEnv->CreateResourceReaderLC( reader, R_PJSUA_CONTAINER_TITLE_RESOURCE ); + title->SetFromResourceL( reader ); + CleanupStack::PopAndDestroy(); // reader internal state + } + + } + +// ]]] end generated function + +// [[[ begin generated function: do not modify +void CpjsuaContainerView::CleanupStatusPane() + { + } + +// ]]] end generated function + +/** + * Creates the top-level container for the view. You may modify this method's + * contents and the CPjsuaContainer::NewL() signature as needed to initialize the + * container, but the signature for this method is fixed. + * @return new initialized instance of CPjsuaContainer + */ +CPjsuaContainer* CpjsuaContainerView::CreateContainerL() + { + return CPjsuaContainer::NewL( ClientRect(), NULL, this ); + } + +void CpjsuaContainerView::PutMessage( const char *msg ) +{ + if (!iPjsuaContainer) + return; + + TRAPD(result, iPjsuaContainer->PutMessageL(msg)); +} |