]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/wx-console/wxbutils.h
b7726a3fa413727df637dd18d16bec053d5063f4
[bacula/bacula] / bacula / src / wx-console / wxbutils.h
1 /*
2  *
3  *   wxbDataParser, class that receives and analyses data
4  *   wxbPanel, main frame's notebook panels
5  *
6  *    Nicolas Boichat, April 2004
7  *
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 WXBPANEL_H
28 #define WXBPANEL_H
29
30 #include "wx/wxprec.h"
31
32 #ifndef WX_PRECOMP
33    #include "wx/wx.h"
34 #endif
35
36 /*
37  *  abstract class that can receive director information.
38  */
39 class wxbDataParser
40 {
41    public:
42       /* Creates a new wxbDataParser, and register it in wxbMainFrame */
43       wxbDataParser();
44
45       /* Destroy a wxbDataParser, and unregister it in wxbMainFrame */
46       virtual ~wxbDataParser();
47
48       /*
49        *   Receives director information, forwarded by wxbMainFrame.
50        */
51       virtual void Print(wxString str, int status) = 0;
52 };
53
54 /*
55  *  abstract panel that can receive director information.
56  */
57 class wxbPanel : public wxPanel
58 {
59    public:
60       wxbPanel(wxWindow* parent) : wxPanel(parent) {}
61
62       /*
63        *   Tab title in the notebook.
64        */
65       virtual wxString GetTitle() = 0;
66       
67       /*
68        *   Enable or disable this panel
69        */
70       virtual void EnablePanel(bool enable = true) = 0;
71 };
72
73 /*
74  *  Receives director information, and splits it by line.
75  * 
76  * datatokenizer[0] retrieves first line
77  */
78 class wxbDataTokenizer: public wxbDataParser, public wxArrayString
79 {
80    public:
81       /* Creates a new wxbDataTokenizer */
82       wxbDataTokenizer();
83
84       /* Destroy a wxbDataTokenizer */
85       virtual ~wxbDataTokenizer();
86
87       /*
88        *   Receives director information, forwarded by wxbMainFrame.
89        */
90       virtual void Print(wxString str, int status);
91       
92       /* Returns true if the last signal received was an end signal, 
93        * indicating that no more data is available */
94       bool hasFinished();
95       
96    private:
97       bool finished;
98       wxString buffer;
99 };
100
101 #endif // WXBPANEL_H
102