BALL  1.4.1
textEditorWidget.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_VIEW_WIDGETS_TEXTEDITORWIDGET_H
00006 #define BALL_VIEW_WIDGETS_TEXTEDITORWIDGET_H
00007 
00008 #ifndef BALL_VIEW_KERNEL_COMMON_H
00009 # include <BALL/VIEW/KERNEL/common.h>
00010 #endif
00011 
00012 #ifndef BALL_VIEW_WIDGETS_DOCKWIDGET_H
00013 # include <BALL/VIEW/WIDGETS/dockWidget.h>
00014 #endif
00015 
00016 #include <QPlainTextEdit>
00017 #include <QObject>
00018 
00019 class QPaintEvent;
00020 class QResizeEvent;
00021 class QSize;
00022 class QWidget;
00023 
00024 namespace BALL
00025 {
00026   namespace VIEW
00027   {
00031     class BALL_VIEW_EXPORT TextEditorWidget
00032       : public QPlainTextEdit
00033     {
00034       Q_OBJECT
00035 
00036       public:
00037       
00038         TextEditorWidget(QWidget *parent = 0);
00039 
00040         void lineNumbersPaintEvent(QPaintEvent *event);
00041         int  lineNumbersWidth();
00042 
00043       protected:
00044         
00045         class LineNumbers 
00046           : public QWidget
00047         {
00048           public:
00049             LineNumbers(TextEditorWidget *editor); 
00050             QSize sizeHint() const;
00051 
00052           protected:
00053             void paintEvent(QPaintEvent *event);
00054           
00055           private:
00056             TextEditorWidget *editor_;
00057         };
00058        
00059        void resizeEvent(QResizeEvent *event);
00060 
00061       private slots:
00062         void updateLineNumbersWidth(int newBlockCount);
00063         void highlightCurrentLine();
00064         void updateLineNumbers(const QRect &, int);
00065 
00066       private:
00067         QWidget *line_numbers_;
00068     };
00069 
00070   }
00071 }
00072 
00073 #endif // BALL_VIEW_WIDGETS_TEXTEDITORWIDGET_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines