diff options
Diffstat (limited to 'pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp')
-rw-r--r-- | pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp | 570 |
1 files changed, 285 insertions, 285 deletions
diff --git a/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp b/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp index 777217c7..1b3cd024 100644 --- a/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp +++ b/pjsip-apps/src/symbian_ua_gui/src/symbian_ua_guiContainer.cpp @@ -1,285 +1,285 @@ -/*
-========================================================================
- Name : symbian_ua_guiContainer.cpp
- Author : nanang
- Copyright : (c) 2008-2009 Teluu Inc.
- Description :
-========================================================================
-*/
-// [[[ begin generated region: do not modify [Generated System Includes]
-#include <barsread.h>
-#include <stringloader.h>
-#include <eiklabel.h>
-#include <eikenv.h>
-#include <gdi.h>
-#include <eikedwin.h>
-#include <aknviewappui.h>
-#include <eikappui.h>
-#include <symbian_ua_gui.rsg>
-// ]]] end generated region [Generated System Includes]
-
-// [[[ begin generated region: do not modify [Generated User Includes]
-#include "symbian_ua_guiContainer.h"
-#include "symbian_ua_guiContainerView.h"
-#include "symbian_ua_gui.hrh"
-#include "symbian_ua_guiContainer.hrh"
-#include "symbian_ua_guiSettingItemList.hrh"
-// ]]] 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.
- */
-CSymbian_ua_guiContainer::CSymbian_ua_guiContainer()
- {
- // [[[ begin generated region: do not modify [Generated Contents]
- iLabel1 = NULL;
- iEd_url = NULL;
- iEd_info = NULL;
- // ]]] end generated region [Generated Contents]
-
- }
-/**
- * Destroy child controls.
- */
-CSymbian_ua_guiContainer::~CSymbian_ua_guiContainer()
- {
- // [[[ begin generated region: do not modify [Generated Contents]
- delete iLabel1;
- iLabel1 = NULL;
- delete iEd_url;
- iEd_url = NULL;
- delete iEd_info;
- iEd_info = NULL;
- // ]]] end generated region [Generated Contents]
-
- }
-
-/**
- * Construct the control (first phase).
- * Creates an instance and initializes it.
- * Instance is not left on cleanup stack.
- * @param aRect bounding rectangle
- * @param aParent owning parent, or NULL
- * @param aCommandObserver command observer
- * @return initialized instance of CSymbian_ua_guiContainer
- */
-CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewL(
- const TRect& aRect,
- const CCoeControl* aParent,
- MEikCommandObserver* aCommandObserver )
- {
- CSymbian_ua_guiContainer* self = CSymbian_ua_guiContainer::NewLC(
- aRect,
- aParent,
- aCommandObserver );
- CleanupStack::Pop( self );
- return self;
- }
-
-/**
- * Construct the control (first phase).
- * Creates an instance and initializes it.
- * Instance is left on cleanup stack.
- * @param aRect The rectangle for this window
- * @param aParent owning parent, or NULL
- * @param aCommandObserver command observer
- * @return new instance of CSymbian_ua_guiContainer
- */
-CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewLC(
- const TRect& aRect,
- const CCoeControl* aParent,
- MEikCommandObserver* aCommandObserver )
- {
- CSymbian_ua_guiContainer* self = new ( ELeave ) CSymbian_ua_guiContainer();
- CleanupStack::PushL( self );
- self->ConstructL( aRect, aParent, aCommandObserver );
- return self;
- }
-
-/**
- * Construct the control (second phase).
- * Creates a window to contain the controls and activates it.
- * @param aRect bounding rectangle
- * @param aCommandObserver command observer
- * @param aParent owning parent, or NULL
- */
-void CSymbian_ua_guiContainer::ConstructL(
- const TRect& aRect,
- const CCoeControl* aParent,
- MEikCommandObserver* aCommandObserver )
- {
- if ( aParent == NULL )
- {
- CreateWindowL();
- }
- else
- {
- SetContainerWindowL( *aParent );
- }
- iFocusControl = NULL;
- iCommandObserver = aCommandObserver;
- InitializeControlsL();
- SetRect( aRect );
- ActivateL();
- // [[[ begin generated region: do not modify [Post-ActivateL initializations]
- // ]]] end generated region [Post-ActivateL initializations]
-
- }
-
-/**
-* Return the number of controls in the container (override)
-* @return count
-*/
-TInt CSymbian_ua_guiContainer::CountComponentControls() const
- {
- return ( int ) ELastControl;
- }
-
-/**
-* Get the control with the given index (override)
-* @param aIndex Control index [0...n) (limited by #CountComponentControls)
-* @return Pointer to control
-*/
-CCoeControl* CSymbian_ua_guiContainer::ComponentControl( TInt aIndex ) const
- {
- // [[[ begin generated region: do not modify [Generated Contents]
- switch ( aIndex )
- {
- case ELabel1:
- return iLabel1;
- case EEd_url:
- return iEd_url;
- case EEd_info:
- return iEd_info;
- }
- // ]]] end generated region [Generated Contents]
-
- // handle any user controls here...
-
- return NULL;
- }
-
-/**
- * Handle resizing of the container. This implementation will lay out
- * full-sized controls like list boxes for any screen size, and will layout
- * labels, editors, etc. to the size they were given in the UI designer.
- * This code will need to be modified to adjust arbitrary controls to
- * any screen size.
- */
-void CSymbian_ua_guiContainer::SizeChanged()
- {
- CCoeControl::SizeChanged();
- LayoutControls();
- // [[[ begin generated region: do not modify [Generated Contents]
-
- // ]]] end generated region [Generated Contents]
-
- }
-
-// [[[ begin generated function: do not modify
-/**
- * Layout components as specified in the UI Designer
- */
-void CSymbian_ua_guiContainer::LayoutControls()
- {
- iLabel1->SetExtent( TPoint( 2, 23 ), TSize( 32, 28 ) );
- iEd_url->SetExtent( TPoint( 49, 25 ), TSize( 197, 28 ) );
- iEd_info->SetExtent( TPoint( 3, 78 ), TSize( 235, 143 ) );
- }
-// ]]] end generated function
-
-/**
- * Handle key events.
- */
-TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL(
- const TKeyEvent& aKeyEvent,
- TEventCode aType )
- {
- // [[[ begin generated region: do not modify [Generated Contents]
-
- // ]]] end generated region [Generated Contents]
-
- if ( iFocusControl != NULL
- && iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
- {
- return EKeyWasConsumed;
- }
- return CCoeControl::OfferKeyEventL( aKeyEvent, aType );
- }
-
-// [[[ begin generated function: do not modify
-/**
- * Initialize each control upon creation.
- */
-void CSymbian_ua_guiContainer::InitializeControlsL()
- {
- iLabel1 = new ( ELeave ) CEikLabel;
- iLabel1->SetContainerWindowL( *this );
- {
- TResourceReader reader;
- iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1 );
- iLabel1->ConstructFromResourceL( reader );
- CleanupStack::PopAndDestroy(); // reader internal state
- }
- iEd_url = new ( ELeave ) CEikEdwin;
- iEd_url->SetContainerWindowL( *this );
- {
- TResourceReader reader;
- iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_URL );
- iEd_url->ConstructFromResourceL( reader );
- CleanupStack::PopAndDestroy(); // reader internal state
- }
- {
- HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2 );
- iEd_url->SetTextL( text );
- CleanupStack::PopAndDestroy( text );
- }
- iEd_info = new ( ELeave ) CEikEdwin;
- iEd_info->SetContainerWindowL( *this );
- {
- TResourceReader reader;
- iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO );
- iEd_info->ConstructFromResourceL( reader );
- CleanupStack::PopAndDestroy(); // reader internal state
- }
- {
- HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2 );
- iEd_info->SetTextL( text );
- CleanupStack::PopAndDestroy( text );
- }
-
- iEd_url->SetFocus( ETrue );
- iFocusControl = iEd_url;
-
- }
-// ]]] end generated function
-
-/**
- * Handle global resource changes, such as scalable UI or skin events (override)
- */
-void CSymbian_ua_guiContainer::HandleResourceChange( TInt aType )
- {
- CCoeControl::HandleResourceChange( aType );
- SetRect( iAvkonViewAppUi->View( TUid::Uid( ESymbian_ua_guiContainerViewId ) )->ClientRect() );
- // [[[ begin generated region: do not modify [Generated Contents]
- // ]]] end generated region [Generated Contents]
-
- }
-
-/**
- * Draw container contents.
- */
-void CSymbian_ua_guiContainer::Draw( const TRect& aRect ) const
- {
- // [[[ begin generated region: do not modify [Generated Contents]
- CWindowGc& gc = SystemGc();
- gc.Clear( aRect );
-
- // ]]] end generated region [Generated Contents]
-
- }
-
+/* +======================================================================== + Name : symbian_ua_guiContainer.cpp + Author : nanang + Copyright : (c) 2008-2009 Teluu Inc. + Description : +======================================================================== +*/ +// [[[ begin generated region: do not modify [Generated System Includes] +#include <barsread.h> +#include <stringloader.h> +#include <eiklabel.h> +#include <eikenv.h> +#include <gdi.h> +#include <eikedwin.h> +#include <aknviewappui.h> +#include <eikappui.h> +#include <symbian_ua_gui.rsg> +// ]]] end generated region [Generated System Includes] + +// [[[ begin generated region: do not modify [Generated User Includes] +#include "symbian_ua_guiContainer.h" +#include "symbian_ua_guiContainerView.h" +#include "symbian_ua_gui.hrh" +#include "symbian_ua_guiContainer.hrh" +#include "symbian_ua_guiSettingItemList.hrh" +// ]]] 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. + */ +CSymbian_ua_guiContainer::CSymbian_ua_guiContainer() + { + // [[[ begin generated region: do not modify [Generated Contents] + iLabel1 = NULL; + iEd_url = NULL; + iEd_info = NULL; + // ]]] end generated region [Generated Contents] + + } +/** + * Destroy child controls. + */ +CSymbian_ua_guiContainer::~CSymbian_ua_guiContainer() + { + // [[[ begin generated region: do not modify [Generated Contents] + delete iLabel1; + iLabel1 = NULL; + delete iEd_url; + iEd_url = NULL; + delete iEd_info; + iEd_info = NULL; + // ]]] end generated region [Generated Contents] + + } + +/** + * Construct the control (first phase). + * Creates an instance and initializes it. + * Instance is not left on cleanup stack. + * @param aRect bounding rectangle + * @param aParent owning parent, or NULL + * @param aCommandObserver command observer + * @return initialized instance of CSymbian_ua_guiContainer + */ +CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewL( + const TRect& aRect, + const CCoeControl* aParent, + MEikCommandObserver* aCommandObserver ) + { + CSymbian_ua_guiContainer* self = CSymbian_ua_guiContainer::NewLC( + aRect, + aParent, + aCommandObserver ); + CleanupStack::Pop( self ); + return self; + } + +/** + * Construct the control (first phase). + * Creates an instance and initializes it. + * Instance is left on cleanup stack. + * @param aRect The rectangle for this window + * @param aParent owning parent, or NULL + * @param aCommandObserver command observer + * @return new instance of CSymbian_ua_guiContainer + */ +CSymbian_ua_guiContainer* CSymbian_ua_guiContainer::NewLC( + const TRect& aRect, + const CCoeControl* aParent, + MEikCommandObserver* aCommandObserver ) + { + CSymbian_ua_guiContainer* self = new ( ELeave ) CSymbian_ua_guiContainer(); + CleanupStack::PushL( self ); + self->ConstructL( aRect, aParent, aCommandObserver ); + return self; + } + +/** + * Construct the control (second phase). + * Creates a window to contain the controls and activates it. + * @param aRect bounding rectangle + * @param aCommandObserver command observer + * @param aParent owning parent, or NULL + */ +void CSymbian_ua_guiContainer::ConstructL( + const TRect& aRect, + const CCoeControl* aParent, + MEikCommandObserver* aCommandObserver ) + { + if ( aParent == NULL ) + { + CreateWindowL(); + } + else + { + SetContainerWindowL( *aParent ); + } + iFocusControl = NULL; + iCommandObserver = aCommandObserver; + InitializeControlsL(); + SetRect( aRect ); + ActivateL(); + // [[[ begin generated region: do not modify [Post-ActivateL initializations] + // ]]] end generated region [Post-ActivateL initializations] + + } + +/** +* Return the number of controls in the container (override) +* @return count +*/ +TInt CSymbian_ua_guiContainer::CountComponentControls() const + { + return ( int ) ELastControl; + } + +/** +* Get the control with the given index (override) +* @param aIndex Control index [0...n) (limited by #CountComponentControls) +* @return Pointer to control +*/ +CCoeControl* CSymbian_ua_guiContainer::ComponentControl( TInt aIndex ) const + { + // [[[ begin generated region: do not modify [Generated Contents] + switch ( aIndex ) + { + case ELabel1: + return iLabel1; + case EEd_url: + return iEd_url; + case EEd_info: + return iEd_info; + } + // ]]] end generated region [Generated Contents] + + // handle any user controls here... + + return NULL; + } + +/** + * Handle resizing of the container. This implementation will lay out + * full-sized controls like list boxes for any screen size, and will layout + * labels, editors, etc. to the size they were given in the UI designer. + * This code will need to be modified to adjust arbitrary controls to + * any screen size. + */ +void CSymbian_ua_guiContainer::SizeChanged() + { + CCoeControl::SizeChanged(); + LayoutControls(); + // [[[ begin generated region: do not modify [Generated Contents] + + // ]]] end generated region [Generated Contents] + + } + +// [[[ begin generated function: do not modify +/** + * Layout components as specified in the UI Designer + */ +void CSymbian_ua_guiContainer::LayoutControls() + { + iLabel1->SetExtent( TPoint( 2, 23 ), TSize( 32, 28 ) ); + iEd_url->SetExtent( TPoint( 49, 25 ), TSize( 197, 28 ) ); + iEd_info->SetExtent( TPoint( 3, 78 ), TSize( 235, 143 ) ); + } +// ]]] end generated function + +/** + * Handle key events. + */ +TKeyResponse CSymbian_ua_guiContainer::OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + // [[[ begin generated region: do not modify [Generated Contents] + + // ]]] end generated region [Generated Contents] + + if ( iFocusControl != NULL + && iFocusControl->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed ) + { + return EKeyWasConsumed; + } + return CCoeControl::OfferKeyEventL( aKeyEvent, aType ); + } + +// [[[ begin generated function: do not modify +/** + * Initialize each control upon creation. + */ +void CSymbian_ua_guiContainer::InitializeControlsL() + { + iLabel1 = new ( ELeave ) CEikLabel; + iLabel1->SetContainerWindowL( *this ); + { + TResourceReader reader; + iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_LABEL1 ); + iLabel1->ConstructFromResourceL( reader ); + CleanupStack::PopAndDestroy(); // reader internal state + } + iEd_url = new ( ELeave ) CEikEdwin; + iEd_url->SetContainerWindowL( *this ); + { + TResourceReader reader; + iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_URL ); + iEd_url->ConstructFromResourceL( reader ); + CleanupStack::PopAndDestroy(); // reader internal state + } + { + HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_URL_2 ); + iEd_url->SetTextL( text ); + CleanupStack::PopAndDestroy( text ); + } + iEd_info = new ( ELeave ) CEikEdwin; + iEd_info->SetContainerWindowL( *this ); + { + TResourceReader reader; + iEikonEnv->CreateResourceReaderLC( reader, R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO ); + iEd_info->ConstructFromResourceL( reader ); + CleanupStack::PopAndDestroy(); // reader internal state + } + { + HBufC* text = StringLoader::LoadLC( R_SYMBIAN_UA_GUI_CONTAINER_ED_INFO_2 ); + iEd_info->SetTextL( text ); + CleanupStack::PopAndDestroy( text ); + } + + iEd_url->SetFocus( ETrue ); + iFocusControl = iEd_url; + + } +// ]]] end generated function + +/** + * Handle global resource changes, such as scalable UI or skin events (override) + */ +void CSymbian_ua_guiContainer::HandleResourceChange( TInt aType ) + { + CCoeControl::HandleResourceChange( aType ); + SetRect( iAvkonViewAppUi->View( TUid::Uid( ESymbian_ua_guiContainerViewId ) )->ClientRect() ); + // [[[ begin generated region: do not modify [Generated Contents] + // ]]] end generated region [Generated Contents] + + } + +/** + * Draw container contents. + */ +void CSymbian_ua_guiContainer::Draw( const TRect& aRect ) const + { + // [[[ begin generated region: do not modify [Generated Contents] + CWindowGc& gc = SystemGc(); + gc.Clear( aRect ); + + // ]]] end generated region [Generated Contents] + + } + |