Fully fill the table headers with color
[kugel-rb/myfork.git] / utils / wpseditor / gui / src / numberedtextview.h
blob2a0d1de0684da0e1e197aa5bb92c3b1e61500ed9
1 /* This file is part of the KDE libraries
2 Copyright (C) 2005, 2006 KJSEmbed Authors
3 See included AUTHORS file.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
20 --------------------------------------------------------------------------------------
21 Imported into the WPS editor and simplified by Dominik Wenger
26 #ifndef NUMBERED_TEXT_VIEW_H
27 #define NUMBERED_TEXT_VIEW_H
29 #include <QFrame>
30 #include <QPixmap>
31 #include <QTextCursor>
33 class QTextEdit;
34 class QHBoxLayout;
36 // Shows the Line numbers
37 class NumberBar : public QWidget
39 Q_OBJECT
41 public:
42 NumberBar( QWidget *parent );
43 ~NumberBar();
45 void markLine( int lineno );
47 void setTextEdit( QTextEdit *edit );
48 void paintEvent( QPaintEvent *ev );
50 private:
51 QTextEdit *edit;
52 QPixmap markerIcon;
53 int markedLine;
54 QRect markedRect;
57 // Shows a QTextEdit with Line numbers
58 class NumberedTextView : public QFrame
60 Q_OBJECT
62 public:
63 NumberedTextView( QWidget *parent = 0 );
64 ~NumberedTextView();
66 /** Returns the QTextEdit of the main view. */
67 QTextEdit *textEdit() const { return view; }
69 /* marks the line with a icon */
70 void markLine( int lineno );
72 void scrolltoLine( int lineno );
74 private slots:
75 void textChanged( int pos, int removed, int added );
77 private:
78 QTextEdit *view;
79 NumberBar *numbers;
80 QHBoxLayout *box;
81 QTextCursor highlight;
82 int markedLine;
86 #endif // NUMBERED_TEXT_VIEW_H