#include <bbtkWxGUICommand.h>
Public Types | |
enum | { ID_Text_Command, ID_Btn_Go, ID_Btn_Include, ID_Btn_Reset, ID_Btn_Config, ID_Btn_GraphS, ID_Btn_GraphD, ID_Btn_Help, ID_Btn_PackageBrowser } |
Public Member Functions | |
WxGUICommand (wxWindow *parent, WxGUICommandUser *user=0) | |
~WxGUICommand () | |
void | OnBtnGo (wxCommandEvent &event) |
void | OnCommandEnter (wxCommandEvent &event) |
void | OnCommandChar (wxCommandEvent &event) |
void | OnBtnInclude (wxCommandEvent &event) |
void | OnBtnReset (wxCommandEvent &event) |
void | OnBtnConfig (wxCommandEvent &event) |
void | OnBtnGraphS (wxCommandEvent &event) |
void | OnBtnGraphD (wxCommandEvent &event) |
void | OnBtnHelp (wxCommandEvent &event) |
void | OnBtnPackageBrowser (wxCommandEvent &event) |
void | SendCommand (const std::string &command) |
Private Attributes | |
WxGUICommandUser * | mUser |
wxComboBox * | mwxTextCommand |
Definition at line 70 of file bbtkWxGUICommand.h.
anonymous enum |
ID_Text_Command | |
ID_Btn_Go | |
ID_Btn_Include | |
ID_Btn_Reset | |
ID_Btn_Config | |
ID_Btn_GraphS | |
ID_Btn_GraphD | |
ID_Btn_Help | |
ID_Btn_PackageBrowser |
Definition at line 95 of file bbtkWxGUICommand.h.
00096 { 00097 ID_Text_Command, 00098 ID_Btn_Go, 00099 ID_Btn_Include, 00100 ID_Btn_Reset, 00101 ID_Btn_Config, 00102 ID_Btn_GraphS, 00103 ID_Btn_GraphD, 00104 ID_Btn_Help, 00105 ID_Btn_PackageBrowser 00106 };
bbtk::WxGUICommand::WxGUICommand | ( | wxWindow * | parent, | |
WxGUICommandUser * | user = 0 | |||
) |
Definition at line 71 of file bbtkWxGUICommand.cxx.
References _T.
00072 : wxPanel(parent,-1), 00073 mUser(user) 00074 { 00075 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00076 00077 mwxTextCommand = 00078 new wxComboBox(this, 00079 ID_Text_Command, 00080 _T(""), 00081 wxDefaultPosition, 00082 wxDefaultSize, 00083 0, NULL, 00084 wxTE_PROCESS_ENTER 00085 // | wxTE_PROCESS_TAB 00086 // | wxWANTS_CHARS 00087 // //| wxTAB_TRAVERSAL 00088 ); 00089 00090 wxButton *btnGo = new wxButton(this,ID_Btn_Go,_T("Go")); 00091 00092 wxFlexGridSizer *sizerCommand= new wxFlexGridSizer(2); 00093 sizerCommand->AddGrowableCol(0); 00094 sizerCommand->Add(mwxTextCommand,1,wxGROW); 00095 sizerCommand->Add(btnGo); 00096 00097 sizer->Add(sizerCommand,0,wxGROW); 00098 00099 wxBoxSizer *btnsSizer = new wxBoxSizer(wxHORIZONTAL); 00100 00101 wxButton *btnInclude = new wxButton(this,ID_Btn_Include ,_T("include") ); 00102 wxButton *btnReset = new wxButton(this,ID_Btn_Reset ,_T("reset") ); 00103 wxButton *btnConfig = new wxButton(this,ID_Btn_Config ,_T("config") ); 00104 wxButton *btnGraphS = new wxButton(this,ID_Btn_GraphS ,_T("graph (simple)") ); 00105 wxButton *btnGraphD = new wxButton(this,ID_Btn_GraphD ,_T("graph (detailed)") ); 00106 wxButton *btnHelp = new wxButton(this,ID_Btn_Help ,_T("help") ); 00107 wxButton *btnPackageBrowser = new wxButton(this,ID_Btn_PackageBrowser ,_T("Start Package Browser") ); 00108 00109 btnsSizer->Add( btnInclude ); 00110 btnsSizer->Add( btnReset ); 00111 btnsSizer->Add( btnConfig ); 00112 btnsSizer->Add( btnGraphS ); 00113 btnsSizer->Add( btnGraphD ); 00114 btnsSizer->Add( btnHelp ); 00115 btnsSizer->Add( btnPackageBrowser ); 00116 00117 sizer->Add(btnsSizer,0,wxTOP|wxGROW, 10 ); 00118 00119 SetSizer(sizer); 00120 00121 SetAutoLayout(true); 00122 Layout(); 00123 }
bbtk::WxGUICommand::~WxGUICommand | ( | ) |
void bbtk::WxGUICommand::OnBtnConfig | ( | wxCommandEvent & | event | ) |
Definition at line 177 of file bbtkWxGUICommand.cxx.
References bbtkDebugMessage, and SendCommand().
00178 { 00179 bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnConfig"<<std::endl); 00180 SendCommand("config"); 00181 }
void bbtk::WxGUICommand::OnBtnGo | ( | wxCommandEvent & | event | ) |
Definition at line 129 of file bbtkWxGUICommand.cxx.
References bbtkDebugMessage, mwxTextCommand, SendCommand(), and bbtk::wx2std().
00130 { 00131 bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnGo"<<std::endl); 00132 SendCommand(wx2std(mwxTextCommand->GetValue())); 00133 }
void bbtk::WxGUICommand::OnBtnGraphD | ( | wxCommandEvent & | event | ) |
Definition at line 189 of file bbtkWxGUICommand.cxx.
References bbtkDebugMessage, and SendCommand().
00190 { 00191 bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnGraphD"<<std::endl); 00192 SendCommand("graph . 1"); 00193 }
void bbtk::WxGUICommand::OnBtnGraphS | ( | wxCommandEvent & | event | ) |
Definition at line 183 of file bbtkWxGUICommand.cxx.
References bbtkDebugMessage, and SendCommand().
00184 { 00185 bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnGraphS"<<std::endl); 00186 SendCommand("graph"); 00187 }
void bbtk::WxGUICommand::OnBtnHelp | ( | wxCommandEvent & | event | ) |
Definition at line 195 of file bbtkWxGUICommand.cxx.
References bbtkDebugMessage, and SendCommand().
00196 { 00197 bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnHelp"<<std::endl); 00198 SendCommand("help"); 00199 }
void bbtk::WxGUICommand::OnBtnInclude | ( | wxCommandEvent & | event | ) |
Definition at line 151 of file bbtkWxGUICommand.cxx.
References _T, bbtkDebugMessage, bbtk::ConfigurationFile::Get_default_temp_dir(), bbtk::ConfigurationFile::GetInstance(), SendCommand(), and bbtk::wx2std().
00152 { 00153 bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnInclude"<<std::endl); 00154 00155 std::string default_doc_dir = 00156 ConfigurationFile::GetInstance().Get_default_temp_dir(); 00157 std::string stdDir = default_doc_dir+"/share/bbtk/bbs"; 00158 wxString defaultDir(stdDir.c_str(), wxConvUTF8); 00159 00160 wxFileDialog dialog(this, _T("Include file"),defaultDir, _T(""), _T("*.bbs"), wxOPEN ); 00161 if (dialog.ShowModal() == wxID_OK) 00162 { 00163 // std::string command(_T("include ")); 00164 // std::string pathfilename = (const char *)(dialog.GetFilename().mb_str()); 00165 std::string command("include "); 00166 command = command + "\"" + wx2std(dialog.GetPath()) + "\""; 00167 SendCommand(command); 00168 } 00169 }
void bbtk::WxGUICommand::OnBtnPackageBrowser | ( | wxCommandEvent & | event | ) |
Definition at line 201 of file bbtkWxGUICommand.cxx.
References _T.
00202 { 00203 wxBusyCursor wait; 00204 WxGUIPackageBrowser2Window *helpbrowser = new 00205 WxGUIPackageBrowser2Window(this,_T("Package Browser"), wxSize(600,600) ); 00206 helpbrowser->Show(); 00207 }
void bbtk::WxGUICommand::OnBtnReset | ( | wxCommandEvent & | event | ) |
Definition at line 171 of file bbtkWxGUICommand.cxx.
References bbtkDebugMessage, and SendCommand().
00172 { 00173 bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnReset"<<std::endl); 00174 SendCommand("reset"); 00175 }
void bbtk::WxGUICommand::OnCommandChar | ( | wxCommandEvent & | event | ) |
void bbtk::WxGUICommand::OnCommandEnter | ( | wxCommandEvent & | event | ) |
Definition at line 135 of file bbtkWxGUICommand.cxx.
References bbtkDebugMessage, mwxTextCommand, SendCommand(), and bbtk::wx2std().
00136 { 00137 bbtkDebugMessage("gui",2,"WxGUICommand::OnCommandEnter"<<std::endl); 00138 SendCommand(wx2std(mwxTextCommand->GetValue())); 00139 }
void bbtk::WxGUICommand::SendCommand | ( | const std::string & | command | ) |
Definition at line 141 of file bbtkWxGUICommand.cxx.
References _T, mUser, mwxTextCommand, bbtk::std2wx(), and bbtk::WxGUICommandUser::WxGUICommandEnter().
Referenced by OnBtnConfig(), OnBtnGo(), OnBtnGraphD(), OnBtnGraphS(), OnBtnHelp(), OnBtnInclude(), OnBtnReset(), OnCommandEnter(), bbtk::WxGUIScriptingInterface::OnMenuCreateBlackBox(), and bbtk::WxGUIScriptingInterface::OnMenuCreatePackage().
00142 { 00143 if (command.length()==0) return; 00144 00145 mwxTextCommand->SetValue(_T("")); 00146 mwxTextCommand->Append(std2wx(command)); 00147 if (mUser) mUser->WxGUICommandEnter(command); 00148 }
WxGUICommandUser* bbtk::WxGUICommand::mUser [private] |
wxComboBox* bbtk::WxGUICommand::mwxTextCommand [private] |
Definition at line 91 of file bbtkWxGUICommand.h.
Referenced by OnBtnGo(), OnCommandEnter(), and SendCommand().