]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxEditor.h
Created a bbs editor : bbed
[bbtk.git] / kernel / src / bbtkWxEditor.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxEditor.h,v $
5   Language:  C++
6   Date:      $Date: 2008/03/18 12:51:26 $
7   Version:   $Revision: 1.1 $
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 __bbtkWxEditor_h__
37 #define __bbtkWxEditor_h__
38
39
40 #include "bbtkWx.h"
41
42 #include "bbtkInterpreter.h"
43
44 namespace bbtk
45 {
46
47   class WxStreamRedirector;
48   class WxTextCtrlGettingKeyEvents;
49
50   /// A bbs editor panel
51   class BBTK_EXPORT WxEditor : public wxPanel
52   {
53   public:
54     WxEditor( wxWindow *parent );
55     ~WxEditor();
56
57     void OnKeyPress(wxKeyEvent& event);
58
59     void OnButtonNew(wxCommandEvent& event);
60     void OnButtonOpen(wxCommandEvent& event);
61     void OnButtonSave(wxCommandEvent& event);
62     void OnButtonRun(wxCommandEvent& event);
63     void OnButtonQuit(wxCommandEvent& event);
64
65     void New();
66     void Open();
67     void Open(const std::string& filename);
68     bool AskSave();
69     void Save();
70     void Run();
71     void Quit();
72
73     void HighlightSyntax();
74     
75   private:
76     Interpreter* mInterpreter;
77     WxTextCtrlGettingKeyEvents* mwxInputText;
78     wxTextAttr* mwxInputTextAttr;
79     WxTextCtrlGettingKeyEvents* mwxOutputText;
80     wxTextAttr* mwxOutputTextAttr;
81     wxBitmapButton *  mwxButtonNew; 
82     wxButton *  mwxButtonOpen; 
83     wxButton *  mwxButtonSave; 
84     wxButton *  mwxButtonRun; 
85     wxButton *  mwxButtonQuit; 
86     WxStreamRedirector* mRedirect_cout;
87     WxStreamRedirector* mRedirect_cerr;
88    public:
89           
90      enum
91     {
92       ID_InputText,
93       ID_OutputText,
94       ID_ButtonNew,
95       ID_ButtonOpen,
96       ID_ButtonSave,
97       ID_ButtonRun,
98       ID_ButtonQuit
99     };
100     
101     DECLARE_EVENT_TABLE()
102         
103   };
104
105
106   /// Editor in a frame 
107   class BBTK_EXPORT WxEditorWindow : public wxFrame
108   {
109   public:
110     WxEditorWindow( wxWindow *parent, wxString title, wxSize size);
111     ~WxEditorWindow();
112   };
113   
114 } // namespace bbtk
115
116
117 #endif // __bbtkWxEditor_h__
118
119 #endif //_USE_WXWIDGETS_