📄 showinfodialog.cpp
字号:
/*
* ============================================================================
* Name : CShowInfoDialog from ShowInfoDialog.cpp
* Part of : ImageConverter
* Created : 25.11.2003 Forum Nokia
* Description:
* Used to show information of a image frame.
* Version :
* Copyright: Nokia Corporation
* ============================================================================
*/
// INCLUDE FILES
#include <aknlists.h>
#include <ImageConversion.h>
#include <aknnotewrappers.h>
#include "ImageConverter.hrh"
#include "ShowInfoDialog.h"
#include "ImageConverterEngine.h"
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CShowInfoDialog::CShowInfoDialog( CFrameInfoStrings* aInfoStrings ) :
iInfoStrings( aInfoStrings )
{
}
CShowInfoDialog::~CShowInfoDialog()
{
delete iListBox;
}
// ----------------------------------------------------------
// CShowInfoDialog::PreLayoutDynInitL()
// Initializing the dialog dynamically
// ----------------------------------------------------------
//
void CShowInfoDialog::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 of iMessageList
}
void CShowInfoDialog::PostLayoutDynInitL()
{
iListBox->SetRect( Rect() );
_LIT( KTab, "\t" );
for( TInt i=0; i<iInfoStrings->Count(); i++ )
{
TBuf<80> desc;
desc.Append( KTab );
desc.Append( iInfoStrings->String(i) );
iMessageList->AppendL( desc );
}
// tell the control about the change
iListBox->HandleItemAdditionL();
}
// ----------------------------------------------------------
// CShowInfoDialog::OkToExitL()
// This function ALWAYS returns ETrue
// ----------------------------------------------------------
//
TBool CShowInfoDialog::OkToExitL(TInt /*aButtonId*/)
{
return ETrue;
}
TInt CShowInfoDialog::CountComponentControls() const
{
if( iListBox )
return( 1 );
else
return( 0 );
}
CCoeControl* CShowInfoDialog::ComponentControl(TInt /*aIndex*/) const
{
return iListBox;
}
TKeyResponse CShowInfoDialog::OfferKeyEventL(
const TKeyEvent& aKeyEvent,TEventCode aType)
{
if(aType == EEventKey)
{
if (aKeyEvent.iCode == EKeyOK)
{
ShowInfoDialogL();
return( EKeyWasConsumed );
}
}
if( iListBox )
return( iListBox->OfferKeyEventL(aKeyEvent, aType) );
else
return( EKeyWasNotConsumed );
}
void CShowInfoDialog::ShowInfoDialogL()
{
CAknInformationNote* dlg = new(ELeave)CAknInformationNote();
dlg->SetTimeout( CAknInformationNote::ENoTimeout );
dlg->ExecuteLD( iInfoStrings->String(iListBox->CurrentItemIndex()) );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -