1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // KERNEL SALOME_Event : Define event posting mechanism
25 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
31 # if defined LOGWINDOW_EXPORTS || defined LogWindow_EXPORTS
32 # define LOGWINDOW_EXPORT __declspec( dllexport )
34 # define LOGWINDOW_EXPORT __declspec( dllimport )
37 # define LOGWINDOW_EXPORT
40 #include <SUIT_PopupClient.h>
44 #include <QStringList>
47 #pragma warning( disable:4251 )
53 class LOGWINDOW_EXPORT LogWindow : public QWidget, public SUIT_PopupClient
58 //! Context popup menu actions flags
61 CopyId = 0x01, //!< "Copy" menu action
62 ClearId = 0x02, //!< "Clear" menu action
63 SelectAllId = 0x04, //!< "Select All" menu action
64 SaveToFileId = 0x08, //!< "Save To File" menu action
65 All = CopyId | ClearId | SelectAllId | SaveToFileId //!< all menu actions
68 //! Display messages flags
71 DisplayNormal = 0x00, //!< do not display extra data
72 DisplayDate = 0x01, //!< display message date
73 DisplayTime = 0x02, //!< display message time
74 DisplaySeparator = 0x04, //!< display separator between messages
75 DisplayNoColor = 0x08, //!< display non-colored message
76 DisplayDateTime = DisplayDate | DisplayTime //!< display date & time
80 LogWindow( QWidget* theParent );
83 virtual QString popupClientType() const { return QString( "LogWindow" ); }
84 virtual void contextMenuPopup( QMenu* );
86 virtual bool eventFilter( QObject*, QEvent* );
88 QString banner() const;
89 QString separator() const;
91 void setBanner( const QString& );
92 void setSeparator( const QString& );
94 void putMessage( const QString&, const int = DisplayNormal );
95 virtual void putMessage( const QString&, const QColor&, const int = DisplayNormal );
96 void clear( const bool = false );
98 bool saveLog( const QString& );
100 void setMenuActions( const int );
101 int menuActions() const;
110 void createActions();
111 void updateActions();
114 QTextEdit* myView; //!< internal view window
115 QString myBanner; //!< current banner
116 QStringList myHistory; //!< messages history
117 QString mySeparator; //!< current separator
118 int myBannerSize; //!< current banner's size
119 QMap<int, QAction*> myActions; //!< popup menu actions
123 #pragma warning( default:4251 )
126 #endif // LOGWINDOW_H