1 // Copyright (C) 2007-2008 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
22 // KERNEL SALOME_Event : Define event posting mechanism
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
30 # if defined LOGWINDOW_EXPORTS
31 # define LOGWINDOW_EXPORT __declspec( dllexport )
33 # define LOGWINDOW_EXPORT __declspec( dllimport )
36 # define LOGWINDOW_EXPORT
39 #include <SUIT_PopupClient.h>
43 #include <QStringList>
46 #pragma warning( disable:4251 )
52 class LOGWINDOW_EXPORT LogWindow : public QWidget, public SUIT_PopupClient
57 //! Context popup menu actions flags
60 CopyId = 0x01, //!< "Copy" menu action
61 ClearId = 0x02, //!< "Clear" menu action
62 SelectAllId = 0x04, //!< "Select All" menu action
63 SaveToFileId = 0x08, //!< "Save To File" menu action
64 All = CopyId | ClearId | SelectAllId | SaveToFileId //!< all menu actions
67 //! Display messages flags
70 DisplayNormal = 0x00, //!< do not display extra data
71 DisplayDate = 0x01, //!< display message date
72 DisplayTime = 0x02, //!< display message time
73 DisplaySeparator = 0x04, //!< display separator between messages
74 DisplayNoColor = 0x08, //!< display non-colored message
75 DisplayDateTime = DisplayDate | DisplayTime //!< display date & time
79 LogWindow( QWidget* theParent );
82 virtual QString popupClientType() const { return QString( "LogWindow" ); }
83 virtual void contextMenuPopup( QMenu* );
85 virtual bool eventFilter( QObject*, QEvent* );
87 QString banner() const;
88 QString separator() const;
90 void setBanner( const QString& );
91 void setSeparator( const QString& );
93 void putMessage( const QString&, const int = DisplayNormal );
94 virtual void putMessage( const QString&, const QColor&, const int = DisplayNormal );
95 void clear( const bool = false );
97 bool saveLog( const QString& );
99 void setMenuActions( const int );
100 int menuActions() const;
109 void createActions();
110 void updateActions();
113 QTextEdit* myView; //!< internal view window
114 QString myBanner; //!< current banner
115 QStringList myHistory; //!< messages history
116 QString mySeparator; //!< current separator
117 int myBannerSize; //!< current banner's size
118 QMap<int, QAction*> myActions; //!< popup menu actions
122 #pragma warning( default:4251 )
125 #endif // LOGWINDOW_H