1 /*=========================================================================
4 Module: $RCSfile: bbtkWxGUIOutputMessages.cxx,v $
6 Date: $Date: 2008/03/20 15:27:57 $
7 Version: $Revision: 1.2 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*//**
18 * \brief Short description in one line
20 * Long description which
21 * can span multiple lines
33 #ifdef _USE_WXWIDGETS_
35 #include "bbtkWxGUIOutputMessages.h"
36 #include "bbtkMessageManager.h"
37 #include "bbtkConfigurationFile.h"
38 #include "bbtkWxStreamRedirector.h"
44 WxGUIOutputMessages::WxGUIOutputMessages(wxWindow *parent, WxGUIOutputMessagesUser* user)
48 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
52 _T(""),wxDefaultPosition,
57 wxFont* FixedFont = new wxFont(10,
63 mwxOutputTextAttr = new wxTextAttr;
64 mwxOutputTextAttr->SetFont(*FixedFont);
65 sizer->Add ( mwxOutputText, 1, wxGROW);
67 // Redirection of std::cout to mwxTextHistory and printf
69 new WxStreamRedirector(std::cout,mwxOutputText,*wxBLACK,true);
71 new WxStreamRedirector(std::cerr,mwxOutputText,*wxGREEN,true);
78 WxGUIOutputMessages::~WxGUIOutputMessages()
80 delete mRedirect_cout;
81 delete mRedirect_cerr;
85 void WxGUIOutputMessages::Print(const std::string& message,
90 mwxOutputTextAttr->SetTextColour(*col);
91 mwxOutputText->SetDefaultStyle(*mwxOutputTextAttr);
93 mwxOutputText->AppendText(std2wx(message));
96 mwxOutputTextAttr->SetTextColour(*wxBLACK);
97 mwxOutputText->SetDefaultStyle(*mwxOutputTextAttr);