2 Copyright (C) 2004 Kern Sibbald and John Walker
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef WXBMAINFRAME_H
20 #define WXBMAINFRAME_H
22 #include "wx/wxprec.h"
28 // for all others, include the necessary headers (this file is usually all you
29 // need because it includes almost all "standard" wxWindows headers)
34 #include <wx/textctrl.h>
35 #include <wx/tokenzr.h>
36 #include <wx/notebook.h>
39 //#include "console_conf.h"
41 #include "console_thread.h"
45 // ----------------------------------------------------------------------------
46 // wxbPrintObject - Used by wxbThreadEvent to contain data sent by director
47 // ----------------------------------------------------------------------------
49 class wxbPrintObject: public wxObject {
53 wxbPrintObject(wxString str, int status): wxObject() {
55 this->status = status;
58 wxbPrintObject(const wxbPrintObject& pe) {
60 this->status = pe.status;
64 // ----------------------------------------------------------------------------
65 // wxbThreadEvent - Event used by wxbTHREAD_EVENT
66 // ----------------------------------------------------------------------------
68 class wxbThreadEvent: public wxEvent {
70 wxbThreadEvent(int id);
72 wxbThreadEvent(const wxbThreadEvent& te);
73 virtual wxEvent *Clone() const;
74 wxbPrintObject* GetEventPrintObject();
75 void SetEventPrintObject(wxbPrintObject* object);
78 // Define a new frame type: this is going to be our main frame
79 class wxbMainFrame : public wxFrame
82 /* this class is a singleton */
83 static wxbMainFrame* CreateInstance(const wxString& title, const wxPoint& pos, const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
84 static wxbMainFrame* GetInstance();
86 // event handlers (these functions should _not_ be virtual)
87 void OnQuit(wxCommandEvent& event);
88 void OnAbout(wxCommandEvent& event);
89 void OnEnter(wxCommandEvent& event);
90 void OnPrint(wxbThreadEvent& event);
93 * Prints data received from director to the console,
94 * and forwards it to the panels
96 void Print(wxString str, int status);
98 /* Sends data to the director */
99 void Send(wxString str);
102 * Starts the thread interacting with the director
104 void StartConsoleThread();
107 /* private constructor, singleton */
108 wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style);
111 wxNotebook *notebook; /* main notebook */
112 wxTextCtrl *typeCtrl; /* wxTextCtrl for console user input */
113 wxTextCtrl *consoleCtrl; /* wxTextCtrl containing graphical console */
115 wxbPanel **panels; /* panels array, contained in the notebook, and which need to receive console communication */
117 console_thread* ct; /* thread interacting with the director */
119 static wxbMainFrame *frame; /* this */
121 // any class wishing to process wxWindows events must use this macro
122 DECLARE_EVENT_TABLE()
125 #endif // WXBMAINFRAME_H