📄 bencoolensettingslistbox.cpp
字号:
/*
* BencoolenSettingsListBox.cpp
*
* Copyright 2005 - 2007, Antony Pranata
* http://www.antonypranata.com
*
* Project: Screenshot for Symbian OS.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// INCLUDE FILES
#include <symbianvariant.h>
#include <aknsettingitemlist.h>
#if (__S60__ >= 300)
#include <caknmemoryselectionsettingitem.h>
#endif
#include "BencoolenSettingsListbox.h"
#include "ScreenShotData.h"
#include "Bencoolen.hrh"
// MEMBER FUNCTIONS
// --------------------------------------------------------------------------
// Updates descripter array for list box.
// --------------------------------------------------------------------------
CAknSettingItem* CBencoolenSettingsListBox::CreateSettingItemL(TInt aIdentifier)
{
CAknSettingItem* settingItem = NULL;
switch (aIdentifier)
{
case EBencoolenDlgMode:
{
settingItem = new (ELeave) CAknEnumeratedTextPopupSettingItem(
aIdentifier, (TInt&) iScreenShotData->Mode());
break;
}
case EBencoolenDlgShortcut:
{
settingItem = new (ELeave) CAknEnumeratedTextPopupSettingItem(
aIdentifier, (TInt&) iScreenShotData->Shortcut());
break;
}
case EBencoolenDlgImageFormat:
settingItem = new (ELeave) CAknEnumeratedTextPopupSettingItem(
aIdentifier, (TInt&) iScreenShotData->ImageFormat());
break;
#if (__S60__ < 300)
case EBencoolenDlgLocation:
settingItem = new (ELeave) CAknBinaryPopupSettingItem(
aIdentifier, (TInt&) iScreenShotData->MemoryLocation());
break;
#else
case EBencoolenDlgLocation:
settingItem = new (ELeave) CAknMemorySelectionSettingItem(
aIdentifier,
(CAknMemorySelectionDialog::TMemory&) iScreenShotData->MemoryLocation());
break;
#endif
case EBencoolenDlgFileName:
settingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iFileName);
break;
case EBencoolenDlgDirectory:
settingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iDirectory);
break;
case EBencoolenDlgDelay:
settingItem = new (ELeave) CAknEnumeratedTextPopupSettingItem(
aIdentifier, (TInt&) iScreenShotData->Delay());
break;
default:
User::Invariant();
break;
}
return settingItem;
}
// --------------------------------------------------------------------------
// Sets list item data.
// --------------------------------------------------------------------------
void CBencoolenSettingsListBox::SetData(CScreenShotData* aScreenShotData)
{
iScreenShotData = aScreenShotData;
if ((iScreenShotData) && (iScreenShotData->FileName().Length() > 0))
{
iFileName.Copy(iScreenShotData->FileName());
}
if ((iScreenShotData) && (iScreenShotData->Directory().Length() > 0))
{
// We have to remove the last character, which is backslash.
iDirectory.Copy(iScreenShotData->Directory());
iDirectory.Delete(iDirectory.Length() - 1, 1);
}
}
// --------------------------------------------------------------------------
// This has to be called when the list box is deactivated. The reason is
// because we have to update CScreenShotData with the value entered by the
// users (by calling StoreSettingsL()). And we have to set the file name
// and directory name too.
// --------------------------------------------------------------------------
void CBencoolenSettingsListBox::UpdateData()
{
TRAPD(err,
StoreSettingsL();
iScreenShotData->SetFileNameL(iFileName);
iScreenShotData->SetDirectoryL(iDirectory);
);
}
#if (__S60__ >= 203)
// --------------------------------------------------------------------------
// Called when the screen size/resolution is changed.
// --------------------------------------------------------------------------
void CBencoolenSettingsListBox::HandleResourceChange(TInt aType)
{
CAknSettingItemList::HandleResourceChange(aType);
#ifdef EKA2
// ADDED FOR SCALABLE UI SUPPORT
// *****************************
if ( aType==KEikDynamicLayoutVariantSwitch )
{
TRect rect;
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
SetRect(rect);
}
#endif
}
#endif
// --------------------------------------------------------------------------
// Called by framework when the view size is changed.
// --------------------------------------------------------------------------
void CBencoolenSettingsListBox::SizeChanged()
{
if (ListBox())
{
ListBox()->SetRect(Rect());
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -