1 /*=========================================================================
3 Module: $RCSfile: bbtkWxGUIOutputMessages.cxx,v $
5 Date: $Date: 2009/12/09 08:46:20 $
6 Version: $Revision: 1.4 $
7 =========================================================================*/
9 /* ---------------------------------------------------------------------
11 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
12 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
14 * This software is governed by the CeCILL-B license under French law and
15 * abiding by the rules of distribution of free software. You can use,
16 * modify and/ or redistribute the software under the terms of the CeCILL-B
17 * license as circulated by CEA, CNRS and INRIA at the following URL
18 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
19 * or in the file LICENSE.txt.
21 * As a counterpart to the access to the source code and rights to copy,
22 * modify and redistribute granted by the license, users are provided only
23 * with a limited warranty and the software's author, the holder of the
24 * economic rights, and the successive licensors have only limited
27 * The fact that you are presently reading this means that you have had
28 * knowledge of the CeCILL-B license and that you accept its terms.
29 * ------------------------------------------------------------------------ */
33 * \brief Short description in one line
35 * Long description which
36 * can span multiple lines
48 #ifdef _USE_WXWIDGETS_
50 #include "bbtkWxGUIOutputMessages.h"
51 #include "bbtkMessageManager.h"
52 #include "bbtkConfigurationFile.h"
53 #include "bbtkWxStreamRedirector.h"
59 WxGUIOutputMessages::WxGUIOutputMessages(wxWindow *parent, WxGUIOutputMessagesUser* user)
63 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
67 _T(""),wxDefaultPosition,
72 mFixedFont = new wxFont(10,
78 mwxOutputTextAttr = new wxTextAttr;
79 mwxOutputTextAttr->SetFont(*mFixedFont);
80 sizer->Add ( mwxOutputText, 1, wxGROW);
82 // Redirection of std::cout to mwxTextHistory and printf
84 new WxStreamRedirector(std::cout,mwxOutputText,*wxBLACK,true);
86 new WxStreamRedirector(std::cerr,mwxOutputText,*wxGREEN,true);
93 WxGUIOutputMessages::~WxGUIOutputMessages()
95 delete mRedirect_cout;
96 delete mRedirect_cerr;
97 delete mwxOutputTextAttr;
101 void WxGUIOutputMessages::Print(const std::string& message,
106 mwxOutputTextAttr->SetTextColour(*col);
107 mwxOutputText->SetDefaultStyle(*mwxOutputTextAttr);
109 mwxOutputText->AppendText(std2wx(message));
112 mwxOutputTextAttr->SetTextColour(*wxBLACK);
113 mwxOutputText->SetDefaultStyle(*mwxOutputTextAttr);