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