]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/wx-console/wxbhistorytextctrl.h
kes wx-console crashes because of differences between Bacula and wxWidgets
[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-2006 Kern Sibbald
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    version 2 as amended with additional clauses defined in the
15    file LICENSE in the main source directory.
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    the file LICENSE for additional details.
21
22  */
23
24 #ifndef WXBHISTORYTEXTCTRL
25 #define WXBHISTORYTEXTCTRL
26
27 #include "wx/wxprec.h"
28
29 #ifndef WX_PRECOMP
30    #include "wx/wx.h"
31 #endif
32
33 #include <wx/treectrl.h>
34 #include <wx/hashmap.h>
35
36 WX_DECLARE_STRING_HASH_MAP( wxString, wxbCommands );
37
38 class wxbHistoryTextCtrl: public wxTextCtrl {
39    public:
40       wxbHistoryTextCtrl(wxStaticText* help, wxWindow* parent, wxWindowID id,
41          const wxString& value = wxT(""), const wxPoint& pos = wxDefaultPosition,
42          const wxSize& size = wxDefaultSize,
43          const wxValidator& validator = wxDefaultValidator,
44          const wxString& name = wxTextCtrlNameStr);
45
46       void HistoryAdd(wxString cmd);
47
48       void AddCommand(wxString cmd, wxString description);
49       void ClearCommandList();
50
51       virtual void SetValue(const wxString& value);
52    private:
53       wxArrayString history;
54       wxbCommands commands;
55       int index;
56       wxStaticText* help;
57
58       void OnKeyUp(wxKeyEvent& event);
59       void OnKeyDown(wxKeyEvent& event);
60
61       DECLARE_EVENT_TABLE();
62 };
63
64 #endif //WXBHISTORYTEXTCTRL