33 return m_indices.size();
43 m_indices.push_back(index);
48 if (index >= 0 && index <
int(m_indices.size()))
49 return m_indices[index];
61 SetEvtHandlerEnabled(
true);
76 m_list->Connect(
wxEVT_KEY_DOWN, (wxObjectEventFunction)&IncrementalSelectHandler::OnKeyDown,
nullptr,
this);
89 m_list->Disconnect(
wxEVT_KEY_DOWN, (wxObjectEventFunction)&IncrementalSelectHandler::OnKeyDown,
nullptr,
this);
93 SetEvtHandlerEnabled(
false);
94 window->RemoveEventHandler(
this);
124 if (inputPattern.
empty())
127 for (
int ii = 0; ii < count; ++ii)
137 bool isWord = !inputPattern.
empty();
138 for (
auto ch : inputPattern)
147 std::vector<int> indices, promoted;
148 indices.reserve(100);
149 promoted.reserve(100);
160 size_t pos = 0, newPos;
161 bool isPromoted =
false;
181 promoted.push_back(i);
183 indices.push_back(i);
186 indices.push_back(i);
190 for (
auto i : promoted)
192 for (
auto i : indices)
198 #if !wxCHECK_VERSION(3, 0, 0) 244 selected = selectedMax;
257 else if (selected > selectedMax)
258 selected = selectedMax;
271 else if (selectedMax >= 0)
294 wxListCtrl(parent, winid, pos, size, style, validator, name)
310 m_items(items), m_columnWidth(300)
335 for (
const auto &item :
m_items)
337 int itemLength = item.
length();
338 if (length < itemLength)
364 m_handler(this, iterator)
366 BuildContent(parent, iterator, title, message);
368 m_handler.Init(m_resultList, m_text);
373 m_handler.DeInit(
this);
392 m_resultList->SetMinSize(
wxSize(500,300));
403 m_resultList->InsertColumn(0, column);
404 m_resultList->SetIterator(iterator);
409 return m_handler.GetSelection();
wxSize Fit(wxWindow *window)
virtual const wxString & GetItemFilterString(int index) const =0
virtual int GetFilteredCount() const =0
virtual int GetUnfilteredIndex(int index) const =0
bool Matches(const wxString &mask) const
int GetUnfilteredIndex(int index) const override
const wxValidator wxDefaultValidator
long GetNextItem(long item, int geometry=wxLIST_NEXT_ALL, int state=wxLIST_STATE_DONTCARE) const
IncrementalSelectIterator * m_Iterator
virtual int GetColumnWidth(int column) const
const wxArrayString & m_items
#define wxTE_PROCESS_ENTER
void BuildContent(wxWindow *parent, IncrementalSelectIterator *iterator, const wxString &title, const wxString &message)
wxString GetDisplayText(int index, int column) const override
#define wxLIST_STATE_SELECTED
int GetColumnWidth(int column) const override
virtual void AddIndex(int index)=0
virtual wxString GetDisplayText(int index, int column) const =0
int GetFilteredCount() const override
void SetItemCount(long count)
void Init(wxListCtrl *list, wxTextCtrl *text)
size_t find(const wxString &str, size_t nStart=0) const
void AddIndex(int index) override
IncrementalSelectArrayIterator(const wxArrayString &items)
~IncrementalSelectDialog() override
void OnKeyDown(wxKeyEvent &event)
bool SetItemState(long item, long state, long stateMask)
std::vector< int > m_indices
void SetIterator(IncrementalSelectIterator *iterator)
int GetTotalCount() const override
virtual int GetTotalCount() const =0
IncrementalListCtrl(wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_ICON, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxListCtrlNameStr)
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
~IncrementalSelectHandler() override
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
const wxString & GetItemFilterString(int index) const override
#define wxDEFAULT_DIALOG_STYLE
void FilterItemsFinalize(wxListCtrl &list, IncrementalSelectIterator &iterator)
IncrementalSelectHandler(wxDialog *parent, IncrementalSelectIterator *iterator)
const wxString & _(const wxString &string)
wxEventType wxEVT_KEY_DOWN
void DeInit(wxWindow *window)
Class that implements a virtual list control that uses an IncrementalSelectIterator to populate the l...
bool wxIsalpha(const wxUniChar &c)
int GetColumnCount() const
virtual void CalcColumnWidth(wxListCtrl &list)
virtual ~IncrementalSelectIterator()
void OnTextChanged(wxCommandEvent &event)
const long ID_RESULT_LIST
void SetSizeHints(wxWindow *window)
IncrementalSelectIterator * m_iterator
void CalcColumnWidth(wxListCtrl &list) override
void OnItemActivated(wxListEvent &event)
bool SetColumnWidth(int col, int width)
void SetText(const wxString &text)
Simple incremental select dialog that shows a single column and doesn't have much ui elements...
wxString OnGetItemText(long item, long column) const override
bool wxGetKeyState(wxKeyCode key)
bool EnsureVisible(long item)
static wxStandardID KeyDownAction(wxKeyEvent &event, int &selected, int selectedMax)