📄 encoderselectiondialog.cpp
字号:
/*
* ============================================================================
* Name : CEncoderSelectionDialog from EncoderSelectionDialog.cpp
* Part of : ImageConverter
* Created : 25.11.2003 Forum Nokia
* Description:
* Used to select encoding format.
* Version :
* Copyright: Nokia Corporation
* ============================================================================
*/
// INCLUDE FILES
#include <aknlists.h>
#include <ImageConversion.h>
#include "ImageConverter.hrh"
#include "EncoderSelectionDialog.h"
#include "ImageConverterEngine.h"
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CEncoderSelectionDialog::CEncoderSelectionDialog(
RImageTypeDescriptionArray& aImageTypes,
TInt& aSelectedIdx ) :
iImageTypes( aImageTypes ), iSelectedIdx( aSelectedIdx )
{
}
CEncoderSelectionDialog::~CEncoderSelectionDialog()
{
delete iListBox;
}
// ----------------------------------------------------------
// CEncoderSelectionDialog::PreLayoutDynInitL()
// Initializing the dialog dynamically
// ----------------------------------------------------------
//
void CEncoderSelectionDialog::PreLayoutDynInitL()
{
SetEditableL(ETrue);
// Create a control to display a list of messages
iListBox = new (ELeave) CAknSingleStyleListBox;
iListBox->SetContainerWindowL(*this);
iListBox->ConstructL(this, 0);
iListBox->ActivateL();
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->
SetScrollBarVisibilityL(CEikScrollBarFrame::EOn,
CEikScrollBarFrame::EAuto);
// Create an array to hold the messages
iMessageList = new (ELeave) CDesCArrayFlat(10);
// Give it to the control
CTextListBoxModel* model = iListBox->Model();
model->SetItemTextArray(iMessageList);
model->SetOwnershipType(ELbmOwnsItemArray); // transfer ownership
}
void CEncoderSelectionDialog::PostLayoutDynInitL()
{
// add the message to the list
iListBox->SetRect( Rect() );
_LIT( KTab, "\t" );
for( TInt i=0; i<iImageTypes.Count(); i++ ) {
TBuf<80> desc;
desc.Append( KTab );
desc.Append( iImageTypes[i]->Description() );
iMessageList->AppendL( desc );
}
// tell the control about the change
iListBox->HandleItemAdditionL();
}
// ----------------------------------------------------------
// CEncoderSelectionDialog::OkToExitL()
// This function ALWAYS returns ETrue
// ----------------------------------------------------------
//
TBool CEncoderSelectionDialog::OkToExitL(TInt /*aButtonId*/)
{
iSelectedIdx = iListBox->CurrentItemIndex();
return ETrue;
}
TInt CEncoderSelectionDialog::CountComponentControls() const
{
if( iListBox )
return( 1 );
else
return( 0 );
}
CCoeControl* CEncoderSelectionDialog::ComponentControl(TInt /*aIndex*/) const
{
return iListBox;
}
TKeyResponse CEncoderSelectionDialog::OfferKeyEventL(
const TKeyEvent& aKeyEvent,TEventCode aType)
{
if( iListBox )
return( iListBox->OfferKeyEventL(aKeyEvent, aType) );
else
return( EKeyWasNotConsumed );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -