Vuo  2.0.3
VuoCodeEditor.hh
Go to the documentation of this file.
1 
10 #pragma once
11 
12 class VuoCodeGutter;
14 class VuoCodeWindow;
15 
19 class VuoCodeEditor : public QTextEdit
20 {
21  Q_OBJECT
22 
23 public:
24  explicit VuoCodeEditor(QString initialSourceCode);
25 
26  void zoom11();
27  void zoomIn();
28  void zoomOut();
29  bool isZoomedToActualSize();
30 
31  void selectLine(int lineNumber);
32 
33  void updateColor(bool isDark);
34 
35  QColor gutterColor;
36  QColor gutterTextColor;
38  QColor operatorColor;
39  QColor commentColor;
40  QColor keywordColor;
43  QColor constantColor;
45  QPixmap *errorIcon;
47 
48 private:
49  void setFontSize(int fontSize);
50  void keyPressEvent(QKeyEvent *event);
51  void handleTab(bool forward);
52  void handleLinebreak(bool dontBreakAtCursor);
53  void handleBlockEnd();
54  void handleComment();
55  int toggleLineComment(QTextCursor &cursor);
56  void resizeEvent(QResizeEvent *event);
57  void cursorPositionChanged();
58  int getCurrentLineNumber();
59 
60  friend class VuoCodeGutter;
61  friend class VuoCodeWindow;
62  int currentFontSize;
63  QList<int> fontSizes;
64  VuoCodeHighlighterGLSL *highlighter;
65  bool isDark;
66 };