Salome HOME
According to cotech80 PyConsoleBase->PyConsole and PyConsole->SalomePyConsole
[modules/gui.git] / src / PyConsole / PyConsole_Event.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  Author : Vadim SANDLER (Open CASCADE S.A.S), Adrien Bruneton (CEA/DEN)
23
24 #ifndef PYCONSOLE_EVENT_H
25 #define PYCONSOLE_EVENT_H
26
27 #include "PyConsole.h"
28
29 #include <QEvent>
30 #include <QString>
31
32 /*!
33   \class PrintEvent
34   \brief Python command output backend event.
35   \internal
36 */
37 class PrintEvent : public QEvent
38 {
39 public:
40   static const int EVENT_ID = 65432;
41
42   /*!
43     \brief Constructor
44     \param c message text (python trace)
45     \param isError default to false - if true indicates that an error is being printed.
46   */
47   PrintEvent( const QString& c, bool isError = false) :
48     QEvent( (QEvent::Type)EVENT_ID ), myText( c ), errorFlag(isError)
49   {}
50
51   /*!
52     \brief Get message
53     \return message text (python trace)
54   */
55   QString text() const { return myText; }
56
57   /**
58    * @return true if this is an error message
59    */
60   bool isError() const { return errorFlag; }
61
62 protected:
63   QString myText; //!< Event message (python trace)
64
65   /** Set to true if an error msg is to be displayed */
66   bool errorFlag;
67 };
68
69 #endif // PYCONSOLE_EVENT_H