22#define HIGHLIGHTCOLOR wxColour(0,0,139)
53 ret.Add(sString.substr(0, sString.find(
'~')));
54 sString.erase(0, sString.find(
'~')+1);
56 while (sString.length());
73 return wxListView::GetItemText(
m_ListId);
91 wxChar chr =
event.GetUnicodeKey();
98 if (event.ControlDown() && event.AltDown())
103 m_combo->WriteText(
'@');
106 m_combo->WriteText(
'~');
109 m_combo->WriteText(
'{');
112 m_combo->WriteText(
'[');
115 m_combo->WriteText(
']');
118 m_combo->WriteText(
'}');
121 m_combo->WriteText(
'\\');
124 m_combo->WriteText(
'|');
128 else if (chr >=
'A' && chr < WXK_DELETE)
130 if (event.ShiftDown())
131 m_combo->WriteText(chr);
133 m_combo->WriteText(wxChar(chr +
'a'-
'A'));
135 else if (chr < 32 || chr == WXK_DELETE)
140 m_combo->Remove(m_combo->GetInsertionPoint()-1, m_combo->GetInsertionPoint());
143 m_combo->Remove(m_combo->GetInsertionPoint(), m_combo->GetInsertionPoint()+1);
149 if (GetItemCount() && !GetFirstSelected())
151 else if (GetFirstSelected())
160 if (!event.ShiftDown())
165 m_combo->WriteText(
'ö');
168 m_combo->WriteText(
'ä');
171 m_combo->WriteText(
'ü');
174 m_combo->WriteText(
'ß');
177 m_combo->WriteText(chr);
185 m_combo->WriteText(
'_');
188 m_combo->WriteText(
':');
191 m_combo->WriteText(
';');
194 m_combo->WriteText(
'>');
197 m_combo->WriteText(
'\'');
200 m_combo->WriteText(
'*');
203 m_combo->WriteText(
'!');
206 m_combo->WriteText(
'"');
209 m_combo->WriteText(
'§');
212 m_combo->WriteText(
'$');
215 m_combo->WriteText(
'%');
218 m_combo->WriteText(
'&');
221 m_combo->WriteText(
'/');
224 m_combo->WriteText(
'(');
227 m_combo->WriteText(
')');
230 m_combo->WriteText(
'=');
233 m_combo->WriteText(
'Ö');
236 m_combo->WriteText(
'Ä');
239 m_combo->WriteText(
'Ü');
242 m_combo->WriteText(
'?');
250 switch (event.GetKeyCode())
253 if (!GetSelectedItemCount() || !GetFirstSelected())
254 Select(GetItemCount()-1);
256 Select(GetFirstSelected()-1);
258 EnsureVisible(GetFirstSelected());
261 m_combo->SetInsertionPoint(m_combo->GetInsertionPoint()-1);
264 if (!GetSelectedItemCount() || GetFirstSelected() == GetItemCount()-1)
267 Select(GetFirstSelected()+1);
269 EnsureVisible(GetFirstSelected());
272 m_combo->SetInsertionPoint(m_combo->GetInsertionPoint()+1);
275 m_combo->SetInsertionPoint(0);
278 m_combo->SetInsertionPointEnd();
297 m_ListId = wxListView::GetFirstSelected();
313 int id = HitTest(event.GetPosition(), flags,
nullptr);
315 if (
id != wxNOT_FOUND && (flags & wxLIST_HITTEST_ONITEM) && wxListView::GetFirstSelected() !=
id)
317 wxListView::Select(
id);
337 wxString token =
static_cast<SearchCtrl*
>(m_combo)->getDragDropText(event.GetText());
345 wxTextDataObject _dataObject(token);
346 wxDropSource dragSource(
this);
347 dragSource.SetData(_dataObject);
348 dragSource.DoDragDrop(wxDrag_AllowMove);
369 for (
size_t i = 0; i <
m_sizes.size(); i++)
370 AppendColumn(wxEmptyString, wxLIST_FORMAT_LEFT,
m_sizes[i]);
374 for (
size_t i = 0; i < stringArray.size(); i++)
377 InsertItem(i, stringArray[i]);
380 wxArrayString strings =
split(stringArray[i]);
381 InsertItem(i, strings[0]);
384 SetItem(i, j, strings[j]);
450 wxArrayString stringArray(1, &enteredText);
467 wxString value = GetValue();
501 if (candidates.size())
503 int insertionPoint = GetInsertionPoint();
507 if (IsPopupWindowState(wxComboCtrl::Hidden))
511 SetInsertionPoint(insertionPoint);
532 if (GetValue().length() > 2 && IsPopupWindowState(wxComboCtrl::Hidden))
536 SetInsertionPointEnd();
Implementation of a generic search control based on a combo box.
virtual wxArrayString getCandidates(const wxString &enteredText)
Child classes must override this member function to provide the candidates to be filled into the popu...
void OnMouseEnter(wxMouseEvent &event)
This event handler will show the drop down list, if the text field contains data and the mouse enters...
void OnItemSelect(wxCommandEvent &event)
This event handler function will be fired, if the user selects a proposed string in the opened dropdo...
virtual wxString getDragDropText(const wxString &value)
Child classes may override this member function to provide a custom string for the built-in drag-drop...
void OnTextChange(wxCommandEvent &event)
This event handler function will be fired, if the user changes the text in the control....
virtual bool selectItem(const wxString &value)
Child classes may override this member function to do something, when the user selects an item in the...
wxBEGIN_EVENT_TABLE(SearchCtrlPopup, wxListView) wxEND_EVENT_TABLE() wxArrayString SearchCtrlPopup
This private member function splits the passed string at every '~' character in single strings,...