X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkWxGUITextEditor.h;fp=kernel%2Fsrc%2FbbtkWxGUITextEditor.h;h=0f08e15c7b09d2c5aa3ee2bb5e3fce3fa3c06325;hb=fc399c5aab38ad24ea5d57552701411b4d805181;hp=77f712671cc86a2d941eadd1eeca97c1b6e4d6ff;hpb=0bfd6ea8a50ca866039ce1eabdb8df2b3a0330b1;p=bbtk.git diff --git a/kernel/src/bbtkWxGUITextEditor.h b/kernel/src/bbtkWxGUITextEditor.h index 77f7126..0f08e15 100644 --- a/kernel/src/bbtkWxGUITextEditor.h +++ b/kernel/src/bbtkWxGUITextEditor.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUITextEditor.h,v $ Language: C++ - Date: $Date: 2008/03/21 11:46:41 $ - Version: $Revision: 1.1 $ + Date: $Date: 2008/03/21 14:59:39 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -49,13 +49,65 @@ namespace bbtk { class WxTextCtrlGettingKeyEvents; - class WxGUITextEditorPage; + class WxGUITextEditor; + + + /// Abstract class which defines the callbacks invoked by WxGUITextEditor + class BBTK_EXPORT WxGUITextEditorUser + { + public: + WxGUITextEditorUser() {} + ~WxGUITextEditorUser() {} + /// Callback invoked when the 'run' button is pressed + virtual void WxGUITextEditorRun() {} + }; + + //================================================================ + class WxGUITextEditorPage : public wxPanel + { + public: + WxGUITextEditorPage(wxWindow* parent, WxGUITextEditor* editor); + ~WxGUITextEditorPage(); + + void SetPageName(const std::string& name) { mName = name; } + const std::string& GetPageName() const { return mName; } + + bool AskFilename() const { return mAskFilename; } + + WxTextCtrlGettingKeyEvents* GetTextCtrl() { return mwxInputText; } + + void Load(const std::string& filename); + void Save(const std::string& filter); - /// A bbs editor panel + bool IsModified(); //{ return mwxInputText->IsModified(); } + + std::string GetText(); + + private: + WxGUITextEditor* mEditor; + WxTextCtrlGettingKeyEvents* mwxInputText; + wxTextAttr* mwxInputTextAttr; + std::string mName; + bool mAskFilename; + + /* + enum + { + ID_InputText + }; + */ + //DECLARE_EVENT_TABLE(); + + } ; + //================================================================ + + + + /// A text editor panel class BBTK_EXPORT WxGUITextEditor : public wxPanel { public: - WxGUITextEditor( wxWindow *parent ); + WxGUITextEditor( wxWindow *parent, WxGUITextEditorUser* user = 0 ); ~WxGUITextEditor(); void OnKeyDown(wxKeyEvent& event); @@ -64,7 +116,7 @@ namespace bbtk void OnButtonNew(wxCommandEvent& event); void OnButtonOpen(wxCommandEvent& event); void OnButtonSave(wxCommandEvent& event); - // void OnButtonRun(wxCommandEvent& event); + void OnButtonRun(wxCommandEvent& event); // void OnButtonQuit(wxCommandEvent& event); void OnPageClose(wxAuiNotebookEvent& evt); @@ -72,7 +124,7 @@ namespace bbtk void Open(); void Open(const std::string& filename); void Save(); - // void Run(); + // void Run(); // void Quit(); void HighlightSyntax(); @@ -86,6 +138,8 @@ namespace bbtk { mFileNameFilter = filter; } private: + WxGUITextEditorUser* mUser; + wxAuiManager m_mgr; wxAuiNotebook* mwxNotebook; @@ -95,7 +149,7 @@ namespace bbtk wxButton * mwxButtonNew; wxButton * mwxButtonOpen; wxButton * mwxButtonSave; - // wxButton * mwxButtonRun; + wxButton * mwxButtonRun; // wxButton * mwxButtonQuit; wxStaticText* mwxPosition; @@ -107,8 +161,8 @@ namespace bbtk { ID_ButtonNew, ID_ButtonOpen, - ID_ButtonSave - // ID_ButtonRun, + ID_ButtonSave, + ID_ButtonRun // ID_ButtonQuit };