3 * Main frame header file
5 * Nicolas Boichat, April 2004
9 Copyright (C) 2004 Kern Sibbald and John Walker
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License
13 as published by the Free Software Foundation; either version 2
14 of the License, or (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #ifndef WXBMAINFRAME_H
27 #define WXBMAINFRAME_H
29 #include "wx/wxprec.h"
35 // for all others, include the necessary headers (this file is usually all you
36 // need because it includes almost all "standard" wxWindows headers)
41 #include <wx/textctrl.h>
42 #include <wx/tokenzr.h>
43 #include <wx/notebook.h>
46 //#include "console_conf.h"
48 #include "console_thread.h"
52 // ----------------------------------------------------------------------------
53 // wxbPrintObject - Used by wxbThreadEvent to contain data sent by director
54 // ----------------------------------------------------------------------------
56 class wxbPrintObject: public wxObject {
60 wxbPrintObject(wxString str, int status): wxObject() {
62 this->status = status;
65 wxbPrintObject(const wxbPrintObject& pe) {
67 this->status = pe.status;
71 // ----------------------------------------------------------------------------
72 // wxbThreadEvent - Event used by wxbTHREAD_EVENT
73 // ----------------------------------------------------------------------------
75 class wxbThreadEvent: public wxEvent {
77 wxbThreadEvent(int id);
79 wxbThreadEvent(const wxbThreadEvent& te);
80 virtual wxEvent *Clone() const;
81 wxbPrintObject* GetEventPrintObject();
82 void SetEventPrintObject(wxbPrintObject* object);
85 // Define a new frame type: this is going to be our main frame
86 class wxbMainFrame : public wxFrame
89 /* this class is a singleton */
90 static wxbMainFrame* CreateInstance(const wxString& title, const wxPoint& pos, const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
91 static wxbMainFrame* GetInstance();
93 /* event handlers (these functions should _not_ be virtual) */
94 void OnQuit(wxCommandEvent& event);
95 void OnAbout(wxCommandEvent& event);
96 void OnEnter(wxCommandEvent& event);
97 void OnPrint(wxbThreadEvent& event);
99 /* Enable and disable panels */
101 void DisablePanels(void* except = NULL);
103 void EnableConsole(bool enable = true);
106 * Prints data received from director to the console,
107 * and forwards it to the panels
109 void Print(wxString str, int status);
111 /* Sends data to the director */
112 void Send(wxString str);
115 * Starts the thread interacting with the director
117 void StartConsoleThread();
120 /* private constructor, singleton */
121 wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style);
124 wxNotebook *notebook; /* main notebook */
125 wxTextCtrl *typeCtrl; /* wxTextCtrl for console user input */
126 wxTextCtrl *consoleCtrl; /* wxTextCtrl containing graphical console */
128 wxbPanel **panels; /* panels array, contained in the notebook, and which need to receive console communication */
130 console_thread* ct; /* thread interacting with the director */
132 static wxbMainFrame *frame; /* this */
134 // any class wishing to process wxWindows events must use this macro
135 DECLARE_EVENT_TABLE()
138 #endif // WXBMAINFRAME_H