diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:16 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:21:16 +0200 |
commit | 6d15812d7d93370d47e63f6bf9f70be40f5a9c5d (patch) | |
tree | 8e7bde205084ca23e1766d42305824c927c2ee5f /ui/folder_history_box.cpp | |
parent | 5.6 (diff) | |
download | FreeFileSync-6d15812d7d93370d47e63f6bf9f70be40f5a9c5d.tar.gz FreeFileSync-6d15812d7d93370d47e63f6bf9f70be40f5a9c5d.tar.bz2 FreeFileSync-6d15812d7d93370d47e63f6bf9f70be40f5a9c5d.zip |
5.7
Diffstat (limited to 'ui/folder_history_box.cpp')
-rw-r--r-- | ui/folder_history_box.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/ui/folder_history_box.cpp b/ui/folder_history_box.cpp index 2b773c20..528a36ce 100644 --- a/ui/folder_history_box.cpp +++ b/ui/folder_history_box.cpp @@ -1,7 +1,7 @@ // ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) ZenJu (zhnmju123 AT gmx DOT de) - All Rights Reserved * +// * Copyright (C) ZenJu (zenju AT gmx DOT de) - All Rights Reserved * // ************************************************************************** #include "folder_history_box.h" @@ -12,6 +12,10 @@ using namespace zen; +namespace +{ +const wxEventType wxEVT_VALIDATE_USER_SELECTION = wxNewEventType(); +} FolderHistoryBox::FolderHistoryBox(wxWindow* parent, wxWindowID id, @@ -41,6 +45,8 @@ FolderHistoryBox::FolderHistoryBox(wxWindow* parent, Connect(wxEVT_COMMAND_COMBOBOX_DROPDOWN, wxCommandEventHandler(FolderHistoryBox::OnShowDropDown), nullptr, this); Connect(wxEVT_COMMAND_COMBOBOX_CLOSEUP, wxCommandEventHandler(FolderHistoryBox::OnHideDropDown), nullptr, this); #endif + +Connect(wxEVT_VALIDATE_USER_SELECTION, wxCommandEventHandler(FolderHistoryBox::OnValidateSelection), nullptr, this); } @@ -78,7 +84,7 @@ void FolderHistoryBox::setValueAndUpdateList(const wxString& dirname) //std::sort(tmp.begin(), tmp.end(), LessFilename()); if (!dirList.empty() && !tmp.empty()) - dirList.push_back(FolderHistory::lineSeparator()); + dirList.push_back(toZ(FolderHistory::separationLine())); dirList.insert(dirList.end(), tmp.begin(), tmp.end()); } @@ -99,10 +105,22 @@ void FolderHistoryBox::setValueAndUpdateList(const wxString& dirname) void FolderHistoryBox::OnSelection(wxCommandEvent& event) { + wxCommandEvent dummy2(wxEVT_VALIDATE_USER_SELECTION); //we cannot replace built-in commands at this position in call stack, so defer to a later time! + if (auto handler = GetEventHandler()) + handler->AddPendingEvent(dummy2); + event.Skip(); } +void FolderHistoryBox::OnValidateSelection(wxCommandEvent& event) +{ + //const auto& value = GetValue(); + //if (value == FolderHistory::separationLine()) + // setValueAndUpdateList(wxString()); -> not good enough (resolved folder name not updated) +} + + void FolderHistoryBox::OnKeyEvent(wxKeyEvent& event) { const int keyCode = event.GetKeyCode(); |