]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIConsole.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxGUIConsole.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxGUIConsole.h,v $
5   Language:  C++
6   Date:      $Date: 2008/04/24 12:56:39 $
7   Version:   $Revision: 1.5 $
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 __bbtkWxGUIConsole_h__
37 #define __bbtkWxGUIConsole_h__
38
39 #include <wx/aui/aui.h>
40 #include "bbtkWx.h"
41 #include <wx/notebook.h>
42 #include <wx/html/htmlwin.h>
43
44
45 #include "bbtkInterpreter.h"
46
47 #include "bbtkWxGUICommand.h"
48 #include "bbtkWxGUIOutputMessages.h"
49 #include "bbtkWxGUIHtmlBrowser.h"
50
51 namespace bbtk
52 {
53
54   /// A console in which user can enter commands
55   class BBTK_EXPORT WxGUIConsole : public wxFrame, 
56                                    public InterpreterUser,
57                                    public WxGUICommandUser
58   {
59   public:
60     WxGUIConsole( wxWindow *parent, wxString title, wxSize size);
61     ~WxGUIConsole();
62
63     /// Returns the Interpreter used 
64     /// ONLY ONE FOR THE MOMENT BUT IN THE FUTURE CAN BE DIFFERENT 
65     /// (DIFFERENT WORKSPACES)
66     //Interpreter::Pointer GetInterpreter() { return mInterpreter; }
67     /// Returns the Interpreter used (const)
68     Interpreter::Pointer GetInterpreter() const { return mInterpreter; }
69
70     /// Sets the inputs of the workspace : 
71     /// the map is passed as is to the Executer
72     void SetInputs(const std::map<std::string,std::string>& m)
73     { mInterpreter->SetInputs(m); }
74     
75     /// Puts the executer in "no exec" mode, 
76     /// which creates but does not execute pipelines.
77     void SetNoExecMode(bool b) { mInterpreter->SetNoExecMode(b); }
78
79         void SetDialogMode(Interpreter::DialogModeType t) 
80     { mInterpreter->SetDialogMode(t); }
81     
82     /// Runs the interpretation of a file
83     /// Returns false on error
84     bool InterpretFile( const std::string& filename);
85
86
87     void OnMenuQuit(wxCommandEvent& event);
88     void OnMenuAbout(wxCommandEvent& event);
89     void OnMenuEditConfig(wxCommandEvent& WXUNUSED(event));
90     void OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event));
91     void OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event));
92     void OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event));
93     void OnMenuShowHTMLDoc(wxCommandEvent& WXUNUSED(event));
94     void OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event));
95    
96
97     void OnButtonRun(wxCommandEvent& WXUNUSED(event));
98
99     // Interpreter callbacks
100     bool InterpreterUserHasOwnHtmlPageViewer() { return true; }
101     void InterpreterUserViewHtmlPage(const std::string&);
102
103     // WxGUICommand callbacks
104     void WxGUICommandEnter(const std::string&);
105
106
107     // Overloaded Show method to handle bbtk::Wx::TopWindow auto-destruction
108     virtual bool Show(bool show = true);
109
110
111   private:
112     wxAuiManager m_mgr;
113     Interpreter::Pointer mInterpreter;
114
115     
116 //EED    wxNotebook* mwxNotebook;
117     wxAuiNotebook* mwxNotebook;
118     wxPanel *mwxPageCommand, *mwxPageHelp;
119
120     WxGUICommand* mWxGUICommand;
121     WxGUIOutputMessages* mWxGUIOutputMessages;
122     WxGUIHtmlBrowser* mWxGUIHtmlBrowser;
123     
124     wxButton* mwxButtonRun;
125
126   public:
127     
128     // Callback invoked by bbtk top window when something changes
129     void OnWxSignal();
130     DECLARE_EVENT_TABLE()
131         
132   };
133
134   
135 } // namespace bbtk
136
137
138 #endif // __bbtkWxGUIConsole_h__
139
140 #endif //_USE_WXWIDGETS_