Quark  0.1
SourceTextEdit.h++
Go to the documentation of this file.
1 
2 #ifndef __libquark_gui_SourceTextEdit_hxx
3 #define __libquark_gui_SourceTextEdit_hxx
4 
5 #include <QPlainTextEdit>
6 #include <QRect>
7 #include <QResizeEvent>
8 #include <QSyntaxHighlighter>
9 
10 #include <quark/Quark.h++>
11 
12 namespace quark {
13 namespace gui {
14 
22 class LIBQUARK_API SourceTextEdit : public QPlainTextEdit
23 {
24  Q_OBJECT;
25 
26  public:
27 
29  explicit SourceTextEdit(QWidget *parent = NULL);
30 
32  virtual ~SourceTextEdit();
33 
35  void setSyntaxHighlighter(QSharedPointer<QSyntaxHighlighter> highlighter);
36 
37  public slots:
38 
40  void setHighlightingEnabled(bool enabled);
41 
42  protected:
43 
44  void resizeEvent(QResizeEvent *event);
45 
46  private slots:
47 
48  void updateMarginWidth();
49  void updateMargin(const QRect &rect, int dy);
50 
51  private:
52 
53  class MarginWidget;
54  friend class MarginWidget;
55 
56  int marginWidth() const;
57  void paintMargin(QPaintEvent *event);
58 
59  MarginWidget *_marginWidget;
60  QSharedPointer<QSyntaxHighlighter> _highlighter;
61  bool _highlightingOn;
62 
63  static const int MARGIN_GAP;
64 };
65 
66 } // namespace gui
67 } // namespace quark
68 
69 #endif // __libquark_gui_SourceTextEdit_hxx
Definition: BarChartView.h++:6
#define LIBQUARK_API
Definition: Quark.h++:18
A subclass of QPlainTextEdit that is specialied for editing source code.
Definition: SourceTextEdit.h++:22