📄 dialog.cpp
字号:
// dialog.cpp
//
// Copyright (c) Symbian Software Ltd 1999 - 2007. All rights reserved.
//
/*======================================================
File: dialog.cpp
This file contains the dialog class.
=======================================================*/
#include "SimpleEx.h"
#include "SimpleEx.hrh"
#include "eikedwin.h"
#include <QikCommand.h>
#include <eikedwin.h>
#include <eikseced.h>
#include <eikchlst.h>
/**
Creates, constructs, execute and destroys the dialog.
*/
TInt CSimpleExDialog::RunDlgLD(TDes& aText, TRgb& aColor)
{
CSimpleExDialog* self = new (ELeave) CSimpleExDialog(aText, aColor);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
return self->ExecuteLD(R_SIMPLEEX_DIALOG);
}
/**
Constructor for the dialog.
*/
CSimpleExDialog::CSimpleExDialog(TDes& aText, TRgb& aColor)
: iCmdManager(CQikCommandManager::Static(*iCoeEnv)), iText(aText), iColor(aColor)
{
}
/**
Destructor for the dialog
*/
CSimpleExDialog::~CSimpleExDialog()
{
}
/**
2nd stage construction of the dialog.
*/
void CSimpleExDialog::ConstructL()
{
}
/**
Handles all commands in the dialog.
Called by the UI framework when a command has been issued.
The command Ids are defined in the .hrh file.
@param aCommand The command to be executed
*/
const TRgb colorList[4]={KRgbBlack,KRgbRed,KRgbGreen,KRgbBlue};
void CSimpleExDialog::PreLayoutDynInitL()
{
CEikEdwin* edwin = LocateControlByUniqueHandle<CEikEdwin>(ESimpleExText);
edwin->SetTextL(&iText);
TInt currColorIndex=0;
for (TInt i=0;i<4;i++)
{
if (iColor==colorList[i])
{
currColorIndex=i;
break;
}
}
CEikChoiceList* chlist = LocateControlByUniqueHandle<CEikChoiceList>(ESimpleExColor);
chlist->SetCurrentItem(currColorIndex);
}
void CSimpleExDialog::HandleCommandL(CQikCommand& aCommand)
{
switch(aCommand.Id())
{
case EDialogDoneCmd:
{
// Signals that the dialog should close with the command id as value
const CEikEdwin* edwin = LocateControlByUniqueHandle<const CEikEdwin>(ESimpleExText);
edwin->GetText(iText);
const CEikChoiceList* chlist = LocateControlByUniqueHandle<const CEikChoiceList>(ESimpleExColor);
TInt cIndex = chlist->CurrentItem();
iColor = colorList[cIndex];
CloseDialog(aCommand.Id());
break;
}
default:
{
CQikSimpleDialog::HandleCommandL(aCommand);
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -