本文整理汇总了C++中CComboBox::Attach方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::Attach方法的具体用法?C++ CComboBox::Attach怎么用?C++ CComboBox::Attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::Attach方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCommand
BOOL CFileDialogEx::OnCommand( WPARAM wParam, LPARAM lParam )
{
if (HIWORD (wParam) == CBN_SELCHANGE)
{
if (LOWORD (wParam) == IDC_DIRLIST)
{
// The combo box
CString text;
CComboBox combo;
combo.Attach (::GetDlgItem (*this, IDC_DIRLIST));
combo.GetWindowText (text);
combo.Detach ();
// Set the new directory
TCHAR s[MAX_PATH];
// Backup contents of 'edt1'
HWND parent = *GetParent ();
::GetDlgItemText (parent, edt1, s, MAX_PATH);
// Replace with the directory name
::SendMessage (parent, CDM_SETCONTROLTEXT, edt1, (LPARAM)(const char*)text);
// Click on the OK button
::SendMessage (parent, WM_COMMAND, IDOK, 0);
// Restore contents of 'edt1'
::SendMessage (parent, CDM_SETCONTROLTEXT, edt1, (LPARAM)s);
}
}
return CFileDialog::OnCommand (wParam, lParam);
}
示例2: OnTextChanged
LRESULT FavHubProperties::OnTextChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
if (!loaded)
return 0;
if (wID == IDC_HUBADDR) {
CComboBox combo;
combo.Attach(GetDlgItem(IDC_ENCODING));
tstring address;
address.resize(1024);
address.resize(GetDlgItemText(IDC_HUBADDR, &address[0], 1024));
if(AirUtil::isAdcHub(Text::fromT(address))) {
if (!hideShare)
ctrlProfile.EnableWindow(true);
combo.SetCurSel(4); // select UTF-8 for ADC hubs
::EnableWindow(GetDlgItem(IDC_STEALTH), 0);
combo.EnableWindow(false);
} else {
ctrlProfile.EnableWindow(false);
::EnableWindow(GetDlgItem(IDC_STEALTH), 1);
combo.EnableWindow(true);
}
combo.Detach();
}
return TRUE;
}
示例3: onSpeedChanged
LRESULT SpeedPage::onSpeedChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/)
{
tstring speed;
speed.resize(1024);
speed.resize(GetDlgItemText(wID, &speed[0], 1024));
if (!speed.empty() && wNotifyCode != CBN_SELENDOK) {
boost::wregex reg;
if(speed[speed.size() -1] == '.')
reg.assign(_T("(\\d+\\.)"));
else
reg.assign(_T("(\\d+(\\.\\d+)?)"));
if (!regex_match(speed, reg)) {
CComboBox tmp;
tmp.Attach(hWndCtl);
DWORD dwSel;
if ((dwSel = tmp.GetEditSel()) != CB_ERR) {
tstring::iterator it = speed.begin() + HIWORD(dwSel)-1;
speed.erase(it);
tmp.SetEditSel(0,-1);
tmp.SetWindowText(speed.c_str());
tmp.SetEditSel(HIWORD(dwSel)-1, HIWORD(dwSel)-1);
tmp.Detach();
}
}
}
updateValues(wNotifyCode);
validateMCNLimits(wNotifyCode);
return TRUE;
}
示例4: OnInitDialog
BOOL CFileDialogEx::OnInitDialog()
{
CFileDialog::OnInitDialog();
// The edit box
HWND editBox = ::GetDlgItem (*(this->GetParent ()), edt1);
// The combo box
CComboBox combo;
combo.Attach (::GetDlgItem (*this, IDC_DIRLIST));
// Insert the strings
char text[512];
text[0] = 0;
HKEY hKey;
DWORD type = REG_SZ;
DWORD size;
if (RegCreateKey (HKEY_CURRENT_USER, _RegistryPath.c_str (), &hKey) == ERROR_SUCCESS)
{
uint i;
for (i=0; i<PATH_REMEBERED_SIZE; i++)
{
size = 512;
if (RegQueryValueEx (hKey, toString (i).c_str (), 0, &type, (LPBYTE)text, &size) == ERROR_SUCCESS)
combo.InsertString (-1, text);
}
if (m_ofn.lpstrInitialDir)
combo.SelectString (-1, m_ofn.lpstrInitialDir);
}
combo.Detach ();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例5: UpdateControls
VOID CBindTypePage::UpdateControls (UINT32 nType)
{
CComboBox ctlComboBox;
ctlComboBox.Attach(GetDlgItem(IDC_COMBO_DISKCOUNT));
ctlComboBox.ResetContent();
CString strDesc;
switch(nType)
{
case NMT_AGGREGATE :
ctlComboBox.InsertString(-1, _T("2"));
ctlComboBox.InsertString(-1, _T("3"));
ctlComboBox.InsertString(-1, _T("4"));
ctlComboBox.InsertString(-1, _T("5"));
ctlComboBox.InsertString(-1, _T("6"));
ctlComboBox.InsertString(-1, _T("7"));
ctlComboBox.InsertString(-1, _T("8"));
strDesc.LoadString(IDS_BNZ_DESC_AGGREGATION);
break;
case NMT_RAID0 :
ctlComboBox.InsertString(-1, _T("2"));
ctlComboBox.InsertString(-1, _T("4"));
ctlComboBox.InsertString(-1, _T("8"));
strDesc.LoadString(IDS_BNZ_DESC_RAID0);
break;
case NMT_RAID1R3 :
ctlComboBox.InsertString(-1, _T("2"));
strDesc.LoadString(IDS_BNZ_DESC_RAID1);
break;
case NMT_RAID4R3 :
ctlComboBox.InsertString(-1, _T("3"));
ctlComboBox.InsertString(-1, _T("5"));
ctlComboBox.InsertString(-1, _T("9"));
strDesc.LoadString(IDS_BNZ_DESC_RAID4);
break;
case NMT_RAID5 :
ctlComboBox.InsertString(-1, _T("3"));
ctlComboBox.InsertString(-1, _T("5"));
ctlComboBox.InsertString(-1, _T("9"));
strDesc.LoadString(IDS_BNZ_DESC_RAID5);
break;
default:
break;
}
ctlComboBox.SetCurSel(0);
CStatic ctlStatic;
ctlStatic.Attach(GetDlgItem(IDC_BIND_TYPE_DESCRIPTION));
ctlStatic.SetWindowText(strDesc);
}
示例6: OnInitDialog
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
// Translate dialog
SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FH_CONN, CTSTRING(FAVORITE_HUB_CONNECTION));
SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
SetDlgItemText(IDC_FAV_NO_PM, CTSTRING(FAV_NO_PM));
SetDlgItemText(IDC_SHOW_JOIN, CTSTRING(FAV_SHOW_JOIN));
SetDlgItemText(IDC_HIDE_SHARE, CTSTRING(HIDE_SHARE));
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
SetDlgItemText(IDC_CHAT_NOTIFY, CTSTRING(CHAT_NOTIFY));
SetDlgItemText(IDC_FAILOVER, CTSTRING(ACCEPT_FAILOVERS_FAV));
SetDlgItemText(IDC_AWAY_MSG_LBL, CTSTRING(CUSTOM_AWAY_MESSAGE));
SetDlgItemText(IDC_LOGMAINCHAT, CTSTRING(FAV_LOG_CHAT));
SetDlgItemText(IDC_HUBSETTINGS, CTSTRING(GLOBAL_SETTING_OVERRIDES));
SetDlgItemText(IDC_SEARCH_INTERVAL_DEFAULT, CTSTRING(USE_DEFAULT));
SetDlgItemText(IDC_FAV_SHAREPROFILE_CAPTION, CTSTRING(SHARE_PROFILE));
SetDlgItemText(IDC_EDIT_PROFILES, CTSTRING(EDIT_PROFILES));
SetDlgItemText(IDC_PROFILES_NOTE, CTSTRING(PROFILES_NOTE));
// Fill in values
SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServerStr()).c_str());
SetDlgItemText(IDC_NICK, Text::toT(entry->get(HubSettings::Nick)).c_str());
SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
SetDlgItemText(IDC_USERDESC, Text::toT(entry->get(HubSettings::Description)).c_str());
SetDlgItemText(IDC_EMAIL, Text::toT(entry->get(HubSettings::Email)).c_str());
SetDlgItemText(IDC_AWAY_MSG, Text::toT(entry->get(HubSettings::AwayMsg)).c_str());
CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(IDC_SHOW_JOIN, toInt(entry->get(HubSettings::ShowJoins)));
CheckDlgButton(IDC_SHOW_JOIN_FAV, toInt(entry->get(HubSettings::FavShowJoins)));
CheckDlgButton(IDC_LOGMAINCHAT, toInt(entry->get(HubSettings::LogMainChat)));
CheckDlgButton(IDC_CHAT_NOTIFY, toInt(entry->get(HubSettings::ChatNotify)));
CheckDlgButton(IDC_FAILOVER, toInt(entry->get(HubSettings::AcceptFailovers)));
CheckDlgButton(IDC_FAV_NO_PM, entry->getFavNoPM() ? BST_CHECKED : BST_UNCHECKED);
auto searchInterval = entry->get(HubSettings::SearchInterval);
CheckDlgButton(IDC_SEARCH_INTERVAL_DEFAULT, searchInterval == HubSettings::getMinInt() ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(searchInterval).c_str());
bool isAdcHub = entry->isAdcHub();
CComboBox combo;
combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
combo.AddString(_T("---"));
combo.SetCurSel(0);
const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
for(const auto& name: favHubGroups | map_keys) {
int pos = combo.AddString(Text::toT(name).c_str());
if(name == entry->getGroup())
combo.SetCurSel(pos);
}
combo.Detach();
// TODO: add more encoding into wxWidgets version, this is enough now
// FIXME: following names are Windows only!
combo.Attach(GetDlgItem(IDC_ENCODING));
combo.AddString(_T("System default"));
combo.AddString(_T("English_United Kingdom.1252"));
combo.AddString(_T("Czech_Czech Republic.1250"));
combo.AddString(_T("Russian_Russia.1251"));
combo.AddString(Text::toT(Text::utf8).c_str());
ctrlProfile.Attach(GetDlgItem(IDC_FAV_SHAREPROFILE));
appendProfiles();
hideShare = entry->getShareProfile() && entry->getShareProfile()->getToken() == SP_HIDDEN;
CheckDlgButton(IDC_HIDE_SHARE, hideShare ? BST_CHECKED : BST_UNCHECKED);
if(isAdcHub) {
combo.SetCurSel(4); // select UTF-8 for ADC hubs
combo.EnableWindow(false);
if (hideShare)
ctrlProfile.EnableWindow(false);
} else {
ctrlProfile.EnableWindow(false);
if(entry->getEncoding().empty()) {
combo.SetCurSel(0);
//.........这里部分代码省略.........
示例7: OnCloseCmd
LRESULT FavHubProperties::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if(wID == IDOK)
{
TCHAR buf[1024];
GetDlgItemText(IDC_HUBADDR, buf, 256);
if(buf[0] == '\0') {
WinUtil::showMessageBox(TSTRING(INCOMPLETE_FAV_HUB), MB_ICONWARNING);
return 0;
}
//check the primary address for dupes
string addresses = Text::fromT(buf);
size_t pos = addresses.find(";");
if (!FavoriteManager::getInstance()->isUnique(pos != string::npos ? addresses.substr(0, pos) : addresses, entry->getToken())){
WinUtil::showMessageBox(TSTRING(FAVORITE_HUB_ALREADY_EXISTS), MB_ICONWARNING);
return 0;
}
//validate the encoding
GetDlgItemText(IDC_ENCODING, buf, 512);
if(_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && _tcscmp(buf, _T("System default")) != 0)
{
WinUtil::showMessageBox(TSTRING(INVALID_ENCODING), MB_ICONWARNING);
return 0;
}
//set the values
entry->setEncoding(Text::fromT(buf));
entry->setServerStr(addresses);
GetDlgItemText(IDC_HUBNAME, buf, 256);
entry->setName(Text::fromT(buf));
GetDlgItemText(IDC_HUBDESCR, buf, 256);
entry->setDescription(Text::fromT(buf));
GetDlgItemText(IDC_HUBPASS, buf, 256);
entry->setPassword(Text::fromT(buf));
entry->setStealth(IsDlgButtonChecked(IDC_STEALTH) == 1);
entry->setFavNoPM(IsDlgButtonChecked(IDC_FAV_NO_PM) == 1);
//Hub settings
GetDlgItemText(IDC_NICK, buf, 256);
entry->get(HubSettings::Nick) = Text::fromT(buf);
GetDlgItemText(IDC_USERDESC, buf, 256);
entry->get(HubSettings::Description) = Text::fromT(buf);
GetDlgItemText(IDC_EMAIL, buf, 256);
entry->get(HubSettings::Email) = Text::fromT(buf);
GetDlgItemText(IDC_AWAY_MSG, buf, 1024);
entry->get(HubSettings::AwayMsg) = Text::fromT(buf);
entry->get(HubSettings::ShowJoins) = to3bool(IsDlgButtonChecked(IDC_SHOW_JOIN));
entry->get(HubSettings::FavShowJoins) = to3bool(IsDlgButtonChecked(IDC_SHOW_JOIN));
entry->get(HubSettings::LogMainChat) = to3bool(IsDlgButtonChecked(IDC_LOGMAINCHAT));
entry->get(HubSettings::ChatNotify) = to3bool(IsDlgButtonChecked(IDC_CHAT_NOTIFY));
entry->get(HubSettings::AcceptFailovers) = to3bool(IsDlgButtonChecked(IDC_FAILOVER));
auto val = HubSettings::getMinInt();
if (!IsDlgButtonChecked(IDC_SEARCH_INTERVAL_DEFAULT)) {
GetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, buf, 512);
val = Util::toInt(Text::fromT(buf));
}
entry->get(HubSettings::SearchInterval) = val;
CComboBox combo;
combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));
if(combo.GetCurSel() == 0)
{
entry->setGroup(Util::emptyString);
}
else
{
tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
combo.GetWindowText(&text[0], text.size());
text.resize(text.size()-1);
entry->setGroup(Text::fromT(text));
}
combo.Detach();
// connection modes
auto getConnMode = [](const CComboBox& combo) -> int {
if (combo.GetCurSel() == 1)
return SettingsManager::INCOMING_DISABLED;
else if (combo.GetCurSel() == 2)
return SettingsManager::INCOMING_ACTIVE;
else if (combo.GetCurSel() == 3)
return SettingsManager::INCOMING_PASSIVE;
return HubSettings::getMinInt();
};
entry->get(HubSettings::Connection) = getConnMode(modeCombo4);
entry->get(HubSettings::Connection6) = getConnMode(modeCombo6);
//.........这里部分代码省略.........
示例8: FillCountryComboBox
extern "C" BOOL FAR PASCAL _export FillCountryComboBox(HWND hComboBox, WORD wSelectCountryId /*=0*/)
#endif
{
BOOL fResult = FALSE;
// Fill the specified combo box with the country names from the resource file.
// The data for each item is set to the country ID number.
CComboBox ComboBox;
CString csCountry;
TRY
{
ComboBox.Attach(hComboBox);
ComboBox.SetRedraw(FALSE);
if (wSelectCountryId == 0)
{
wSelectCountryId = ID_UnitedStatesOfAmerica;
}
int nSelectIndex = 0;
int nCount = CCountryTableEntry::GetCountryTableEntryCount();
for (int nCountry = 0; nCountry < nCount; nCountry++)
{
CCountryTableEntry* pCountry = CCountryTableEntry::GetCountryEntryByIndex(nCountry);
if (pCountry != NULL)
{
csCountry.LoadString(pCountry->GetId());
int nComboIndex = ComboBox.AddString(csCountry);
if (nComboIndex != CB_ERR)
{
ComboBox.SetItemData(nComboIndex, (DWORD)(pCountry->GetId()));
if (pCountry->GetId() == wSelectCountryId)
{
nSelectIndex = nComboIndex;
}
}
}
}
if (nSelectIndex != 0)
{
ComboBox.SetCurSel(nSelectIndex);
}
ComboBox.SetRedraw(TRUE);
ComboBox.Invalidate();
ComboBox.Detach();
fResult = TRUE;
}
CATCH_ALL(e)
{
if (ComboBox.m_hWnd != NULL)
{
ComboBox.SetRedraw(TRUE);
ComboBox.Detach();
}
fResult = FALSE;
}
END_CATCH_ALL
return fResult;
}
示例9: OnInitDialog
LRESULT FavHubProperties::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
// Translate dialog
SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
SetDlgItemText(IDOK, CTSTRING(OK));
SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
SetDlgItemText(IDC_FH_NAME, CTSTRING(HUB_NAME));
SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_DEFAULT, CTSTRING(DEFAULT));
SetDlgItemText(IDC_ACTIVE, CTSTRING(SETTINGS_DIRECT));
SetDlgItemText(IDC_PASSIVE, CTSTRING(SETTINGS_FIREWALL_PASSIVE));
SetDlgItemText(IDC_STEALTH, CTSTRING(STEALTH_MODE));
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL, CTSTRING(MINIMUM_SEARCH_INTERVAL));
SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
// Fill in values
SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServer()).c_str());
SetDlgItemText(IDC_HUBNICK, Text::toT(entry->getNick(false)).c_str());
SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
SetDlgItemText(IDC_HUBUSERDESCR, Text::toT(entry->getUserDescription()).c_str());
CheckDlgButton(IDC_STEALTH, entry->getStealth() ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(IDC_RAW_ONE, Text::toT(entry->getRawOne()).c_str());
SetDlgItemText(IDC_RAW_TWO, Text::toT(entry->getRawTwo()).c_str());
SetDlgItemText(IDC_RAW_THREE, Text::toT(entry->getRawThree()).c_str());
SetDlgItemText(IDC_RAW_FOUR, Text::toT(entry->getRawFour()).c_str());
SetDlgItemText(IDC_RAW_FIVE, Text::toT(entry->getRawFive()).c_str());
SetDlgItemText(IDC_SERVER, Text::toT(entry->getIP()).c_str());
SetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, Util::toStringW(entry->getSearchInterval()).c_str());
CComboBox combo;
combo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
combo.AddString(_T("---"));
combo.SetCurSel(0);
const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
for(FavHubGroups::const_iterator i = favHubGroups.begin(); i != favHubGroups.end(); ++i) {
const string& name = i->first;
int pos = combo.AddString(Text::toT(name).c_str());
if(name == entry->getGroup())
combo.SetCurSel(pos);
}
combo.Detach();
// TODO: add more encoding into wxWidgets version, this is enough now
// FIXME: following names are Windows only!
combo.Attach(GetDlgItem(IDC_ENCODING));
combo.AddString(_T("System default"));
combo.AddString(_T("English_United Kingdom.1252"));
combo.AddString(_T("Czech_Czech Republic.1250"));
combo.AddString(_T("Russian_Russia.1251"));
combo.AddString(Text::toT(Text::utf8).c_str());
if(strnicmp("adc://", entry->getServer().c_str(), 6) == 0 || strnicmp("adcs://", entry->getServer().c_str(), 7) == 0)
{
combo.SetCurSel(4); // select UTF-8 for ADC hubs
combo.EnableWindow(false);
}
else
{
if(entry->getEncoding().empty())
combo.SetCurSel(0);
else
combo.SetWindowText(Text::toT(entry->getEncoding()).c_str());
}
combo.Detach();
if(entry->getMode() == 0)
CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_DEFAULT);
else if(entry->getMode() == 1)
CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_ACTIVE);
else if(entry->getMode() == 2)
CheckRadioButton(IDC_ACTIVE, IDC_DEFAULT, IDC_PASSIVE);
CEdit tmp;
tmp.Attach(GetDlgItem(IDC_HUBNAME));
tmp.SetFocus();
tmp.SetSel(0,-1);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_HUBNICK));
tmp.LimitText(35);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_HUBUSERDESCR));
tmp.LimitText(50);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_HUBPASS));
tmp.SetPasswordChar('*');
tmp.Detach();
CUpDownCtrl updown;
//.........这里部分代码省略.........
示例10: OnCloseCmd
LRESULT FavHubProperties::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if(wID == IDOK)
{
TCHAR buf[512];
GetDlgItemText(IDC_HUBADDR, buf, 256);
if(buf[0] == '\0') {
MessageBox(CTSTRING(INCOMPLETE_FAV_HUB), _T(""), MB_ICONWARNING | MB_OK);
return 0;
}
entry->setServer(Text::fromT(buf));
GetDlgItemText(IDC_HUBNAME, buf, 256);
entry->setName(Text::fromT(buf));
GetDlgItemText(IDC_HUBDESCR, buf, 256);
entry->setDescription(Text::fromT(buf));
GetDlgItemText(IDC_HUBNICK, buf, 256);
entry->setNick(Text::fromT(buf));
GetDlgItemText(IDC_HUBPASS, buf, 256);
entry->setPassword(Text::fromT(buf));
GetDlgItemText(IDC_HUBUSERDESCR, buf, 256);
entry->setUserDescription(Text::fromT(buf));
entry->setStealth(IsDlgButtonChecked(IDC_STEALTH) == 1);
GetDlgItemText(IDC_RAW_ONE, buf, 512);
entry->setRawOne(Text::fromT(buf));
GetDlgItemText(IDC_RAW_TWO, buf, 512);
entry->setRawTwo(Text::fromT(buf));
GetDlgItemText(IDC_RAW_THREE, buf, 512);
entry->setRawThree(Text::fromT(buf));
GetDlgItemText(IDC_RAW_FOUR, buf, 512);
entry->setRawFour(Text::fromT(buf));
GetDlgItemText(IDC_RAW_FIVE, buf, 512);
entry->setRawFive(Text::fromT(buf));
GetDlgItemText(IDC_SERVER, buf, 512);
entry->setIP(Text::fromT(buf));
GetDlgItemText(IDC_FAV_SEARCH_INTERVAL_BOX, buf, 512);
entry->setSearchInterval(Util::toUInt32(Text::fromT(buf)));
GetDlgItemText(IDC_ENCODING, buf, 512);
if(_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && _tcscmp(buf, _T("System default")) != 0)
{
MessageBox(_T("Invalid encoding!"), _T(""), MB_ICONWARNING | MB_OK);
return 0;
}
entry->setEncoding(Text::fromT(buf));
CComboBox combo;
combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));
if(combo.GetCurSel() == 0)
{
entry->setGroup(Util::emptyString);
}
else
{
tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
combo.GetWindowText(&text[0], text.size());
text.resize(text.size()-1);
entry->setGroup(Text::fromT(text));
}
combo.Detach();
int ct = -1;
if(IsDlgButtonChecked(IDC_DEFAULT))
ct = 0;
else if(IsDlgButtonChecked(IDC_ACTIVE))
ct = 1;
else if(IsDlgButtonChecked(IDC_PASSIVE))
ct = 2;
entry->setMode(ct);
FavoriteManager::getInstance()->save();
}
EndDialog(wID);
return 0;
}
示例11: onInitDialog
LRESULT GeneralPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
::EnableWindow(GetDlgItem(IDC_DISABLE_AUTOREMOVE_VIRUS_HUB), FALSE);
#ifndef IRAINMAN_ENABLE_SLOTS_AND_LIMIT_IN_DESCRIPTION
::EnableWindow(GetDlgItem(IDC_CHECK_ADD_TO_DESCRIPTION), FALSE);
::EnableWindow(GetDlgItem(IDC_CHECK_ADD_SLOTS), FALSE);
::EnableWindow(GetDlgItem(IDC_CHECK_ADD_LIMIT), FALSE);
GetDlgItem(IDC_CHECK_ADD_TO_DESCRIPTION).ShowWindow(FALSE);
GetDlgItem(IDC_CHECK_ADD_SLOTS).ShowWindow(FALSE);
GetDlgItem(IDC_CHECK_ADD_LIMIT).ShowWindow(FALSE);
#endif
PropPage::translate((HWND)(*this), texts);
ctrlConnection.Attach(GetDlgItem(IDC_CONNECTION));
for (auto i = SettingsManager::g_connectionSpeeds.cbegin(); i != SettingsManager::g_connectionSpeeds.cend(); ++i)
{
ctrlConnection.AddString(Text::toT(*i).c_str());
}
PropPage::read((HWND)(*this), items);
ctrlLanguage.Attach(GetDlgItem(IDC_LANGUAGE));
GetLangList();
for (auto i = m_languagesList.cbegin(); i != m_languagesList.cend(); ++i)
{
ctrlLanguage.AddString(i->first.c_str());
}
m_LangTranslate.init(GetDlgItem(IDC_LANG_LINK), _T(""));
ctrlLanguage.SetCurSel(WinUtil::getIndexFromMap(m_languagesList, SETTING(LANGUAGE_FILE)));
ctrlLanguage.Detach();
ctrlConnection.SetCurSel(ctrlConnection.FindString(0, Text::toT(SETTING(UPLOAD_SPEED)).c_str()));
#ifdef FLYLINKDC_USE_XXX_ICON
m_GenderTypeComboBox.Attach(GetDlgItem(IDC_GENDER));
ResourceLoader::LoadImageList(IDR_GENDER_USERS, m_GenderTypesImageList, 16, 16);
m_GenderTypeComboBox.SetImageList(m_GenderTypesImageList);
#else
::EnableWindow(GetDlgItem(IDC_GENDER), FALSE);
#endif
nick.Attach(GetDlgItem(IDC_NICK));
nick.LimitText(49); // [~] InfinitySky. 35->49.
nick.Detach();
desc.Attach(GetDlgItem(IDC_DESCRIPTION));
desc.LimitText(100); // [~] InfinitySky. 50->100.
desc.Detach();
desc.Attach(GetDlgItem(IDC_SETTINGS_EMAIL));
desc.LimitText(64);
desc.Detach();
#ifdef FLYLINKDC_USE_XXX_ICON
int l_id = 0;
AddGenderItem(CWSTRING(FLY_GENDER_NONE), l_id++, 0);
AddGenderItem(CWSTRING(FLY_GENDER_MALE), l_id++, 1);
AddGenderItem(CWSTRING(FLY_GENDER_FEMALE), l_id++, 2);
AddGenderItem(CWSTRING(FLY_GENDER_ASEXUAL), l_id++, 3);
m_GenderTypeComboBox.SetCurSel(SETTING(FLY_GENDER));
#endif
CComboBox combo;
combo.Attach(GetDlgItem(IDC_ENCODING));
combo.AddString(Text::toT(Text::g_code1251).c_str());
combo.AddString(Text::toT(Text::g_systemCharset).c_str());
if (Text::g_systemCharset == Text::g_code1251)
{
combo.SetCurSel(0);
}
else
{
combo.SetCurSel(1);
}
combo.Detach();
::EnableWindow(GetDlgItem(IDC_ENCODING), FALSE);
fixControls();
return TRUE;
}
示例12: OnInitDialog
LRESULT FavHubGeneralPage::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
// Translate dialog
SetWindowText(CTSTRING(FAVORITE_HUB_PROPERTIES));
SetDlgItemText(IDCANCEL, CTSTRING(CANCEL));
SetDlgItemText(IDC_FH_HUB, CTSTRING(HUB));
SetDlgItemText(IDC_FH_IDENT, CTSTRING(FAVORITE_HUB_IDENTITY));
SetDlgItemText(IDC_FH_NAME, CTSTRING(NAME));
SetDlgItemText(IDC_FH_ADDRESS, CTSTRING(HUB_ADDRESS));
SetDlgItemText(IDC_FH_HUB_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FH_NICK, CTSTRING(NICK));
SetDlgItemText(IDC_FH_PASSWORD, CTSTRING(PASSWORD));
SetDlgItemText(IDC_FH_USER_DESC, CTSTRING(DESCRIPTION));
SetDlgItemText(IDC_FAVGROUP, CTSTRING(GROUP));
SetDlgItemText(IDC_ENCODINGTEXT, CTSTRING(NMDC_ENCODING));
SetDlgItemText(IDC_HIDE_SHARE, CTSTRING(HIDE_SHARE));
SetDlgItemText(IDC_FAV_SHAREPROFILE_CAPTION, CTSTRING(SHARE_PROFILE));
SetDlgItemText(IDC_EDIT_PROFILES, CTSTRING(EDIT_PROFILES));
SetDlgItemText(IDC_PROFILES_NOTE, CTSTRING(PROFILES_NOTE));
// Fill in values
SetDlgItemText(IDC_HUBNAME, Text::toT(entry->getName()).c_str());
SetDlgItemText(IDC_HUBDESCR, Text::toT(entry->getDescription()).c_str());
SetDlgItemText(IDC_HUBADDR, Text::toT(entry->getServer()).c_str());
SetDlgItemText(IDC_NICK, Text::toT(entry->get(HubSettings::Nick)).c_str());
SetDlgItemText(IDC_HUBPASS, Text::toT(entry->getPassword()).c_str());
SetDlgItemText(IDC_USERDESC, Text::toT(entry->get(HubSettings::Description)).c_str());
SetDlgItemText(IDC_EMAIL, Text::toT(entry->get(HubSettings::Email)).c_str());
bool isAdcHub = entry->isAdcHub();
CComboBox tmpCombo;
tmpCombo.Attach(GetDlgItem(IDC_FAVGROUP_BOX));
tmpCombo.AddString(_T("---"));
tmpCombo.SetCurSel(0);
const FavHubGroups& favHubGroups = FavoriteManager::getInstance()->getFavHubGroups();
for (const auto& n : favHubGroups | map_keys) {
int pos = tmpCombo.AddString(Text::toT(n).c_str());
if (n == entry->getGroup())
tmpCombo.SetCurSel(pos);
}
tmpCombo.Detach();
// TODO: add more encoding into wxWidgets version, this is enough now
// FIXME: following names are Windows only!
ctrlEncoding.Attach(GetDlgItem(IDC_ENCODING));
ctrlEncoding.AddString(CTSTRING(SYSTEM_DEFAULT));
ctrlEncoding.AddString(_T("English_United Kingdom.1252"));
ctrlEncoding.AddString(_T("Czech_Czech Republic.1250"));
ctrlEncoding.AddString(_T("Russian_Russia.1251"));
ctrlEncoding.AddString(Text::toT(Text::utf8).c_str());
ctrlProfile.Attach(GetDlgItem(IDC_FAV_SHAREPROFILE));
appendProfiles();
hideShare = entry->get(HubSettings::ShareProfile) == SP_HIDDEN;
CheckDlgButton(IDC_HIDE_SHARE, hideShare ? BST_CHECKED : BST_UNCHECKED);
if (isAdcHub) {
ctrlEncoding.SetCurSel(4); // select UTF-8 for ADC hubs
ctrlEncoding.EnableWindow(false);
if (hideShare)
ctrlProfile.EnableWindow(false);
} else {
ctrlProfile.EnableWindow(false);
if (entry->get(HubSettings::NmdcEncoding).empty() || entry->get(HubSettings::NmdcEncoding) == "System default") {
ctrlEncoding.SetCurSel(0);
} else {
ctrlEncoding.SetWindowText(Text::toT(entry->get(HubSettings::NmdcEncoding)).c_str());
}
}
CEdit tmp;
tmp.Attach(GetDlgItem(IDC_HUBNAME));
tmp.SetFocus();
tmp.SetSel(0, -1);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_NICK));
tmp.LimitText(35);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_USERDESC));
tmp.LimitText(50);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_EMAIL));
tmp.LimitText(50);
tmp.Detach();
tmp.Attach(GetDlgItem(IDC_HUBPASS));
tmp.SetPasswordChar('*');
tmp.Detach();
loading = false;
return FALSE;
}
示例13: write
bool FavHubGeneralPage::write() {
TCHAR buf[1024];
GetDlgItemText(IDC_HUBADDR, buf, 256);
if (buf[0] == '\0') {
WinUtil::showMessageBox(TSTRING(INCOMPLETE_FAV_HUB), MB_ICONWARNING);
return false;
}
//check the primary address for dupes
string addresses = Text::fromT(buf);
size_t pos = addresses.find(";");
if (!FavoriteManager::getInstance()->isUnique(pos != string::npos ? addresses.substr(0, pos) : addresses, entry->getToken())) {
WinUtil::showMessageBox(TSTRING(FAVORITE_HUB_ALREADY_EXISTS), MB_ICONWARNING);
return false;
}
//validate the encoding
GetDlgItemText(IDC_ENCODING, buf, 512);
if (_tcschr(buf, _T('.')) == NULL && _tcscmp(buf, Text::toT(Text::utf8).c_str()) != 0 && ctrlEncoding.GetCurSel() != 0)
{
WinUtil::showMessageBox(TSTRING_F(INVALID_ENCODING, buf), MB_ICONWARNING);
return false;
}
//set the values
entry->get(HubSettings::NmdcEncoding) = ctrlEncoding.GetCurSel() != 0 ? Text::fromT(buf) : Util::emptyString;
entry->setServer(addresses);
GetDlgItemText(IDC_HUBNAME, buf, 256);
entry->setName(Text::fromT(buf));
GetDlgItemText(IDC_HUBDESCR, buf, 256);
entry->setDescription(Text::fromT(buf));
GetDlgItemText(IDC_HUBPASS, buf, 256);
entry->setPassword(Text::fromT(buf));
//Hub settings
GetDlgItemText(IDC_NICK, buf, 256);
entry->get(HubSettings::Nick) = Text::fromT(buf);
GetDlgItemText(IDC_USERDESC, buf, 256);
entry->get(HubSettings::Description) = Text::fromT(buf);
GetDlgItemText(IDC_EMAIL, buf, 256);
entry->get(HubSettings::Email) = Text::fromT(buf);
CComboBox combo;
combo.Attach(GetDlgItem(IDC_FAV_DLG_GROUP));
if (combo.GetCurSel() == 0)
{
entry->setGroup(Util::emptyString);
}
else
{
tstring text(combo.GetWindowTextLength() + 1, _T('\0'));
combo.GetWindowText(&text[0], text.size());
text.resize(text.size() - 1);
entry->setGroup(Text::fromT(text));
}
combo.Detach();
auto p = ShareManager::getInstance()->getProfiles();
ProfileToken token = HUB_SETTING_DEFAULT_INT;
if (hideShare) {
token = SP_HIDDEN;
}
else if (entry->isAdcHub() && ctrlProfile.GetCurSel() != 0) {
token = p[ctrlProfile.GetCurSel() - 1]->getToken();
}
entry->get(HubSettings::ShareProfile) = token;
//FavoriteManager::getInstance()->save();
return true;
}