]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIConsole.h
Feature #1774
[bbtk.git] / kernel / src / bbtkWxGUIConsole.h
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
6  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9  #
10  #  This software is governed by the CeCILL-B license under French law and
11  #  abiding by the rules of distribution of free software. You can  use,
12  #  modify and/ or redistribute the software under the terms of the CeCILL-B
13  #  license as circulated by CEA, CNRS and INRIA at the following URL
14  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15  #  or in the file LICENSE.txt.
16  #
17  #  As a counterpart to the access to the source code and  rights to copy,
18  #  modify and redistribute granted by the license, users are provided only
19  #  with a limited warranty  and the software's author,  the holder of the
20  #  economic rights,  and the successive licensors  have only  limited
21  #  liability.
22  #
23  #  The fact that you are presently reading this means that you have had
24  #  knowledge of the CeCILL-B license and that you accept its terms.
25  # ------------------------------------------------------------------------ */
26
27
28 /*=========================================================================
29   Program:   bbtk
30   Module:    $RCSfile: bbtkWxGUIConsole.h,v $
31   Language:  C++
32   Date:      $Date: 2012/11/16 08:49:01 $
33   Version:   $Revision: 1.8 $
34 =========================================================================*/
35
36
37
38
39 /**
40  * \brief Short description in one line
41  * 
42  * Long description which 
43  * can span multiple lines
44  */
45 /**
46  * \file 
47  * \brief 
48  */
49 /**
50  * \class bbtk::
51  * \brief 
52  */
53
54
55 #ifdef _USE_WXWIDGETS_
56
57         
58 #ifndef __bbtkWxGUIConsole_h__
59 #define __bbtkWxGUIConsole_h__
60
61 #include <wx/aui/aui.h>
62 #include "bbtkWx.h"
63 #include <wx/notebook.h>
64 #include <wx/html/htmlwin.h>
65
66
67 #include "bbtkInterpreter.h"
68
69 #include "bbtkWxGUICommand.h"
70 #include "bbtkWxGUIOutputMessages.h"
71 #include "bbtkWxGUIHtmlBrowser.h"
72
73 namespace bbtk
74 {
75
76   /// A console in which user can enter commands
77   class BBTK_EXPORT WxGUIConsole : public wxFrame, 
78                                    public InterpreterUser,
79                                    public WxGUICommandUser
80   {
81   public:
82     WxGUIConsole( wxWindow *parent, wxString title, wxSize size);
83     ~WxGUIConsole();
84
85     /// Returns the Interpreter used 
86     /// ONLY ONE FOR THE MOMENT BUT IN THE FUTURE CAN BE DIFFERENT 
87     /// (DIFFERENT WORKSPACES)
88     //Interpreter::Pointer GetInterpreter() { return mInterpreter; }
89     /// Returns the Interpreter used (const)
90     Interpreter::Pointer GetInterpreter() const { return mInterpreter; }
91
92     /// Sets the inputs of the workspace : 
93     /// the map is passed as is to the Executer
94     void SetInputs(const std::map<std::string,std::string>& m)
95     { mInterpreter->SetInputs(m); }
96     
97     /// Puts the executer in "no exec" mode, 
98     /// which creates but does not execute pipelines.
99     void SetNoExecMode(bool b) { mInterpreter->SetNoExecMode(b); }
100
101         void SetDialogMode(Interpreter::DialogModeType t) 
102     { mInterpreter->SetDialogMode(t); }
103     
104     /// Runs the interpretation of a file
105     /// Returns false on error
106     bool InterpretFile( const std::string& filename);
107
108
109     void OnMenuQuit(wxCommandEvent& event);
110     void OnMenuAbout(wxCommandEvent& event);
111     void OnMenuEditConfig(wxCommandEvent& WXUNUSED(event));
112     void OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event));
113     void OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event));
114     void OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event));
115     void OnMenuShowHTMLDoc(wxCommandEvent& WXUNUSED(event));
116     void OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event));
117    
118
119     void OnButtonRun(wxCommandEvent& WXUNUSED(event));
120
121     // Interpreter callbacks
122     bool InterpreterUserHasOwnHtmlPageViewer() { return true; }
123     void InterpreterUserViewHtmlPage(const std::string&);
124
125     // WxGUICommand callbacks
126     void WxGUICommandEnter(const std::string&);
127
128
129     // Overloaded Show method to handle bbtk::Wx::TopWindow auto-destruction
130     virtual bool Show(bool show = true);
131
132     void OnClose(wxCloseEvent& event);
133
134
135   private:
136     wxAuiManager m_mgr;
137     Interpreter::Pointer mInterpreter;
138
139     
140 //EED    wxNotebook* mwxNotebook;
141     wxAuiNotebook* mwxNotebook;
142     wxPanel *mwxPageCommand, *mwxPageHelp;
143
144     WxGUICommand* mWxGUICommand;
145     WxGUIOutputMessages* mWxGUIOutputMessages;
146     WxGUIHtmlBrowser* mWxGUIHtmlBrowser;
147     
148     wxButton* mwxButtonRun;
149
150   public:
151     
152     // Callback invoked by bbtk top window when something changes
153     void OnWxSignal();
154     DECLARE_EVENT_TABLE()
155         
156   };
157
158   
159 } // namespace bbtk
160
161
162 #endif // __bbtkWxGUIConsole_h__
163
164 #endif //_USE_WXWIDGETS_