Salome HOME
f80df9b15f2cdea8469e239186c90f79e65b7326
[modules/gui.git] / tools / PyEditor / src / PyEditor_Settings.h
1 // Copyright (C) 2015-2023  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_Settings.h
20 // Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com)
21 //
22
23 #ifndef PYEDITOR_SETTINGS_H
24 #define PYEDITOR_SETTINGS_H
25
26 #include "PyEditor.h"
27
28 #include <QFont>
29
30 class PYEDITOR_EXPORT PyEditor_Settings
31 {
32 protected:
33   enum Option { snEditor, 
34                 snHighlightCurrentLine,
35                 snTextWrapping,
36                 snCenterCursorOnScroll,
37                 snLineNumberArea,
38                 snVerticalEdge,
39                 snNumberColumns,
40                 snTabSpaceVisible,
41                 snTabSize,
42                 snFont,
43                 snCompletionPolicy };
44
45 public:
46   static PyEditor_Settings* settings();
47   static void setSettings( PyEditor_Settings* );
48   
49   PyEditor_Settings();
50   virtual ~PyEditor_Settings() {}
51
52   void setHighlightCurrentLine( bool );
53   bool highlightCurrentLine() const;
54
55   void setTextWrapping( bool );
56   bool textWrapping() const;
57
58   void setCenterCursorOnScroll( bool );
59   bool centerCursorOnScroll() const;
60
61   void setLineNumberArea( bool );
62   bool lineNumberArea() const;
63
64   void setVerticalEdge( bool );
65   bool verticalEdge() const;
66
67   void setNumberColumns( int );
68   int numberColumns() const;
69
70   void setTabSpaceVisible( bool );
71   bool tabSpaceVisible() const;
72
73   void setTabSize( int );
74   int tabSize() const;
75
76   void setFont( const QFont& );
77   QFont font() const;
78
79   void setCompletionPolicy( int );
80   int completionPolicy() const;
81
82   virtual void load();
83   virtual void save();
84
85   void copyFrom( const PyEditor_Settings& );
86   
87 protected:
88   QString option( Option );
89
90 private:
91   // Display settings
92   bool myHighlightCurrentLine;
93   bool myTextWrapping;
94   bool myCenterCursorOnScroll;
95   bool myLineNumberArea;
96   
97   // Vertical edge settings
98   bool myVerticalEdge;
99   int  myNumberColumns;
100   
101   // Tab settings
102   bool myTabSpaceVisible;
103   int  myTabSize;
104   
105   // Font settings
106   QFont myFont;
107
108   // Completion settings
109   int myCompletionPolicy;
110
111   static PyEditor_Settings* myGlobalSettings;
112 };
113
114 #endif // PYEDITOR_SETTINGS_H