]> git.saurik.com Git - wxWidgets.git/blame - include/wx/textcompleter.h
Comment-only update
[wxWidgets.git] / include / wx / textcompleter.h
CommitLineData
ea98f11c
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/textcompleter.h
3// Purpose: Declaration of wxTextCompleter class.
4// Author: Vadim Zeitlin
5// Created: 2011-04-13
ea98f11c
VZ
6// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7// Licence: wxWindows licence
8///////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_TEXTCOMPLETER_H_
11#define _WX_TEXTCOMPLETER_H_
12
13// ----------------------------------------------------------------------------
14// wxTextCompleter: used by wxTextEnter::AutoComplete()
15// ----------------------------------------------------------------------------
16
17class WXDLLIMPEXP_CORE wxTextCompleter
18{
19public:
20 wxTextCompleter() { }
21
85047589
VZ
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;
ea98f11c
VZ
28
29 virtual ~wxTextCompleter();
30
31private:
32 wxDECLARE_NO_COPY_CLASS(wxTextCompleter);
33};
34
85047589
VZ
35// ----------------------------------------------------------------------------
36// wxTextCompleterSimple: returns the entire set of completions at once
37// ----------------------------------------------------------------------------
38
39class WXDLLIMPEXP_CORE wxTextCompleterSimple : public wxTextCompleter
40{
41public:
42 wxTextCompleterSimple() { }
43
44 // Must be implemented to return all the completions for the given prefix.
45 virtual void GetCompletions(const wxString& prefix, wxArrayString& res) = 0;
46
47 virtual bool Start(const wxString& prefix);
48 virtual wxString GetNext();
49
50private:
51 wxArrayString m_completions;
52 unsigned m_index;
53
54 wxDECLARE_NO_COPY_CLASS(wxTextCompleterSimple);
55};
56
ed7dda92
VZ
57// ----------------------------------------------------------------------------
58// wxTextCompleterFixed: Trivial wxTextCompleter implementation which always
59// returns the same fixed array of completions.
60// ----------------------------------------------------------------------------
61
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.
65
66class wxTextCompleterFixed : public wxTextCompleterSimple
67{
68public:
69 void SetCompletions(const wxArrayString& strings)
70 {
71 m_strings = strings;
72 }
73
74 virtual void GetCompletions(const wxString& WXUNUSED(prefix),
75 wxArrayString& res)
76 {
77 res = m_strings;
78 }
79
80private:
81 wxArrayString m_strings;
82};
83
84
ea98f11c 85#endif // _WX_TEXTCOMPLETER_H_
85047589 86