summaryrefslogtreecommitdiff
path: root/ui/folder_history_box.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:29:28 +0200
commit75c07011b7c4d06acd7b45dabdcd60ab9d80f385 (patch)
tree8853c3978dd152ef377e652239448b1352320206 /ui/folder_history_box.h
parent5.22 (diff)
downloadFreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.gz
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.tar.bz2
FreeFileSync-75c07011b7c4d06acd7b45dabdcd60ab9d80f385.zip
5.23
Diffstat (limited to 'ui/folder_history_box.h')
-rw-r--r--ui/folder_history_box.h97
1 files changed, 0 insertions, 97 deletions
diff --git a/ui/folder_history_box.h b/ui/folder_history_box.h
deleted file mode 100644
index 9ffa2d74..00000000
--- a/ui/folder_history_box.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// **************************************************************************
-// * 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 (zenju AT gmx DOT de) - All Rights Reserved *
-// **************************************************************************
-
-#ifndef CUSTOMCOMBOBOX_H_INCLUDED
-#define CUSTOMCOMBOBOX_H_INCLUDED
-
-#include <wx/combobox.h>
-#include <memory>
-#include <zen/zstring.h>
-#include <zen/stl_tools.h>
-#include <zen/utf.h>
-
-//combobox with history function + functionality to delete items (DEL)
-
-
-class FolderHistory
-{
-public:
- FolderHistory() : maxSize_(0) {}
-
- FolderHistory(const std::vector<Zstring>& dirnames, size_t maxSize) :
- maxSize_(maxSize),
- dirnames_(dirnames)
- {
- if (dirnames_.size() > maxSize_) //keep maximal size of history list
- dirnames_.resize(maxSize_);
- }
-
- const std::vector<Zstring>& getList() const { return dirnames_; }
-
- static const wxString separationLine() { return L"---------------------------------------------------------------------------------------------------------------"; }
-
- void addItem(const Zstring& dirname)
- {
- if (dirname.empty() || dirname == zen::utfCvrtTo<Zstring>(separationLine()))
- return;
-
- Zstring nameTmp = dirname;
- zen::trim(nameTmp);
-
- //insert new folder or put it to the front if already existing
- auto it = std::find_if(dirnames_.begin(), dirnames_.end(),
- [&](const Zstring& entry) { return ::EqualFilename()(entry, nameTmp); });
-
- if (it != dirnames_.end())
- dirnames_.erase(it);
- dirnames_.insert(dirnames_.begin(), nameTmp);
-
- if (dirnames_.size() > maxSize_) //keep maximal size of history list
- dirnames_.resize(maxSize_);
- }
-
- void delItem(const Zstring& dirname) { zen::vector_remove_if(dirnames_, [&](const Zstring& entry) { return ::EqualFilename()(entry, dirname); }); }
-
-private:
-
- size_t maxSize_;
- std::vector<Zstring> dirnames_;
-};
-
-
-class FolderHistoryBox : public wxComboBox
-{
-public:
- FolderHistoryBox(wxWindow* parent,
- wxWindowID id,
- const wxString& value = wxEmptyString,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- int n = 0,
- const wxString choices[] = nullptr,
- long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxComboBoxNameStr);
-
- void init(const std::shared_ptr<FolderHistory>& sharedHistory) { sharedHistory_ = sharedHistory; }
-
- void setValue(const wxString& dirname)
- {
- setValueAndUpdateList(dirname); //required for setting value correctly; Linux: ensure the dropdown is shown as being populated
- }
-
- // GetValue
-
-private:
- void OnKeyEvent(wxKeyEvent& event);
- void OnRequireHistoryUpdate(wxEvent& event);
- void setValueAndUpdateList(const wxString& dirname);
-
- std::shared_ptr<FolderHistory> sharedHistory_;
-};
-
-
-#endif // CUSTOMCOMBOBOX_H_INCLUDED
bgstack15