📄 mpeg4decodercontainer.cpp
字号:
/*
========================================================================
Name : Mpeg4DecoderContainer.cpp
Author : Jin
Copyright : Copyright (C) 2005-2008 Cyansoft Studio, All rights Reserved.
Description :
========================================================================
*/
// [[[ begin generated region: do not modify [Generated System Includes]
#include <aknviewappui.h>
#include <eikappui.h>
#include <Mpeg4Decoder.rsg>
// ]]] end generated region [Generated System Includes]
// [[[ begin generated region: do not modify [Generated User Includes]
#include "Mpeg4DecoderContainer.h"
#include "Mpeg4DecoderContainerView.h"
#include "Mpeg4Decoder.hrh"
#include "Mpeg4DecoderContainer.hrh"
// ]]] end generated region [Generated User Includes]
// [[[ begin generated region: do not modify [Generated Constants]
// ]]] end generated region [Generated Constants]
#include <Mpeg4DecoderLogo.mbg>
#include <aknutils.h>
/**
* First phase of Symbian two-phase construction. Should not
* contain any code that could leave.
*/
CMpeg4DecoderContainer::CMpeg4DecoderContainer()
{
// [[[ begin generated region: do not modify [Generated Contents]
// ]]] end generated region [Generated Contents]
}
/**
* Destroy child controls.
*/
CMpeg4DecoderContainer::~CMpeg4DecoderContainer()
{
// [[[ begin generated region: do not modify [Generated Contents]
// ]]] end generated region [Generated Contents]
if( iLogo )
delete iLogo;
}
/**
* 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 CMpeg4DecoderContainer
*/
CMpeg4DecoderContainer* CMpeg4DecoderContainer::NewL(
const TRect& aRect,
const CCoeControl* aParent,
MEikCommandObserver* aCommandObserver )
{
CMpeg4DecoderContainer* self = CMpeg4DecoderContainer::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 CMpeg4DecoderContainer
*/
CMpeg4DecoderContainer* CMpeg4DecoderContainer::NewLC(
const TRect& aRect,
const CCoeControl* aParent,
MEikCommandObserver* aCommandObserver )
{
CMpeg4DecoderContainer* self = new ( ELeave ) CMpeg4DecoderContainer();
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 CMpeg4DecoderContainer::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]
_LIT( KMbmFileLogo, "\\resource\\apps\\Mpeg4DecoderLogo.mbm" );
iLogo = new ( ELeave ) CFbsBitmap();
CleanupStack::PushL( iLogo );
TFileName aFile( KMbmFileLogo );
User::LeaveIfError( CompleteWithAppPath( aFile ) );
User::LeaveIfError( iLogo->Load( aFile, EMbmMpeg4decoderlogoLogo ) );
CleanupStack::Pop( iLogo );
}
/**
* Return the number of controls in the container (override)
* @return count
*/
TInt CMpeg4DecoderContainer::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* CMpeg4DecoderContainer::ComponentControl( TInt aIndex ) const
{
// [[[ begin generated region: do not modify [Generated Contents]
switch ( aIndex )
{
}
// ]]] 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 CMpeg4DecoderContainer::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 CMpeg4DecoderContainer::LayoutControls()
{
}
// ]]] end generated function
/**
* Handle key events.
*/
TKeyResponse CMpeg4DecoderContainer::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 CMpeg4DecoderContainer::InitializeControlsL()
{
}
// ]]] end generated function
/**
* Handle global resource changes, such as scalable UI or skin events (override)
*/
void CMpeg4DecoderContainer::HandleResourceChange( TInt aType )
{
CCoeControl::HandleResourceChange( aType );
SetRect( iAvkonViewAppUi->View( TUid::Uid( EMpeg4DecoderContainerViewId ) )->ClientRect() );
// [[[ begin generated region: do not modify [Generated Contents]
// ]]] end generated region [Generated Contents]
}
/**
* Draw container contents.
*/
void CMpeg4DecoderContainer::Draw( const TRect& aRect ) const
{
// [[[ begin generated region: do not modify [Generated Contents]
CWindowGc& gc = SystemGc();
gc.Clear( aRect );
// ]]] end generated region [Generated Contents]
TRect aClient = Rect();
TSize aLogoSize = iLogo->SizeInPixels();
TUint aX = aClient.iTl.iX + (aClient.Width() - aLogoSize.iWidth)/2;
TUint aY = aClient.iTl.iY + (aClient.Height() - aLogoSize.iHeight)/2;
TPoint aPos(aX, aY);
gc.BitBlt( aPos, iLogo );
}
RWindow& CMpeg4DecoderContainer::GetWindow()
{
return Window();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -