/*========================================================================= Program: bbtk Module: $RCSfile: bbtkWxGUICommand.cxx,v $ Language: C++ Date: $Date: 2008/03/20 11:04:57 $ 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 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*//** * \brief Short description in one line * * Long description which * can span multiple lines */ /** * \file * \brief */ /** * \class bbtk:: * \brief */ #ifdef _USE_WXWIDGETS_ #include "bbtkWxGUICommand.h" #include "bbtkMessageManager.h" #include "bbtkConfigurationFile.h" namespace bbtk { //================================================================ BEGIN_EVENT_TABLE(WxGUICommand, wxPanel) EVT_TEXT_ENTER(WxGUICommand::ID_Text_Command, WxGUICommand::OnCommandEnter) EVT_BUTTON(WxGUICommand::ID_Btn_Go, WxGUICommand::OnBtnGo) EVT_BUTTON(WxGUICommand::ID_Btn_Include, WxGUICommand::OnBtnInclude) EVT_BUTTON(WxGUICommand::ID_Btn_Reset, WxGUICommand::OnBtnReset) EVT_BUTTON(WxGUICommand::ID_Btn_Config, WxGUICommand::OnBtnConfig) EVT_BUTTON(WxGUICommand::ID_Btn_GraphS, WxGUICommand::OnBtnGraphS) EVT_BUTTON(WxGUICommand::ID_Btn_GraphD, WxGUICommand::OnBtnGraphD) EVT_BUTTON(WxGUICommand::ID_Btn_Help, WxGUICommand::OnBtnHelp) END_EVENT_TABLE() //================================================================ WxGUICommand::WxGUICommand(wxWindow *parent, WxGUICommandUser* user) : wxPanel(parent,-1), mUser(user) { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); mwxTextCommand = new wxComboBox(this, ID_Text_Command, _T(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER // | wxTE_PROCESS_TAB // | wxWANTS_CHARS // //| wxTAB_TRAVERSAL ); wxButton *btnGo = new wxButton(this,ID_Btn_Go,_T("Go")); wxFlexGridSizer *sizerCommand= new wxFlexGridSizer(2); sizerCommand->AddGrowableCol(0); sizerCommand->Add(mwxTextCommand,1,wxGROW); sizerCommand->Add(btnGo); sizer->Add(sizerCommand,0,wxLEFT | wxRIGHT | wxBOTTOM | wxGROW, 10 ); wxBoxSizer *btnsSizer = new wxBoxSizer(wxHORIZONTAL); wxButton *btnInclude = new wxButton(this,ID_Btn_Include,_T("include") ); wxButton *btnReset = new wxButton(this,ID_Btn_Reset,_T("reset") ); wxButton *btnConfig = new wxButton(this,ID_Btn_Config,_T("config") ); wxButton *btnGraphS = new wxButton(this,ID_Btn_GraphS, _T("graph (simple)") ); wxButton *btnGraphD = new wxButton(this,ID_Btn_GraphD, _T("graph (detailed)") ); wxButton *btnHelp = new wxButton(this,ID_Btn_Help,_T("help") ); btnsSizer->Add( btnInclude ); btnsSizer->Add( btnReset ); btnsSizer->Add( btnConfig ); btnsSizer->Add( btnGraphS ); btnsSizer->Add( btnGraphD ); btnsSizer->Add( btnHelp ); sizer->Add(btnsSizer,0,wxLEFT | wxRIGHT | wxBOTTOM | wxGROW, 10 ); SetSizer(sizer); SetAutoLayout(true); Layout(); } WxGUICommand::~WxGUICommand() { } void WxGUICommand::OnBtnGo(wxCommandEvent& event) { bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnGo"<GetValue())); } void WxGUICommand::OnCommandEnter(wxCommandEvent& event) { bbtkDebugMessage("gui",2,"WxGUICommand::OnCommandEnter"<GetValue())); } void WxGUICommand::SendCommand(const std::string& command) { if (command.length()==0) return; mwxTextCommand->SetValue(_T("")); mwxTextCommand->Append(std2wx(command)); if (mUser) mUser->WxGUICommandEnter(command); } void WxGUICommand::OnBtnInclude(wxCommandEvent& event) { bbtkDebugMessage("gui",2,"WxGUICommand::OnBtnInclude"<