Back to index

salome-gui  6.5.0
PyConsole_Console.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : PyConsole_Console.h
00024 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00025 //
00026 #ifndef PYCONSOLE_CONSOLE_H
00027 #define PYCONSOLE_CONSOLE_H
00028 
00029 #include "PyConsole.h"
00030 
00031 #include <SUIT_PopupClient.h>
00032 #include <QWidget>
00033 #include <QMap>
00034 
00035 class PyConsole_Interp;
00036 class PyConsole_Editor;
00037 
00038 class PYCONSOLE_EXPORT PyConsole_Console : public QWidget, public SUIT_PopupClient
00039 {
00040   Q_OBJECT
00041 
00042 public:
00044   enum
00045   {
00046     CopyId         = 0x01,                                           
00047     PasteId        = 0x02,                                           
00048     ClearId        = 0x04,                                           
00049     SelectAllId    = 0x08,                                           
00050     DumpCommandsId = 0x16,                                           
00051     All = CopyId | PasteId | ClearId | SelectAllId | DumpCommandsId  
00052   };
00053 
00054 public:
00055   PyConsole_Console( QWidget* parent, PyConsole_Interp* interp = 0 );
00056   virtual ~PyConsole_Console();
00057 
00059   PyConsole_Interp*   getInterp() { return myInterp; } 
00060   QFont               font() const;
00061   virtual void        setFont( const QFont& );
00062 
00063   bool                isSync() const;
00064   void                setIsSync( const bool );
00065 
00066   bool                isSuppressOutput() const;
00067   void                setIsSuppressOutput( const bool );
00068 
00069   bool                isShowBanner() const;
00070   void                setIsShowBanner( const bool );
00071 
00072   void                exec( const QString& );
00073   void                execAndWait( const QString& );
00074 
00075   virtual bool        eventFilter( QObject*, QEvent* );
00076 
00078   virtual QString     popupClientType() const { return QString( "PyConsole" ); }
00079   virtual void        contextMenuPopup( QMenu* );
00080 
00081   void                setMenuActions( const int );
00082   int                 menuActions() const;
00083 
00084 private:
00085   void                createActions();
00086   void                updateActions();
00087 
00088 private:
00089   PyConsole_Interp*   myInterp;    
00090   PyConsole_Editor*   myEditor;    
00091   QMap<int, QAction*> myActions;   
00092 };
00093 
00094 #endif // PYCONSOLE_CONSOLE_H