]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxGUITextEditor.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxGUITextEditor.h
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxGUITextEditor.h,v $
5   Language:  C++
6   Date:      $Date: 2008/03/21 11:46:41 $
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 __bbtkWxGUITextEditor_h__
37 #define __bbtkWxGUITextEditor_h__
38
39
40 #include "bbtkWx.h"
41
42 #include "bbtkInterpreter.h"
43 #include <wx/splitter.h>
44 #include <wx/aui/aui.h>
45
46 #include "bbtkWxGUICommand.h"
47
48 namespace bbtk
49 {
50
51   class WxTextCtrlGettingKeyEvents;
52   class WxGUITextEditorPage;
53
54   /// A bbs editor panel
55   class BBTK_EXPORT WxGUITextEditor : public wxPanel
56   {
57   public:
58     WxGUITextEditor( wxWindow *parent );
59     ~WxGUITextEditor();
60
61     void OnKeyDown(wxKeyEvent& event);
62     void OnKeyUp(wxKeyEvent& event);
63
64     void OnButtonNew(wxCommandEvent& event);
65     void OnButtonOpen(wxCommandEvent& event);
66     void OnButtonSave(wxCommandEvent& event);
67     //    void OnButtonRun(wxCommandEvent& event);
68     //    void OnButtonQuit(wxCommandEvent& event);
69     void OnPageClose(wxAuiNotebookEvent& evt);
70
71     void New();
72     void Open();
73     void Open(const std::string& filename);
74     void Save();
75     //    void Run();
76     //    void Quit();
77
78     void HighlightSyntax();
79     void UpdateInfo();
80
81     void NewPage(const std::string& filename);
82     WxGUITextEditorPage* GetCurrentPage();
83     void FocusOnCurrentPage();
84
85     void SetFileNameFilter(const std::string& filter)
86     { mFileNameFilter = filter; }
87
88   private:
89     wxAuiManager m_mgr;
90     wxAuiNotebook* mwxNotebook;
91  
92     //   Interpreter* mInterpreter;
93     //    wxSplitterWindow* mwxSplit;
94
95     wxButton *  mwxButtonNew; 
96     wxButton *  mwxButtonOpen; 
97     wxButton *  mwxButtonSave; 
98     //    wxButton *  mwxButtonRun; 
99     //    wxButton *  mwxButtonQuit; 
100     wxStaticText* mwxPosition;
101
102     std::string mFileNameFilter;
103
104    public:
105           
106      enum
107     {
108       ID_ButtonNew,
109       ID_ButtonOpen,
110       ID_ButtonSave
111       //      ID_ButtonRun,
112       //      ID_ButtonQuit
113     };
114     
115     DECLARE_EVENT_TABLE()
116         
117   };
118
119   
120   /// Editor in a frame 
121   class BBTK_EXPORT WxGUITextEditorWindow : public wxFrame
122                                               //, public WxGUICommandUser
123   {
124   public:
125     WxGUITextEditorWindow( wxWindow *parent, wxString title, wxSize size);
126     ~WxGUITextEditorWindow();
127     void Open(const std::string& filename) { mEditor->Open(filename); }
128     //    void WxGUICommandEnter(const std::string& s);
129
130
131   private :
132     
133     WxGUITextEditor* mEditor;
134   };
135   
136
137 } // namespace bbtk
138
139
140 #endif // __bbtkWxGUITextEditor_h__
141
142 #endif //_USE_WXWIDGETS_