Salome HOME
Split PyConsole in order to be used easily outside GUI of SALOME.
[modules/gui.git] / src / PyConsole / PyConsole_Console.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
23 // File   : PyConsole_Console.h
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25 //
26 #ifndef PYCONSOLE_CONSOLE_H
27 #define PYCONSOLE_CONSOLE_H
28
29 #include "PyConsole.h"
30 #include <PyConsole_ConsoleBase.h>
31 #include <SUIT_PopupClient.h>
32 #include <QWidget>
33 #include <QMap>
34
35 class PyConsole_Interp;
36 class PyConsole_Editor;
37
38 class PYCONSOLE_EXPORT PyConsole_Console : public PyConsole_ConsoleBase, public SUIT_PopupClient
39 {
40   Q_OBJECT
41 public:
42
43   struct PyConsole_Interp_Creator : public PyConsole_Interp_CreatorBase
44   {
45     virtual PyConsole_EditorBase *createEditor( PyConsole_Interp *interp, PyConsole_ConsoleBase *console ) const;
46     virtual PyConsole_Interp *createInterp( ) const;
47   };
48
49 public:
50   PyConsole_Console( QWidget* parent, PyConsole_Interp* interp = 0 );
51   virtual ~PyConsole_Console();
52   //! \brief Get popup client symbolic name
53   virtual QString     popupClientType() const { return QString( "PyConsole" ); }
54   virtual void        contextMenuPopup( QMenu* );
55   virtual bool        eventFilter( QObject*, QEvent* );
56 protected:
57   PyConsole_Console( QWidget* parent, PyConsole_Interp*,  PyConsole_Editor*);
58 };
59
60 /**
61  * Enhance console object providing auto-completion.
62  * Similar to PyConsole_Console except that an enhanced interpreter and enhanced editor
63  * are encapsulated.
64  */
65 class PYCONSOLE_EXPORT PyConsole_EnhConsole : public PyConsole_Console
66 {
67   Q_OBJECT
68 public:
69
70   struct PyConsole_Interp_EnhCreator : public PyConsole_Interp_CreatorBase
71   {
72     virtual PyConsole_EditorBase *createEditor( PyConsole_Interp *interp, PyConsole_ConsoleBase *console ) const;
73     virtual PyConsole_Interp *createInterp( ) const;
74   };
75
76 public:
77   PyConsole_EnhConsole( QWidget* parent, PyConsole_Interp* interp = 0 );
78   virtual ~PyConsole_EnhConsole() {}
79 };
80
81 #endif // PYCONSOLE_CONSOLE_H