]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxConsole.h
Recreated the complete cvs tree because the project architecture deeply changed
[bbtk.git] / kernel / src / bbtkWxConsole.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxConsole.h,v $
5   Language:  C++
6   Date:      $Date: 2008/01/22 15:02:00 $
7   Version:   $Revision: 1.1.1.1 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*//**
18  * \brief Short description in one line
19  * 
20  * Long description which 
21  * can span multiple lines
22  */
23 /**
24  * \file 
25  * \brief 
26  */
27 /**
28  * \class bbtk::
29  * \brief 
30  */
31
32
33 #ifdef _USE_WXWIDGETS_
34
35         
36 #ifndef __bbtkWxConsole_h__
37 #define __bbtkWxConsole_h__
38
39
40 #include "bbtkWx.h"
41 #include <wx/notebook.h>
42 #include <wx/html/htmlwin.h>
43
44
45 #include "bbtkInterpreter.h"
46 #include "bbtkWxBrowser.h"
47
48 namespace bbtk
49 {
50
51   class WxTextCtrlStreamRedirector;
52
53   /// A console in which user can enter commands
54   class BBTK_EXPORT WxConsole : public wxFrame
55   {
56   public:
57     WxConsole( wxWindow *parent, wxString title, wxSize size);
58     ~WxConsole();
59
60     static WxConsole* GetInstance() { return mInstance; }
61
62     /// Sets the inputs of the workspace : 
63     /// the map is passed as is to the Executer
64     void SetInputs(const std::map<std::string,std::string>& m)
65     { mInterpreter->SetInputs(m); }
66     
67     /// Puts the executer in "no exec" mode, 
68     /// which creates but does not execute pipelines.
69     void SetNoExecMode(bool b) { mInterpreter->SetNoExecMode(b); }
70
71     void SetDialogMode(Interpreter::DialogModeType t) { mInterpreter->SetDialogMode(t); }
72     
73     /// Runs the interpretation of a file
74     void InterpretFile( const std::string& filename, bool use_configuration_file = true) 
75     { mInterpreter->InterpretFile(filename,use_configuration_file, false); }
76
77     void OnMenuQuit(wxCommandEvent& event);
78     void OnMenuAbout(wxCommandEvent& event);
79     void OnCommandEnter(wxCommandEvent& event);
80     void OnCommandChar(wxCommandEvent& event);
81
82     void ShowHtmlPage(std::string&);
83
84   private:
85     Interpreter* mInterpreter;
86     wxTextCtrl* mwxTextHistory;
87     wxTextCtrl* mwxTextCommand;
88     wxTextAttr* mwxTextHistoryAttr;
89     wxTextAttr* mwxTextCommandAttr;
90     wxNotebook* mwxNotebook;
91     wxPanel *mwxPageCommand, *mwxPageHelp;
92     WxTextCtrlStreamRedirector* mRedirect_cout;
93     WxTextCtrlStreamRedirector* mRedirect_cerr;
94
95     WxBrowser* mwxHtmlWindow;
96
97     static WxConsole* mInstance;
98   public:
99           
100      enum
101     {
102       ID_Menu_Quit = 1,
103       ID_Menu_About,
104     };
105     
106     DECLARE_EVENT_TABLE()
107         
108   };
109
110   
111 } // namespace bbtk
112
113
114 #endif // __bbtkWxConsole_h__
115
116 #endif //_USE_WXWIDGETS_