本文整理汇总了C++中wxMessageBoxEx函数的典型用法代码示例。如果您正苦于以下问题:C++ wxMessageBoxEx函数的具体用法?C++ wxMessageBoxEx怎么用?C++ wxMessageBoxEx使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxMessageBoxEx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XRCCTRL
void CFilterDialog::OnRename(wxCommandEvent& event)
{
wxChoice* pChoice = XRCCTRL(*this, "ID_SETS", wxChoice);
int old_pos = pChoice->GetSelection();
if (old_pos == -1)
return;
if (!old_pos) {
wxMessageBoxEx(_("This filter set cannot be renamed."));
return;
}
CInputDialog dlg;
wxString msg = wxString::Format(_("Please enter a new name for the filter set \"%s\""), pChoice->GetStringSelection());
dlg.Create(this, _("Enter new name for filterset"), msg);
if (dlg.ShowModal() != wxID_OK)
return;
wxString name = dlg.GetValue();
if (name == pChoice->GetStringSelection()) {
// Nothing changed
return;
}
if (name.empty()) {
wxMessageBoxEx(_("No name for the filterset given."), _("Cannot save filterset"), wxICON_INFORMATION);
return;
}
int pos = pChoice->FindString(name);
if (pos != wxNOT_FOUND) {
if (wxMessageBoxEx(_("Given filterset name already exists, overwrite filter set?"), _("Filter set already exists"), wxICON_QUESTION | wxYES_NO) != wxYES)
return;
}
// Remove old entry
pChoice->Delete(old_pos);
CFilterSet set = m_filterSets[old_pos];
m_filterSets.erase(m_filterSets.begin() + old_pos);
pos = pChoice->FindString(name);
if (pos == wxNOT_FOUND) {
pos = m_filterSets.size();
m_filterSets.push_back(set);
pChoice->Append(name);
}
else
m_filterSets[pos] = set;
m_filterSets[pos].name = name;
pChoice->SetSelection(pos);
m_currentFilterSet = pos;
GetSizer()->Fit(this);
}
示例2: mutex
bool CSiteManager::ClearBookmarks(wxString sitePath)
{
if (sitePath[0] != '0')
return false;
sitePath = sitePath.Mid(1);
// We have to synchronize access to sitemanager.xml so that multiple processed don't write
// to the same file or one is reading while the other one writes.
CInterProcessMutex mutex(MUTEX_SITEMANAGER);
CXmlFile file;
TiXmlElement* pDocument = file.Load(_T("sitemanager"));
if (!pDocument)
{
wxString msg = file.GetError() + _T("\n") + _("The bookmarks could not be cleared.");
wxMessageBoxEx(msg, _("Error loading xml file"), wxICON_ERROR);
return false;
}
TiXmlElement* pElement = pDocument->FirstChildElement("Servers");
if (!pElement)
return false;
std::list<wxString> segments;
if (!UnescapeSitePath(sitePath, segments))
{
wxMessageBoxEx(_("Site path is malformed."), _("Invalid site path"));
return 0;
}
TiXmlElement* pChild = GetElementByPath(pElement, segments);
if (!pChild || strcmp(pChild->Value(), "Server"))
{
wxMessageBoxEx(_("Site does not exist."), _("Invalid site path"));
return 0;
}
TiXmlElement *pBookmark = pChild->FirstChildElement("Bookmark");
while (pBookmark)
{
pChild->RemoveChild(pBookmark);
pBookmark = pChild->FirstChildElement("Bookmark");
}
wxString error;
if (!file.Save(&error))
{
if (COptions::Get()->GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2)
return true;
wxString msg = wxString::Format(_("Could not write \"%s\", the selected sites could not be exported: %s"), file.GetFileName().GetFullPath().c_str(), error.c_str());
wxMessageBoxEx(msg, _("Error writing xml file"), wxICON_ERROR);
}
return true;
}
示例3: XRCCTRL
bool CBookmarksDialog::Verify()
{
wxTreeItemId item = m_pTree->GetSelection();
if (!item)
return true;
CBookmarkItemData *data = (CBookmarkItemData *)m_pTree->GetItemData(item);
if (!data)
return true;
const CServer *server;
if (m_pTree->GetItemParent(item) == m_bookmarks_site)
server = m_server;
else
server = 0;
const wxString remotePathRaw = XRCCTRL(*this, "ID_BOOKMARK_REMOTEDIR", wxTextCtrl)->GetValue();
if (!remotePathRaw.empty())
{
CServerPath remotePath;
if (server)
remotePath.SetType(server->GetType());
if (!remotePath.SetPath(remotePathRaw))
{
XRCCTRL(*this, "ID_BOOKMARK_REMOTEDIR", wxTextCtrl)->SetFocus();
if (server)
{
wxString msg;
if (server->GetType() != DEFAULT)
msg = wxString::Format(_("Remote path cannot be parsed. Make sure it is a valid absolute path and is supported by the current site's servertype (%s)."), server->GetNameFromServerType(server->GetType()));
else
msg = _("Remote path cannot be parsed. Make sure it is a valid absolute path.");
wxMessageBoxEx(msg);
}
else
wxMessageBoxEx(_("Remote path cannot be parsed. Make sure it is a valid absolute path."));
return false;
}
}
const wxString localPath = XRCCTRL(*this, "ID_BOOKMARK_LOCALDIR", wxTextCtrl)->GetValue();
if (remotePathRaw.empty() && localPath.empty())
{
XRCCTRL(*this, "ID_BOOKMARK_LOCALDIR", wxTextCtrl)->SetFocus();
wxMessageBoxEx(_("You need to enter at least one path, empty bookmarks are not supported."));
return false;
}
bool sync = XRCCTRL(*this, "ID_BOOKMARK_SYNC", wxCheckBox)->GetValue();
if (sync && (localPath.empty() || remotePathRaw.empty()))
{
wxMessageBoxEx(_("You need to enter both a local and a remote path to enable synchronized browsing for this bookmark."), _("New bookmark"), wxICON_EXCLAMATION, this);
return false;
}
return true;
}
示例4: wxGetLocale
void CFileZillaApp::InitLocale()
{
wxString language = COptions::Get()->GetOption(OPTION_LANGUAGE);
const wxLanguageInfo* pInfo = wxLocale::FindLanguageInfo(language);
if (!language.empty()) {
#ifdef __WXGTK__
if (CInitializer::error) {
wxString error;
wxLocale *loc = wxGetLocale();
const wxLanguageInfo* currentInfo = loc ? loc->GetLanguageInfo(loc->GetLanguage()) : 0;
if (!loc || !currentInfo) {
if (!pInfo)
error.Printf(_("Failed to set language to %s, using default system language."),
language);
else
error.Printf(_("Failed to set language to %s (%s), using default system language."),
pInfo->Description, language);
}
else {
wxString currentName = currentInfo->CanonicalName;
if (!pInfo)
error.Printf(_("Failed to set language to %s, using default system language (%s, %s)."),
language, loc->GetLocale(),
currentName);
else
error.Printf(_("Failed to set language to %s (%s), using default system language (%s, %s)."),
pInfo->Description, language, loc->GetLocale(),
currentName);
}
error += _T("\n");
error += _("Please make sure the requested locale is installed on your system.");
wxMessageBoxEx(error, _("Failed to change language"), wxICON_EXCLAMATION);
COptions::Get()->SetOption(OPTION_LANGUAGE, _T(""));
}
#else
if (!pInfo || !SetLocale(pInfo->Language)) {
for( language = GetFallbackLocale(language); !language.empty(); language = GetFallbackLocale(language) ) {
const wxLanguageInfo* fallbackInfo = wxLocale::FindLanguageInfo(language);
if( fallbackInfo && SetLocale(fallbackInfo->Language )) {
COptions::Get()->SetOption(OPTION_LANGUAGE, language.ToStdWstring());
return;
}
}
COptions::Get()->SetOption(OPTION_LANGUAGE, std::wstring());
if (pInfo && !pInfo->Description.empty())
wxMessageBoxEx(wxString::Format(_("Failed to set language to %s (%s), using default system language"), pInfo->Description, language), _("Failed to change language"), wxICON_EXCLAMATION);
else
wxMessageBoxEx(wxString::Format(_("Failed to set language to %s, using default system language"), language), _("Failed to change language"), wxICON_EXCLAMATION);
}
#endif
}
}
示例5: while
wxString CLocalTreeView::GetDirFromItem(wxTreeItemId item)
{
const wxString separator = wxFileName::GetPathSeparator();
wxString dir;
while (item)
{
#ifdef __WXMSW__
if (item == m_desktop) {
wxChar path[MAX_PATH + 1];
if (SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, path) != S_OK) {
if (SHGetFolderPath(0, CSIDL_DESKTOP, 0, SHGFP_TYPE_CURRENT, path) != S_OK) {
wxMessageBoxEx(_("Failed to get desktop path"));
return _T("/");
}
}
dir = path;
if (dir.empty() || dir.Last() != separator)
dir += separator;
return dir;
}
else if (item == m_documents) {
wxChar path[MAX_PATH + 1];
if (SHGetFolderPath(0, CSIDL_PERSONAL, 0, SHGFP_TYPE_CURRENT, path) != S_OK) {
wxMessageBoxEx(_("Failed to get 'My Documents' path"));
return _T("/");
}
dir = path;
if (dir.empty() || dir.Last() != separator)
dir += separator;
return dir;
}
else if (item == m_drives)
return _T("/");
else if (GetItemParent(item) == m_drives) {
wxString text = GetItemText(item);
int pos = text.Find(_T(" "));
if (pos == -1)
return text + separator + dir;
else
return text.Left(pos) + separator + dir;
}
else
#endif
if (item == GetRootItem())
return _T("/") + dir;
dir = GetItemText(item) + separator + dir;
item = GetItemParent(item);
}
return separator;
}
示例6: mutex
bool CBookmarksDialog::AddBookmark(const wxString &name, const wxString &local_dir, const CServerPath &remote_dir, bool sync)
{
if (local_dir.empty() && remote_dir.empty())
return false;
if ((local_dir.empty() || remote_dir.empty()) && sync)
return false;
CInterProcessMutex mutex(MUTEX_GLOBALBOOKMARKS);
CXmlFile file(wxGetApp().GetSettingsFile(_T("bookmarks")));
TiXmlElement* pDocument = file.Load();
if (!pDocument) {
wxString msg = file.GetError() + _T("\n\n") + _("The bookmark could not be added.");
wxMessageBoxEx(msg, _("Error loading xml file"), wxICON_ERROR);
return false;
}
TiXmlElement *pInsertBefore = 0;
TiXmlElement *pBookmark;
for (pBookmark = pDocument->FirstChildElement("Bookmark"); pBookmark; pBookmark = pBookmark->NextSiblingElement("Bookmark")) {
wxString remote_dir_raw;
wxString old_name = GetTextElement(pBookmark, "Name");
if (!name.CmpNoCase(old_name)) {
wxMessageBoxEx(_("Name of bookmark already exists."), _("New bookmark"), wxICON_EXCLAMATION);
return false;
}
if (name < old_name && !pInsertBefore)
pInsertBefore = pBookmark;
}
if (pInsertBefore)
pBookmark = pDocument->InsertBeforeChild(pInsertBefore, TiXmlElement("Bookmark"))->ToElement();
else
pBookmark = pDocument->LinkEndChild(new TiXmlElement("Bookmark"))->ToElement();
AddTextElement(pBookmark, "Name", name);
if (!local_dir.empty())
AddTextElement(pBookmark, "LocalDir", local_dir);
if (!remote_dir.empty())
AddTextElement(pBookmark, "RemoteDir", remote_dir.GetSafePath());
if (sync)
AddTextElementRaw(pBookmark, "SyncBrowsing", "1");
if (!file.Save(false)) {
wxString msg = wxString::Format(_("Could not write \"%s\", the bookmark could not be added: %s"), file.GetFileName(), file.GetError());
wxMessageBoxEx(msg, _("Error writing xml file"), wxICON_ERROR);
return false;
}
return true;
}
示例7: RenameFile
bool RenameFile(wxWindow* parent, wxString dir, wxString from, wxString to)
{
if (dir.Right(1) != _T("\\") && dir.Right(1) != _T("/"))
dir += wxFileName::GetPathSeparator();
#ifdef __WXMSW__
to = to.Left(255);
if ((to.Find('/') != -1) ||
(to.Find('\\') != -1) ||
(to.Find(':') != -1) ||
(to.Find('*') != -1) ||
(to.Find('?') != -1) ||
(to.Find('"') != -1) ||
(to.Find('<') != -1) ||
(to.Find('>') != -1) ||
(to.Find('|') != -1))
{
wxMessageBoxEx(_("Filenames may not contain any of the following characters: / \\ : * ? \" < > |"), _("Invalid filename"), wxICON_EXCLAMATION, parent);
return false;
}
SHFILEOPSTRUCT op;
memset(&op, 0, sizeof(op));
from = dir + from + _T(" ");
from.SetChar(from.Length() - 1, '\0');
op.pFrom = from.wc_str();
to = dir + to + _T(" ");
to.SetChar(to.Length()-1, '\0');
op.pTo = to.wc_str();
op.hwnd = (HWND)parent->GetHandle();
op.wFunc = FO_RENAME;
op.fFlags = FOF_ALLOWUNDO;
return SHFileOperation(&op) == 0;
#else
if ((to.Find('/') != -1) ||
(to.Find('*') != -1) ||
(to.Find('?') != -1) ||
(to.Find('<') != -1) ||
(to.Find('>') != -1) ||
(to.Find('|') != -1))
{
wxMessageBoxEx(_("Filenames may not contain any of the following characters: / * ? < > |"), _("Invalid filename"), wxICON_EXCLAMATION, parent);
return false;
}
return wxRename(dir + from, dir + to) == 0;
#endif
}
示例8: SetDefaultValues
COptions::COptions()
{
m_theOptions = this;
m_pXmlFile = 0;
m_pLastServer = 0;
SetDefaultValues();
m_save_timer.SetOwner(this);
auto const nameOptionMap = GetNameOptionMap();
LoadGlobalDefaultOptions(nameOptionMap);
CLocalPath const dir = InitSettingsDir();
CInterProcessMutex mutex(MUTEX_OPTIONS);
m_pXmlFile = new CXmlFile(dir.GetPath() + _T("filezilla.xml"));
if (!m_pXmlFile->Load()) {
wxString msg = m_pXmlFile->GetError() + _T("\n\n") + _("For this session the default settings will be used. Any changes to the settings will not be saved.");
wxMessageBoxEx(msg, _("Error loading xml file"), wxICON_ERROR);
delete m_pXmlFile;
m_pXmlFile = 0;
}
else
CreateSettingsXmlElement();
LoadOptions(nameOptionMap);
}
示例9: GetNextItem
void CLocalListView::OnMenuEnter(wxCommandEvent &event)
{
int item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1)
{
wxBell();
return;
}
if (GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1)
{
wxBell();
return;
}
CLocalFileData *data = GetData(item);
if (!data || !data->dir)
{
wxBell();
return;
}
wxString error;
if (!m_pState->SetLocalDir(data->name, &error))
{
if (error != _T(""))
wxMessageBoxEx(error, _("Failed to change directory"), wxICON_INFORMATION);
else
wxBell();
}
}
示例10: OnData
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
{
if (def == wxDragError ||
def == wxDragNone ||
def == wxDragCancel)
return def;
if( def == wxDragLink ) {
def = wxDragCopy;
}
wxTreeItemId hit = GetHit(wxPoint(x, y));
if (!hit)
return wxDragNone;
const CLocalPath path(GetDirFromItem(hit));
if (path.empty() || !path.IsWriteable())
return wxDragNone;
if (!GetData())
return wxDragError;
CDragDropManager* pDragDropManager = CDragDropManager::Get();
if (pDragDropManager)
pDragDropManager->pDropTarget = m_pLocalTreeView;
if (m_pDataObject->GetReceivedFormat() == m_pFileDataObject->GetFormat())
m_pLocalTreeView->m_pState->HandleDroppedFiles(m_pFileDataObject, path, def == wxDragCopy);
else
{
if (m_pRemoteDataObject->GetProcessId() != (int)wxGetProcessId())
{
wxMessageBoxEx(_("Drag&drop between different instances of FileZilla has not been implemented yet."));
return wxDragNone;
}
if (!m_pLocalTreeView->m_pState->GetServer() || !m_pRemoteDataObject->GetServer().EqualsNoPass(*m_pLocalTreeView->m_pState->GetServer()))
{
wxMessageBoxEx(_("Drag&drop between different servers has not been implemented yet."));
return wxDragNone;
}
if (!m_pLocalTreeView->m_pState->DownloadDroppedFiles(m_pRemoteDataObject, path))
return wxDragNone;
}
return def;
}
示例11: _
void CFilterDialog::OnSaveAs(wxCommandEvent& event)
{
CInputDialog dlg;
dlg.Create(this, _("Enter name for filterset"), _("Please enter a unique name for this filter set"));
if (dlg.ShowModal() != wxID_OK)
return;
wxString name = dlg.GetValue();
if (name.empty())
{
wxMessageBoxEx(_("No name for the filterset given."), _("Cannot save filterset"), wxICON_INFORMATION);
return;
}
wxChoice* pChoice = XRCCTRL(*this, "ID_SETS", wxChoice);
CFilterSet set;
int old_pos = pChoice->GetSelection();
if (old_pos > 0)
set = m_filterSets[old_pos];
else
set = m_filterSets[0];
int pos = pChoice->FindString(name);
if (pos != wxNOT_FOUND)
{
if (wxMessageBoxEx(_("Given filterset name already exists, overwrite filter set?"), _("Filter set already exists"), wxICON_QUESTION | wxYES_NO) != wxYES)
return;
}
if (pos == wxNOT_FOUND)
{
pos = m_filterSets.size();
m_filterSets.push_back(set);
pChoice->Append(name);
}
else
m_filterSets[pos] = set;
m_filterSets[pos].name = name;
pChoice->SetSelection(pos);
m_currentFilterSet = pos;
SetCtrlState();
GetSizer()->Fit(this);
}
示例12: wxMessageBoxEx
bool COptionsPage::DisplayError(wxWindow* pWnd, const wxString& error)
{
if (pWnd)
pWnd->SetFocus();
wxMessageBoxEx(error, _("Failed to validate settings"), wxICON_EXCLAMATION, this);
return false;
}
示例13: OnCheck
void OnCheck(wxCommandEvent& event)
{
if (!event.GetSelection() && !event.IsChecked())
{
wxCheckListBox* pListBox = XRCCTRL(*this, "ID_ACTIVE", wxCheckListBox);
pListBox->Check(0);
wxMessageBoxEx(_("The filename column can neither be hidden nor moved."), _("Column properties"));
}
}
示例14: wxGetApp
void CContextControl::CreateTab()
{
wxGetApp().AddStartupProfileRecord(_T("CContextControl::CreateTab"));
Freeze();
CState* pState = 0;
// See if we can reuse an existing context
for (size_t i = 0; i < m_context_controls.size(); i++)
{
if (m_context_controls[i].tab_index != -1)
continue;
if (m_context_controls[i].pState->IsRemoteConnected() ||
!m_context_controls[i].pState->IsRemoteIdle())
continue;
pState = m_context_controls[i].pState;
m_context_controls.erase(m_context_controls.begin() + i);
if (m_current_context_controls > (int)i)
m_current_context_controls--;
break;
}
if (!pState)
{
pState = CContextManager::Get()->CreateState(m_pMainFrame);
if (!pState->CreateEngine())
{
wxMessageBoxEx(_("Failed to initialize FTP engine"));
}
}
// Restore last server and path
CServer last_server;
CServerPath last_path;
if (COptions::Get()->GetLastServer(last_server) && last_path.SetSafePath(COptions::Get()->GetOption(OPTION_LASTSERVERPATH)))
pState->SetLastServer(last_server, last_path);
CreateContextControls(pState);
pState->GetRecursiveOperationHandler()->SetQueue(m_pMainFrame->GetQueue());
wxString localDir = COptions::Get()->GetOption(OPTION_LASTLOCALDIR);
if (!pState->SetLocalDir(localDir))
pState->SetLocalDir(_T("/"));
CContextManager::Get()->SetCurrentContext(pState);
if (!m_pMainFrame->RestoreSplitterPositions())
m_pMainFrame->SetDefaultSplitterPositions();
if (m_tabs)
m_tabs->SetSelection(m_tabs->GetPageCount() - 1);
Thaw();
}
示例15: mutex
void CFilterDialog::SaveFilters()
{
CInterProcessMutex mutex(MUTEX_FILTERS);
CXmlFile xml(wxGetApp().GetSettingsFile(_T("filters")));
TiXmlElement* pDocument = xml.Load();
if (!pDocument) {
wxString msg = xml.GetError() + _T("\n\n") + _("Any changes made to the filters could not be saved.");
wxMessageBoxEx(msg, _("Error loading xml file"), wxICON_ERROR);
return;
}
TiXmlElement *pFilters = pDocument->FirstChildElement("Filters");
while (pFilters) {
pDocument->RemoveChild(pFilters);
pFilters = pDocument->FirstChildElement("Filters");
}
pFilters = pDocument->LinkEndChild(new TiXmlElement("Filters"))->ToElement();
for (auto const& filter : m_globalFilters) {
TiXmlElement* pElement = new TiXmlElement("Filter");
SaveFilter(pElement, filter);
pFilters->LinkEndChild(pElement);
}
TiXmlElement *pSets = pDocument->FirstChildElement("Sets");
while (pSets) {
pDocument->RemoveChild(pSets);
pSets = pDocument->FirstChildElement("Sets");
}
pSets = pDocument->LinkEndChild(new TiXmlElement("Sets"))->ToElement();
SetTextAttribute(pSets, "Current", wxString::Format(_T("%d"), m_currentFilterSet));
for (auto const& set : m_globalFilterSets) {
TiXmlElement* pSet = pSets->LinkEndChild(new TiXmlElement("Set"))->ToElement();
if (!set.name.empty()) {
AddTextElement(pSet, "Name", set.name);
}
for (unsigned int i = 0; i < set.local.size(); ++i) {
TiXmlElement* pItem = pSet->LinkEndChild(new TiXmlElement("Item"))->ToElement();
AddTextElement(pItem, "Local", set.local[i] ? _T("1") : _T("0"));
AddTextElement(pItem, "Remote", set.remote[i] ? _T("1") : _T("0"));
}
}
xml.Save(true);
m_filters_disabled = false;
}