Changeset View
Changeset View
Standalone View
Standalone View
src/TerminalScrollBar.h
- This file was added.
1 | #ifndef TERMINALSCROLLBAR_H | ||||
---|---|---|---|---|---|
2 | #define TERMINALSCROLLBAR_H | ||||
3 | | ||||
4 | #include <QScrollBar> | ||||
5 | #include "konsoleprivate_export.h" | ||||
6 | | ||||
7 | namespace Konsole | ||||
8 | { | ||||
9 | | ||||
10 | class KONSOLEPRIVATE_EXPORT TerminalScrollBar : public QScrollBar | ||||
11 | { | ||||
12 | Q_OBJECT | ||||
13 | public: | ||||
14 | | ||||
15 | /** | ||||
16 | * This enum describes the positions where the terminal display's | ||||
17 | * scroll bar may be placed. | ||||
18 | */ | ||||
19 | enum Position { | ||||
20 | /** Show the scroll-bar on the left of the terminal display. */ | ||||
21 | Left = 0, | ||||
22 | /** Show the scroll-bar on the right of the terminal display. */ | ||||
23 | Right = 1, | ||||
24 | /** Do not show the scroll-bar. */ | ||||
25 | Hidden = 2 | ||||
26 | }; | ||||
27 | | ||||
28 | explicit TerminalScrollBar(QWidget *parent = 0); | ||||
29 | | ||||
30 | // The amount of lines that the scroll is displaying at maximum. | ||||
31 | void setLines(int lines); | ||||
32 | int lines() const; | ||||
33 | void fixGeometry(); | ||||
34 | | ||||
35 | /** | ||||
36 | * Sets the current position and range of the display's scroll bar. | ||||
37 | * | ||||
38 | * @param cursor The position of the scroll bar's thumb. | ||||
39 | * @param slines The maximum value of the scroll bar. | ||||
40 | */ | ||||
41 | void setScroll(int cursor, int slines); | ||||
42 | | ||||
43 | /** | ||||
44 | * Specifies whether the terminal display has a vertical scroll bar, and if so whether it | ||||
45 | * is shown on the left or right side of the display. | ||||
46 | */ | ||||
47 | void setPosition(Position position); | ||||
48 | Position position() const; | ||||
49 | int themeAwareWidth() const; | ||||
50 | protected: | ||||
51 | /* trackign the style change event */ | ||||
52 | void changeEvent(QEvent *event) override; | ||||
53 | | ||||
54 | Q_SIGNALS: | ||||
55 | void positionChanged(Position position); | ||||
56 | void linesChanged(int lines); | ||||
57 | | ||||
58 | private: | ||||
59 | Position _position; | ||||
60 | int _lines; | ||||
61 | bool _canFloat; | ||||
62 | }; | ||||
63 | | ||||
64 | } | ||||
65 | | ||||
66 | #endif |