#include <bbtkWxGUITextEditor.h>
Public Member Functions | |
WxGUITextEditorPage (wxWindow *parent, WxGUITextEditor *editor) | |
~WxGUITextEditorPage () | |
void | SetPageName (const std::string &name) |
const std::string & | GetPageName () const |
bool | AskFilename () const |
void | SetAskFilename (bool a) |
WxTextCtrlGettingKeyEvents * | GetTextCtrl () |
void | Load (const std::string &filename) |
void | Save (const std::string &filter) |
void | SaveFile (const std::string &filename) |
bool | IsModified () |
std::string | GetText () |
Private Attributes | |
WxGUITextEditor * | mEditor |
WxTextCtrlGettingKeyEvents * | mwxInputText |
wxTextAttr * | mwxInputTextAttr |
wxFont * | mFixedFont |
std::string | mName |
bool | mAskFilename |
Definition at line 86 of file bbtkWxGUITextEditor.h.
bbtk::WxGUITextEditorPage::WxGUITextEditorPage | ( | wxWindow * | parent, | |
WxGUITextEditor * | editor | |||
) |
Definition at line 136 of file bbtkWxGUITextEditor.cxx.
References _T, mEditor, mFixedFont, mwxInputText, mwxInputTextAttr, and bbtk::WxTextCtrlGettingKeyEvents::SetWxGUITextEditor().
00138 : wxPanel(parent,-1), 00139 mEditor(editor), 00140 mName(""), 00141 mAskFilename(true) 00142 { 00143 00144 // std::cout << "WxGUITextEditorPage::WxGUITextEditorPage("<<mName<<")"<<std::endl; 00145 00146 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00147 00148 mwxInputText = 00149 00150 new WxTextCtrlGettingKeyEvents(this, 00151 -1, //ID_InputText, 00152 _T(""), 00153 wxDefaultPosition, 00154 wxDefaultSize, 00155 wxTE_MULTILINE 00156 // |wxTE_PROCESS_ENTER 00157 //| wxTE_PROCESS_TAB 00158 // | wxWANTS_CHARS 00159 // | wxTAB_TRAVERSAL 00160 ); 00161 mwxInputText->SetWxGUITextEditor(mEditor); 00162 /* 00163 new wxTextCtrl(this,-1,_T(""), 00164 wxDefaultPosition, 00165 wxDefaultSize, 00166 wxTE_MULTILINE 00167 // |wxTE_PROCESS_ENTER 00168 // | wxTE_PROCESS_TAB 00169 // | wxWANTS_CHARS 00170 // | wxTAB_TRAVERSAL 00171 ); 00172 */ 00173 mFixedFont = new wxFont(10, 00174 wxFONTFAMILY_MODERN, 00175 wxFONTSTYLE_NORMAL, 00176 wxFONTWEIGHT_NORMAL, 00177 false); 00178 00179 mwxInputTextAttr = new wxTextAttr; 00180 mwxInputTextAttr->SetFont(*mFixedFont); 00181 00182 sizer->Add(mwxInputText,1,wxGROW); 00183 SetSizer(sizer); 00184 SetAutoLayout(true); 00185 Layout(); 00186 }
bbtk::WxGUITextEditorPage::~WxGUITextEditorPage | ( | ) |
Definition at line 190 of file bbtkWxGUITextEditor.cxx.
References mFixedFont, and mwxInputTextAttr.
00191 { 00192 delete mwxInputTextAttr; 00193 delete mFixedFont; 00194 }
bool bbtk::WxGUITextEditorPage::AskFilename | ( | ) | const [inline] |
Definition at line 95 of file bbtkWxGUITextEditor.h.
References mAskFilename.
00095 { return mAskFilename; }
const std::string& bbtk::WxGUITextEditorPage::GetPageName | ( | ) | const [inline] |
Definition at line 93 of file bbtkWxGUITextEditor.h.
References mName.
Referenced by bbtk::WxGUITextEditor::UpdateInfo().
00093 { return mName; }
std::string bbtk::WxGUITextEditorPage::GetText | ( | ) |
Definition at line 200 of file bbtkWxGUITextEditor.cxx.
References GetTextCtrl(), and bbtk::wx2std().
Referenced by bbtk::WxGUIScriptingInterface::WxGUITextEditorRun().
00201 { 00202 return wx2std(GetTextCtrl()->GetValue()); 00203 }
WxTextCtrlGettingKeyEvents* bbtk::WxGUITextEditorPage::GetTextCtrl | ( | ) | [inline] |
Definition at line 98 of file bbtkWxGUITextEditor.h.
References mwxInputText.
Referenced by GetText(), and bbtk::WxGUITextEditor::UpdateInfo().
00098 { return mwxInputText; }
bool bbtk::WxGUITextEditorPage::IsModified | ( | ) |
Definition at line 197 of file bbtkWxGUITextEditor.cxx.
References mwxInputText.
Referenced by bbtk::WxGUITextEditor::CloseCurrentPage().
00198 { return mwxInputText->IsModified(); }
void bbtk::WxGUITextEditorPage::Load | ( | const std::string & | filename | ) |
Definition at line 206 of file bbtkWxGUITextEditor.cxx.
References mAskFilename, mName, mwxInputText, and bbtk::std2wx().
Referenced by bbtk::WxGUITextEditor::NewPage().
00207 { 00208 // std::cout << "-------------- LOAD ---------------"<<std::endl; 00209 // std::cout << "'" << filename << "'"<<std::endl; 00210 //std::string oldFilename = mFilename; 00211 mName = filename; 00212 mAskFilename = false; 00213 mwxInputText->LoadFile(std2wx(mName)); 00214 }
void bbtk::WxGUITextEditorPage::Save | ( | const std::string & | filter | ) |
Definition at line 218 of file bbtkWxGUITextEditor.cxx.
References _T, mAskFilename, mName, mwxInputText, SaveFile(), bbtk::std2wx(), and bbtk::wx2std().
Referenced by bbtk::WxGUITextEditor::CloseCurrentPage(), and bbtk::WxGUITextEditor::SaveCurrentPage().
00219 { 00220 // std::cout << "-------------- SAVE ---------------"<<std::endl; 00221 if (mAskFilename) 00222 { 00223 wxFileDialog* fd = new wxFileDialog(this,_T("Save file"),_T(""), 00224 _T(""),std2wx(filter), 00225 wxSAVE | wxOVERWRITE_PROMPT ); 00226 int result_fd = fd->ShowModal(); 00227 00228 // This line is need it by windows // EED 00229 fd->SetReturnCode( result_fd ); 00230 00231 if (fd->GetReturnCode()==wxID_OK) 00232 { 00233 mName = wx2std(fd->GetPath()); 00234 mAskFilename = false; 00235 } 00236 else 00237 { 00238 // std::cout << "-------------- CANCELLED ---------------" 00239 // <<std::endl; 00240 return; 00241 } 00242 } 00243 // std::cout << "file [" << mName << "]" <<std::endl; 00244 // mwxInputText->SaveFile(std2wx(mName)); 00245 SaveFile(mName); 00246 mwxInputText->SetModified(false); 00247 }
void bbtk::WxGUITextEditorPage::SaveFile | ( | const std::string & | filename | ) |
Definition at line 252 of file bbtkWxGUITextEditor.cxx.
References mwxInputText, and bbtk::std2wx().
Referenced by Save(), and bbtk::WxGUIScriptingInterface::WxGUITextEditorRunBBI().
00253 { 00254 mwxInputText->SaveFile( std2wx(filename) ); 00255 }
void bbtk::WxGUITextEditorPage::SetAskFilename | ( | bool | a | ) | [inline] |
Definition at line 96 of file bbtkWxGUITextEditor.h.
References mAskFilename.
Referenced by bbtk::WxGUITextEditor::OnToolLeftClick().
00096 { mAskFilename=a; }
void bbtk::WxGUITextEditorPage::SetPageName | ( | const std::string & | name | ) | [inline] |
Definition at line 92 of file bbtkWxGUITextEditor.h.
References mName.
Referenced by bbtk::WxGUITextEditor::NewPage().
00092 { mName = name; }
bool bbtk::WxGUITextEditorPage::mAskFilename [private] |
Definition at line 115 of file bbtkWxGUITextEditor.h.
Referenced by AskFilename(), Load(), Save(), and SetAskFilename().
wxFont* bbtk::WxGUITextEditorPage::mFixedFont [private] |
Definition at line 113 of file bbtkWxGUITextEditor.h.
Referenced by WxGUITextEditorPage(), and ~WxGUITextEditorPage().
std::string bbtk::WxGUITextEditorPage::mName [private] |
Definition at line 114 of file bbtkWxGUITextEditor.h.
Referenced by GetPageName(), Load(), Save(), and SetPageName().
Definition at line 111 of file bbtkWxGUITextEditor.h.
Referenced by GetTextCtrl(), IsModified(), Load(), Save(), SaveFile(), and WxGUITextEditorPage().
wxTextAttr* bbtk::WxGUITextEditorPage::mwxInputTextAttr [private] |
Definition at line 112 of file bbtkWxGUITextEditor.h.
Referenced by WxGUITextEditorPage(), and ~WxGUITextEditorPage().