Salome HOME
Merge branch 'oscar/imps_2017'
[modules/gui.git] / tools / PyEditor / src / PyEditor_Keywords.h
1 // Copyright (C) 2015-2016  OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File   : PyEditor_Keywords.h
20 // Author : Sergey TELKOV, Open CASCADE S.A.S. (sergey.telkov@opencascade.com)
21 //
22
23 #ifndef PYEDITOR_KEYWORDS_H
24 #define PYEDITOR_KEYWORDS_H
25
26 #include <QObject>
27 #include <QColor>
28 #include <QList>
29 #include <QMap>
30
31 class PyEditor_Keywords : public QObject
32 {
33   Q_OBJECT
34
35 public:
36   PyEditor_Keywords( QObject* = 0 );
37   virtual ~PyEditor_Keywords();
38
39   QList<int>       types() const;
40   QList<QColor>    colors() const;
41
42   int              type( const QString& ) const;
43   QColor           color( const QString& ) const;
44
45   QStringList      keywords() const;
46   QStringList      keywords( int ) const;
47   QStringList      keywords( const QColor& ) const;
48
49   void             append( const QString&, int, const QColor& = QColor() );
50   void             append( const QStringList&, int, const QColor& = QColor() );
51
52   void             remove( int );
53   void             remove( const QString& );
54   void             remove( const QStringList& );
55
56   void             clear();
57
58 Q_SIGNALS:
59   void             keywordsChanged();
60
61 private:
62   typedef struct { int type; QColor color; } KeywordInfo;
63   typedef QMap<QString, KeywordInfo>         KeywordMap;
64
65 private:
66   KeywordMap       myKeywords;
67 };
68
69 class PyEditor_StandardKeywords : public PyEditor_Keywords
70 {
71   Q_OBJECT
72
73 public:
74   typedef enum { Base, Exceptions } KeywordType;
75
76 public:
77   PyEditor_StandardKeywords( QObject* = 0 );
78   virtual ~PyEditor_StandardKeywords();
79 };
80
81 #endif