📄 cdrivelettercombo.cpp
字号:
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: CDriveLetterCombo.cpp,v 1.5 2002/08/06 20:09:23 dallen Exp $
____________________________________________________________________________*/
#include "pgpClassesConfig.h"
#include "CPath.h"
#include "UString.h"
#include "CDriveLetterCombo.h"
#include "PGPdiskUIPriv.h"
_USING_PGP
// Class CDriveLetterCombo member functions
PGPUInt8
CDriveLetterCombo::Get() const
{
if (IsWindow())
SetFromSel();
return mDriveNum;
}
void
CDriveLetterCombo::Fill()
{
CString driveString;
PGPUInt32 drives = CPath::GetFreeDrives();;
ResetContent();
// Fill the combo box with available drive letters.
for (PGPUInt32 i = 2; i < CPath::kMaxDrives; i++)
{
if (drives & (1 << i))
{
driveString.Format("%c:", UString::NumberToLetter(i));
PGPInt32 index = AddString(driveString);
SetItemData(index, i);
}
}
SetCurSel(0);
SetFromSel();
}
void
CDriveLetterCombo::Set(PGPUInt8 drive)
{
PGPInt32 index = FindDriveNumIndex(drive);
if (index != -1)
{
SetCurSel(index);
SetFromSel();
}
}
PGPInt32
CDriveLetterCombo::FindDriveNumIndex(PGPUInt8 driveNum)
{
PGPInt32 i;
PGPInt32 count = GetCount();
for (i = 0; i < count; i++)
{
if (GetItemData(i) == driveNum)
return i;
}
return -1;
}
void
CDriveLetterCombo::SetFromSel() const
{
mDriveNum = static_cast<PGPUInt8>(GetItemData(GetCurSel()));
}
void
CDriveLetterCombo::OnChar(char c, PGPUInt32 keyData)
{
Set(UString::LetterToNumber(c));
}
void
CDriveLetterCombo::OnDestroy()
{
SetFromSel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -