1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/textcompleter.h
3 // Purpose: Declaration of wxTextCompleter class.
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_TEXTCOMPLETER_H_
11 #define _WX_TEXTCOMPLETER_H_
13 // ----------------------------------------------------------------------------
14 // wxTextCompleter: used by wxTextEnter::AutoComplete()
15 // ----------------------------------------------------------------------------
17 class WXDLLIMPEXP_CORE wxTextCompleter
22 // The virtual functions to be implemented by the derived classes: the
23 // first one is called to start preparing for completions for the given
24 // prefix and, if it returns true, GetNext() is called until it returns an
25 // empty string indicating that there are no more completions.
26 virtual bool Start(const wxString
& prefix
) = 0;
27 virtual wxString
GetNext() = 0;
29 virtual ~wxTextCompleter();
32 wxDECLARE_NO_COPY_CLASS(wxTextCompleter
);
35 // ----------------------------------------------------------------------------
36 // wxTextCompleterSimple: returns the entire set of completions at once
37 // ----------------------------------------------------------------------------
39 class WXDLLIMPEXP_CORE wxTextCompleterSimple
: public wxTextCompleter
42 wxTextCompleterSimple() { }
44 // Must be implemented to return all the completions for the given prefix.
45 virtual void GetCompletions(const wxString
& prefix
, wxArrayString
& res
) = 0;
47 virtual bool Start(const wxString
& prefix
);
48 virtual wxString
GetNext();
51 wxArrayString m_completions
;
54 wxDECLARE_NO_COPY_CLASS(wxTextCompleterSimple
);
57 // ----------------------------------------------------------------------------
58 // wxTextCompleterFixed: Trivial wxTextCompleter implementation which always
59 // returns the same fixed array of completions.
60 // ----------------------------------------------------------------------------
62 // NB: This class is private and intentionally not documented as it is
63 // currently used only for implementation of completion with the fixed list
64 // of strings only by wxWidgets itself, do not use it outside of wxWidgets.
66 class wxTextCompleterFixed
: public wxTextCompleterSimple
69 void SetCompletions(const wxArrayString
& strings
)
74 virtual void GetCompletions(const wxString
& WXUNUSED(prefix
),
81 wxArrayString m_strings
;
85 #endif // _WX_TEXTCOMPLETER_H_