]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUIScriptingInterface.h
=== MAJOR RELEASE ====
[bbtk.git] / kernel / src / bbtkWxGUIScriptingInterface.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxGUIScriptingInterface.h,v $
5   Language:  C++
6   Date:      $Date: 2008/04/18 12:59:16 $
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 __bbtkWxGUIScriptingInterface_h__
37 #define __bbtkWxGUIScriptingInterface_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 "bbtkWxGUITextEditor.h"
48 #include "bbtkWxGUICommand.h"
49 #include "bbtkWxGUIOutputMessages.h"
50 #include "bbtkWxGUIHtmlBrowser.h"
51
52 namespace bbtk
53 {
54
55   /// A scripting interface window
56   class BBTK_EXPORT WxGUIScriptingInterface : public wxFrame, 
57                                               public InterpreterUser,
58                                               public WxGUICommandUser,
59                                               public WxGUITextEditorUser,
60                                               public WxGUIHtmlBrowserUser
61   {
62   public:
63     WxGUIScriptingInterface( wxWindow *parent, wxString title, wxSize size);
64     ~WxGUIScriptingInterface();
65
66     /// Returns the Interpreter used 
67     /// ONLY ONE FOR THE MOMENT BUT IN THE FUTURE CAN BE DIFFERENT 
68     /// (DIFFERENT WORKSPACES)
69     Interpreter::Pointer GetInterpreter() const { return mInterpreter; }
70
71     /// Sets the inputs of the workspace : 
72     /// the map is passed as is to the Executer
73     void SetInputs(const std::map<std::string,std::string>& m)
74     { mInterpreter->SetInputs(m); }
75     
76     /// Puts the executer in "no exec" mode, 
77     /// which creates but does not execute pipelines.
78     void SetNoExecMode(bool b) { mInterpreter->SetNoExecMode(b); }
79
80     void SetDialogMode(Interpreter::DialogModeType t) 
81     { mInterpreter->SetDialogMode(t); }
82     
83     /// Runs the interpretation of a file
84     /// Returns false on error
85     bool InterpretFile( const std::string& filename);
86
87     void Open(const std::string& filename);
88
89
90     void OnMenuQuit(wxCommandEvent& event);
91     void OnMenuAbout(wxCommandEvent& event);
92     void OnMenuEditConfig(wxCommandEvent& WXUNUSED(event));
93     void OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event));
94     void OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event));
95     void OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event));
96     void OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event));
97     void OnMenuWindowsFiles(wxCommandEvent& event);
98     void OnMenuWindowsHelp(wxCommandEvent& event);
99     void OnMenuWindowsMessages(wxCommandEvent& event);
100     void OnMenuWindowsCommand(wxCommandEvent& event);
101     void OnMenuWindowsSave( wxCommandEvent& WXUNUSED(event));
102     void OnMenuWindowsCheck( wxCommandEvent& event, 
103                              wxWindow* w);
104     void OnPaneClose(wxAuiManagerEvent& evt);
105    
106
107     // void OnButtonRun(wxCommandEvent& WXUNUSED(event));
108
109     // Interpreter callbacks
110     bool InterpreterUserHasOwnHtmlPageViewer() { return true; }
111     void InterpreterUserViewHtmlPage(const std::string&);
112
113     // WxGUICommand callbacks
114     void WxGUICommandEnter(const std::string&);
115
116     // WxGUITextEditor callbacks
117     void WxGUITextEditorRun();
118     
119     // WxGUIHtmlBrowser callbacks
120     bool WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target);
121   private:
122     wxAuiManager m_mgr;
123     Interpreter::Pointer mInterpreter;
124
125     
126 //EED    wxNotebook* mwxNotebook;
127 //    wxAuiNotebook* mwxNotebook;
128 //    wxPanel *mwxPageCommand, *mwxPageHelp;
129
130     WxGUICommand* mWxGUICommand;
131     WxGUIOutputMessages* mWxGUIOutputMessages;
132     WxGUIHtmlBrowser* mWxGUIHtmlBrowser;
133     WxGUITextEditor* mWxGUITextEditor;
134
135     wxMenuItem* mwxMenuItemReset;
136     //    wxButton* mwxButtonRun;
137
138   public:
139           
140  
141     DECLARE_EVENT_TABLE()
142         
143   };
144
145   
146 } // namespace bbtk
147
148
149 #endif // __bbtkWxGUIScriptingInterface_h__
150
151 #endif //_USE_WXWIDGETS_