BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
textEditorWidget.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_WIDGETS_TEXTEDITORWIDGET_H
6 #define BALL_VIEW_WIDGETS_TEXTEDITORWIDGET_H
7 
8 #ifndef BALL_VIEW_KERNEL_COMMON_H
10 #endif
11 
12 #ifndef BALL_VIEW_WIDGETS_DOCKWIDGET_H
14 #endif
15 
16 #include <QPlainTextEdit>
17 #include <QObject>
18 
19 class QPaintEvent;
20 class QResizeEvent;
21 class QSize;
22 class QWidget;
23 
24 namespace BALL
25 {
26  namespace VIEW
27  {
32  : public QPlainTextEdit
33  {
34  Q_OBJECT
35 
36  public:
37 
38  TextEditorWidget(QWidget *parent = 0);
39 
40  void lineNumbersPaintEvent(QPaintEvent *event);
41  int lineNumbersWidth();
42 
43  protected:
44 
45  class LineNumbers
46  : public QWidget
47  {
48  public:
49  LineNumbers(TextEditorWidget *editor);
50  QSize sizeHint() const;
51 
52  protected:
53  void paintEvent(QPaintEvent *event);
54 
55  private:
57  };
58 
59  void resizeEvent(QResizeEvent *event);
60 
61  private slots:
62  void updateLineNumbersWidth(int newBlockCount);
63  void highlightCurrentLine();
64  void updateLineNumbers(const QRect &, int);
65 
66  private:
68  };
69 
70  }
71 }
72 
73 #endif // BALL_VIEW_WIDGETS_TEXTEDITORWIDGET_H