Code::Blocks  SVN r11506
incremental_select_helper.h
Go to the documentation of this file.
1 
2 /*
3  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
4  * http://www.gnu.org/licenses/lgpl-3.0.html
5  */
6 
7 #ifndef INCREMENTALSELECTLISTBASE_H
8 #define INCREMENTALSELECTLISTBASE_H
9 
10 #include "settings.h"
11 #include <wx/dialog.h>
12 #include <wx/string.h>
13 #include <wx/event.h>
14 #include <vector>
15 
16 #ifndef CB_PRECOMP
17  #include <wx/listctrl.h>
18 #endif // CB_PRECOMP
19 
20 class wxCommandEvent;
21 class wxKeyEvent;
22 class wxListEvent;
23 class wxTextCtrl;
24 
25 
27 {
28  public:
29  virtual ~IncrementalSelectIterator();
30 
31  virtual int GetFilteredCount() const = 0;
32  virtual void Reset() = 0;
33  virtual void AddIndex(int index) = 0;
34  virtual int GetUnfilteredIndex(int index) const = 0;
35 
36  virtual int GetTotalCount() const = 0;
37  virtual const wxString& GetItemFilterString(int index) const = 0;
38  virtual wxString GetDisplayText(int index, int column) const = 0;
39 
40  virtual int GetColumnWidth(int column) const;
41  virtual void CalcColumnWidth(wxListCtrl &list);
42 
43 };
44 
46 {
47  public:
49 
50  int GetFilteredCount() const override;
51  void Reset() override;
52  void AddIndex(int index) override;
53  int GetUnfilteredIndex(int index) const override;
54  protected:
55  std::vector<int> m_indices;
56 };
57 
59 {
60  public:
62  ~IncrementalSelectHandler() override;
63 
64  void Init(wxListCtrl *list, wxTextCtrl *text);
65  void DeInit(wxWindow *window);
66  void FilterItems();
67  int GetSelection();
68 
69  private:
70  void OnKeyDown(wxKeyEvent &event);
71  void OnTextChanged(wxCommandEvent &event);
72  void OnItemActivated(wxListEvent &event);
73 
74  private:
79 };
80 
83 {
84  public:
86  const wxSize& size = wxDefaultSize, long style = wxLC_ICON,
87  const wxValidator &validator = wxDefaultValidator,
88  const wxString &name = wxListCtrlNameStr);
89 
90  wxString OnGetItemText(long item, long column) const override;
91  void SetIterator(IncrementalSelectIterator *iterator);
92  private:
94 };
95 
98 {
99  public:
101 
102  int GetTotalCount() const override;
103  const wxString& GetItemFilterString(int index) const override;
104  wxString GetDisplayText(int index, int column) const override;
105  int GetColumnWidth(int column) const override;
106  void CalcColumnWidth(wxListCtrl &list) override;
107  private:
110 };
111 
115 {
116  public:
117  IncrementalSelectDialog(wxWindow* parent, IncrementalSelectIterator *iterator, const wxString &title,
118  const wxString &message);
119  ~IncrementalSelectDialog() override;
120 
121  int GetSelection();
122  private:
124  private:
127  protected:
128  void BuildContent(wxWindow* parent, IncrementalSelectIterator *iterator, const wxString &title,
129  const wxString &message);
130 
131  DECLARE_EVENT_TABLE()
132 };
133 
134 #endif // INCREMENTALSELECTLISTBASE_H
135 
virtual const wxString & GetItemFilterString(int index) const =0
virtual int GetFilteredCount() const =0
virtual int GetUnfilteredIndex(int index) const =0
IncrementalSelectHandler m_handler
const wxValidator wxDefaultValidator
IncrementalSelectIterator * m_Iterator
virtual int GetColumnWidth(int column) const
virtual void AddIndex(int index)=0
virtual wxString GetDisplayText(int index, int column) const =0
#define DLLIMPORT
Definition: settings.h:16
virtual void Reset()=0
virtual int GetTotalCount() const =0
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
#define wxLC_ICON
Class that implements a virtual list control that uses an IncrementalSelectIterator to populate the l...
virtual wxString OnGetItemText(long item, long column) const
virtual void CalcColumnWidth(wxListCtrl &list)
IncrementalSelectIterator * m_iterator
Simple iterator that uses wxArrayString as data source.
Simple incremental select dialog that shows a single column and doesn&#39;t have much ui elements...
int wxWindowID
IncrementalListCtrl * m_resultList