#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) |
bool | IsModified () |
std::string | GetText () |
Private Attributes | |
WxGUITextEditor * | mEditor |
WxTextCtrlGettingKeyEvents * | mwxInputText |
wxTextAttr * | mwxInputTextAttr |
std::string | mName |
bool | mAskFilename |
Definition at line 82 of file bbtkWxGUITextEditor.h.
bbtk::WxGUITextEditorPage::WxGUITextEditorPage | ( | wxWindow * | parent, | |
WxGUITextEditor * | editor | |||
) |
Definition at line 132 of file bbtkWxGUITextEditor.cxx.
References _T, mEditor, mwxInputText, mwxInputTextAttr, and bbtk::WxTextCtrlGettingKeyEvents::SetWxGUITextEditor().
00134 : wxPanel(parent,-1), 00135 mEditor(editor), 00136 mName(""), 00137 mAskFilename(true) 00138 { 00139 00140 // std::cout << "WxGUITextEditorPage::WxGUITextEditorPage("<<mName<<")"<<std::endl; 00141 00142 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00143 00144 mwxInputText = 00145 00146 new WxTextCtrlGettingKeyEvents(this, 00147 -1, //ID_InputText, 00148 _T(""), 00149 wxDefaultPosition, 00150 wxDefaultSize, 00151 wxTE_MULTILINE 00152 // |wxTE_PROCESS_ENTER 00153 //| wxTE_PROCESS_TAB 00154 // | wxWANTS_CHARS 00155 // | wxTAB_TRAVERSAL 00156 ); 00157 mwxInputText->SetWxGUITextEditor(mEditor); 00158 /* 00159 new wxTextCtrl(this,-1,_T(""), 00160 wxDefaultPosition, 00161 wxDefaultSize, 00162 wxTE_MULTILINE 00163 // |wxTE_PROCESS_ENTER 00164 // | wxTE_PROCESS_TAB 00165 // | wxWANTS_CHARS 00166 // | wxTAB_TRAVERSAL 00167 ); 00168 */ 00169 wxFont* FixedFont = new wxFont(10, 00170 wxFONTFAMILY_MODERN, 00171 wxFONTSTYLE_NORMAL, 00172 wxFONTWEIGHT_NORMAL, 00173 false); 00174 00175 mwxInputTextAttr = new wxTextAttr; 00176 mwxInputTextAttr->SetFont(*FixedFont); 00177 00178 sizer->Add(mwxInputText,1,wxGROW); 00179 SetSizer(sizer); 00180 SetAutoLayout(true); 00181 Layout(); 00182 }
bbtk::WxGUITextEditorPage::~WxGUITextEditorPage | ( | ) |
void bbtk::WxGUITextEditorPage::SetPageName | ( | const std::string & | name | ) | [inline] |
Definition at line 88 of file bbtkWxGUITextEditor.h.
References mName, and SetPageName().
Referenced by bbtk::WxGUITextEditor::NewPage(), and SetPageName().
00088 { mName = name; }
const std::string& bbtk::WxGUITextEditorPage::GetPageName | ( | ) | const [inline] |
Definition at line 89 of file bbtkWxGUITextEditor.h.
References GetPageName(), and mName.
Referenced by GetPageName(), and bbtk::WxGUITextEditor::UpdateInfo().
00089 { return mName; }
bool bbtk::WxGUITextEditorPage::AskFilename | ( | ) | const [inline] |
Definition at line 91 of file bbtkWxGUITextEditor.h.
References AskFilename(), and mAskFilename.
Referenced by AskFilename().
00091 { return mAskFilename; }
void bbtk::WxGUITextEditorPage::SetAskFilename | ( | bool | a | ) | [inline] |
Definition at line 92 of file bbtkWxGUITextEditor.h.
References mAskFilename, and SetAskFilename().
Referenced by bbtk::WxGUITextEditor::OnToolLeftClick(), and SetAskFilename().
00092 { mAskFilename=a; }
WxTextCtrlGettingKeyEvents* bbtk::WxGUITextEditorPage::GetTextCtrl | ( | ) | [inline] |
Definition at line 94 of file bbtkWxGUITextEditor.h.
References GetTextCtrl(), and mwxInputText.
Referenced by GetText(), GetTextCtrl(), and bbtk::WxGUITextEditor::UpdateInfo().
00094 { return mwxInputText; }
void bbtk::WxGUITextEditorPage::Load | ( | const std::string & | filename | ) |
Definition at line 200 of file bbtkWxGUITextEditor.cxx.
References mAskFilename, mName, mwxInputText, and bbtk::std2wx().
Referenced by bbtk::WxGUITextEditor::NewPage().
00201 { 00202 // std::cout << "-------------- LOAD ---------------"<<std::endl; 00203 // std::cout << "'" << filename << "'"<<std::endl; 00204 //std::string oldFilename = mFilename; 00205 mName = filename; 00206 mAskFilename = false; 00207 mwxInputText->LoadFile(std2wx(mName)); 00208 }
void bbtk::WxGUITextEditorPage::Save | ( | const std::string & | filter | ) |
Definition at line 212 of file bbtkWxGUITextEditor.cxx.
References _T, mAskFilename, mName, mwxInputText, bbtk::std2wx(), and bbtk::wx2std().
Referenced by bbtk::WxGUITextEditor::CloseCurrentPage(), and bbtk::WxGUITextEditor::SaveCurrentPage().
00213 { 00214 // std::cout << "-------------- SAVE ---------------"<<std::endl; 00215 if (mAskFilename) 00216 { 00217 wxFileDialog* fd = new wxFileDialog(this,_T("Save file"),_T(""), 00218 _T(""),std2wx(filter), 00219 wxSAVE | wxOVERWRITE_PROMPT ); 00220 int result_fd = fd->ShowModal(); 00221 00222 // This line is need it by windows // EED 00223 fd->SetReturnCode( result_fd ); 00224 00225 if (fd->GetReturnCode()==wxID_OK) 00226 { 00227 mName = wx2std(fd->GetPath()); 00228 mAskFilename = false; 00229 } 00230 else 00231 { 00232 // std::cout << "-------------- CANCELLED ---------------" 00233 // <<std::endl; 00234 return; 00235 } 00236 } 00237 // std::cout << "file [" << mName << "]" <<std::endl; 00238 mwxInputText->SaveFile(std2wx(mName)); 00239 mwxInputText->SetModified(false); 00240 }
bool bbtk::WxGUITextEditorPage::IsModified | ( | ) |
Definition at line 191 of file bbtkWxGUITextEditor.cxx.
References mwxInputText.
Referenced by bbtk::WxGUITextEditor::CloseCurrentPage().
00192 { return mwxInputText->IsModified(); }
std::string bbtk::WxGUITextEditorPage::GetText | ( | ) |
Definition at line 194 of file bbtkWxGUITextEditor.cxx.
References GetTextCtrl(), and bbtk::wx2std().
Referenced by bbtk::WxGUIScriptingInterface::WxGUITextEditorRun().
00195 { 00196 return wx2std(GetTextCtrl()->GetValue()); 00197 }
WxGUITextEditor* bbtk::WxGUITextEditorPage::mEditor [private] |
WxTextCtrlGettingKeyEvents* bbtk::WxGUITextEditorPage::mwxInputText [private] |
Definition at line 105 of file bbtkWxGUITextEditor.h.
Referenced by GetTextCtrl(), IsModified(), Load(), Save(), and WxGUITextEditorPage().
wxTextAttr* bbtk::WxGUITextEditorPage::mwxInputTextAttr [private] |
std::string bbtk::WxGUITextEditorPage::mName [private] |
Definition at line 107 of file bbtkWxGUITextEditor.h.
Referenced by GetPageName(), Load(), Save(), and SetPageName().
bool bbtk::WxGUITextEditorPage::mAskFilename [private] |
Definition at line 108 of file bbtkWxGUITextEditor.h.
Referenced by AskFilename(), Load(), Save(), and SetAskFilename().