]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/wx-console/wxbhistorytextctrl.h
- Fix ANSI labels to put EOF1 and EOF2 after each file mark.
[bacula/bacula] / bacula / src / wx-console / wxbhistorytextctrl.h
1 /*
2  *
3  *   Text control with an history of commands typed
4  *
5  *    Nicolas Boichat, July 2004
6  *
7  *    Version $Id$
8  */
9 /*
10    Copyright (C) 2004 Kern Sibbald and John Walker
11
12    This program is free software; you can redistribute it and/or
13    modify it under the terms of the GNU General Public License
14    as published by the Free Software Foundation; either version 2
15    of the License, or (at your option) any later version.
16
17    This program is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20    GNU General Public License for more details.
21
22    You should have received a copy of the GNU General Public License
23    along with this program; if not, write to the Free Software
24    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifndef WXBHISTORYTEXTCTRL
28 #define WXBHISTORYTEXTCTRL
29
30 #include "wx/wxprec.h"
31
32 #ifndef WX_PRECOMP
33    #include "wx/wx.h"
34 #endif
35
36 #include <wx/treectrl.h>
37 #include <wx/hashmap.h>
38
39 WX_DECLARE_STRING_HASH_MAP( wxString, wxbCommands );
40
41 class wxbHistoryTextCtrl: public wxTextCtrl {
42    public:
43       wxbHistoryTextCtrl(wxStaticText* help, wxWindow* parent, wxWindowID id,
44          const wxString& value = "", const wxPoint& pos = wxDefaultPosition,
45          const wxSize& size = wxDefaultSize,
46          const wxValidator& validator = wxDefaultValidator,
47          const wxString& name = wxTextCtrlNameStr);
48
49       void HistoryAdd(wxString cmd);
50
51       void AddCommand(wxString cmd, wxString description);
52       void ClearCommandList();
53
54       virtual void SetValue(const wxString& value);
55    private:
56       wxArrayString history;
57       wxbCommands commands;
58       int index;
59       wxStaticText* help;
60
61       void OnKeyUp(wxKeyEvent& event);
62       void OnKeyDown(wxKeyEvent& event);
63
64       DECLARE_EVENT_TABLE();
65 };
66
67 #endif //WXBHISTORYTEXTCTRL