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