wxArrayString choices;
64parent,
id,
wxT(
""), wxDefaultPosition, wxDefaultSize,
65choices, wxCB_DROPDOWN
72 constwxString&
value,
75 constwxArrayString& choices,
77 constwxValidator& validator,
85Create( parent,
id,
value, pos,
size, choices, style | wxCB_DROPDOWN, validator, name );
109 constwxString&
value,
112 constwxArrayString& choices,
114 constwxValidator& validator,
120wxComboBox::Create( parent,
id,
value, pos,
size, choices, style, validator, name );
141wxString
value= GetValue();
147 if(GetCount()) Delete(0);
156 _TRACE(
"CAutoCompleteCombo::OnTextChanged "<<
ToStdString(event.GetString()));
165(event.GetString().length() <=
m_PrevValue.length()) ){
174wxString cur_value =
event.GetString();
175 longcur_pt = GetInsertionPoint();
178cur_value = cur_value.Mid( 0, cur_value.Len() -1 );
190wxArrayString new_base_choices =
ProvideItems( cur_value );
193wxString cur_low =
m_IgnoreCase? cur_value.Lower() : cur_value;
194 unsigned intmatched_ix = 0;
195 while( matched_ix < compare_to->GetCount() ){
196wxString cmp_str =
m_IgnoreCase? (*compare_to)[matched_ix].Lower() : (*compare_to)[matched_ix];
198 if( cmp_str.StartsWith( cur_low ) ){
203 if( matched_ix == compare_to->GetCount() ){
220SetValue( cur_value );
221SetInsertionPoint( cur_pt );
235wxString cur_value =
event.GetString();
236 longcur_pt = GetInsertionPoint();
242 boolto_be_completed = cur_pt == GetLastPosition();
269 _TRACE(
"CAutoCompleteCombo::OnItemSelected index "<< event.GetSelection() );
271wxString cur_value =
m_IgnoreCase? GetValue().Lower() : GetValue();
274 if( cur_value.StartsWith( prev_value ) ){
275SetInsertionPoint( (
long)prev_value.Length() );
276SetSelection( (
int)prev_value.Length(), -1 );
279 if( cur_value.StartsWith( prev_value ) ){
280SetInsertionPoint( (
long)prev_value.Length() );
281SetSelection( (
int)prev_value.Length(), -1 );
296 _TRACE(
"CAutoCompleteCombo::OnKeyDown "<< event.GetKeyCode() );
298 intkc =
event.GetKeyCode();
301 if( (kc == WXK_BACK || kc == WXK_CLEAR) ){
302 #if defined(__WXMAC__) 303 if( GetSelection() == GetLastPosition() ){
308GetSelection( &from, &to );
309 if( from != to && to == GetLastPosition() ){
321 _TRACE(
"CAutoCompleteCombo::OnIdle");
338wxString orig_value = GetValue();
339wxString prefix =
m_IgnoreCase? orig_value.Lower() : orig_value;
341 for(
unsigned int i= 0;
i< GetCount();
i++ ){
342wxString
value= GetString(
i);
344 if( str_value.StartsWith( prefix ) ){
346 if(
value!= orig_value) {
348SetSelection( (
int)prefix.Len(), -1 );
357wxArrayString wx_items;
360vector<string> items;
364 for(
int i= 0;
i< (
int)items.size();
i++ ){
374wxArrayString new_choices;
375wxString pat_low =
m_IgnoreCase? pattern.Lower() : pattern;
379 if( base_choice.StartsWith( pat_low ) ){
#define DICTIONARY_MAX_SIZE
CAutoCompleteCombo(wxWindow *parent, wxWindowID id=wxID_ANY)
wxArrayString m_PrevArray
void SetBaseItems(const wxArrayString &choices)
wxArrayString GetFilteredItems(const wxString &pattern)
void x_OnTimer(wxTimerEvent &event)
wxArrayString m_BaseChoices
void GetBaseItems(wxArrayString &choices)
virtual wxArrayString ProvideItems(const wxString &pattern)
void OnIdle(wxIdleEvent &event)
bool m_BlockTextChangedEvents
void OnKeyDown(wxKeyEvent &event)
bool m_IgnoreNextTextChangedEvent
void x_AutoComplete()
Completes value from available choices.
virtual ~CAutoCompleteCombo()
void OnItemSelected(wxCommandEvent &event)
CIRef< IFilterItems > m_Provider
void Create(wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style=wxCB_DROPDOWN, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxT("auto complete combo"))
void OnTextChanged(wxCommandEvent &event)
bool IsNull(void) const THROWS_NONE
Check if pointer is null â same effect as Empty().
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4