Debian Codegraph @

lib/ScreenWindow.h

raw symbols SCIP
1 /*
2 Copyright 2007-2008 by Robert Knight <[email protected]>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA.
18 */
19
20 #ifndef SCREENWINDOW_H
21 #define SCREENWINDOW_Hcxx . . $ `lib/ScreenWindow.h:21:9`!
22
23 // Qt
24 #include <QObject>
25 #include <QPoint>
26 #include <QRect>
27
28 // Konsole
29 #include "Character.h"cxx . . $ `<file>/lib/Character.h`/
30 #include "KeyboardTranslator.h"cxx . . $ `<file>/lib/KeyboardTranslator.h`/
31
32 namespace Konsolecxx . . $ Konsole/
33 {
34
35 class Screencxx . . $ Konsole/Screen#;
36
37 /**
38 * Provides a window onto a section of a terminal screen. A terminal widget can then render
39 * the contents of the window and use the window to change the terminal screen's selection
40 * in response to mouse or keyboard input.
41 *
42 * A new ScreenWindow for a terminal session can be created by calling Emulation::createWindow()
43 *
44 * Use the scrollTo() method to scroll the window up and down on the screen.
45 * Use the getImage() method to retrieve the character image which is currently visible in the window.
46 *
47 * setTrackOutput() controls whether the window moves to the bottom of the associated screen when new
48 * lines are added to it.
49 *
50 * Whenever the output from the underlying screen is changed, the notifyOutputChanged() slot should
51 * be called. This in turn will update the window's position and emit the outputChanged() signal
52 * if necessary.
53 */
54 class ScreenWindowcxx . . $ Konsole/ScreenWindow# : public QObjectcxx . . $ QObject#
55 {
56 Q_OBJECTcxx . . $ Konsole/ScreenWindow#staticMetaObject.
57
58 public:
59 /**
60 * Constructs a new screen window with the given parent.
61 * A screen must be specified by calling setScreen() before calling getImage() or getLineProperties().
62 *
63 * You should not call this constructor directly, instead use the Emulation::createWindow() method
64 * to create a window on the emulation which you wish to view. This allows the emulation
65 * to notify the window when the associated screen has changed and synchronize selection updates
66 * between all views on a session.
67 */
68 ScreenWindowcxx . . $ Konsole/ScreenWindow#ScreenWindow(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent = nullptr);
69 ~cxx . . $ Konsole/ScreenWindow#`~ScreenWindow`(ced63f7c635d850d).ScreenWindowcxx . . $ Konsole/ScreenWindow#() override;
70
71 /** Sets the screen which this window looks onto */
72 void setScreencxx . . $ Konsole/ScreenWindow#setScreen(102c82049da634ab).(Screencxx . . $ Konsole/Screen#* screen);
73 /** Returns the screen which this window looks onto */
74 Screencxx . . $ Konsole/Screen#* screencxx . . $ Konsole/ScreenWindow#screen(2582b97329da5753).() const;
75
76 /**
77 * Returns the image of characters which are currently visible through this window
78 * onto the screen.
79 *
80 * The returned buffer is managed by the ScreenWindow instance and does not need to be
81 * deleted by the caller.
82 */
83 Charactercxx . . $ Konsole/Character#* getImagecxx . . $ Konsole/ScreenWindow#getImage(2b1e201a0ed1a40e).();
84
85 /**
86 * Returns the line attributes associated with the lines of characters which
87 * are currently visible through this window
88 */
89 QVectorcxx . . $ QVector#<LinePropertycxx . . $ Konsole/LineProperty#> getLinePropertiescxx . . $ Konsole/ScreenWindow#getLineProperties(a3e81cde8669a353).();
90
91 /**
92 * Returns the number of lines which the region of the window
93 * specified by scrollRegion() has been scrolled by since the last call
94 * to resetScrollCount(). scrollRegion() is in most cases the
95 * whole window, but will be a smaller area in, for example, applications
96 * which provide split-screen facilities.
97 *
98 * This is not guaranteed to be accurate, but allows views to optimize
99 * rendering by reducing the amount of costly text rendering that
100 * needs to be done when the output is scrolled.
101 */
102 int scrollCountcxx . . $ Konsole/ScreenWindow#scrollCount(455f465bc33b4cdf).() const;
103
104 /**
105 * Resets the count of scrolled lines returned by scrollCount()
106 */
107 void resetScrollCountcxx . . $ Konsole/ScreenWindow#resetScrollCount(49f6e7a06ebc5aa8).();
108
109 /**
110 * Returns the area of the window which was last scrolled, this is
111 * usually the whole window area.
112 *
113 * Like scrollCount(), this is not guaranteed to be accurate,
114 * but allows views to optimize rendering.
115 */
116 QRectcxx . . $ QRect# scrollRegioncxx . . $ Konsole/ScreenWindow#scrollRegion(d857385bac04cbf7).() const;
117
118 /**
119 * Sets the start of the selection to the given @p line and @p column within
120 * the window.
121 */
122 void setSelectionStartcxx . . $ Konsole/ScreenWindow#setSelectionStart(6908015b96d379c0).( int column , int line , bool columnMode );
123 /**
124 * Sets the end of the selection to the given @p line and @p column within
125 * the window.
126 */
127 void setSelectionEndcxx . . $ Konsole/ScreenWindow#setSelectionEnd(3e454b8ccf442868).( int column , int line );
128 /**
129 * Retrieves the start of the selection within the window.
130 */
131 void getSelectionStartcxx . . $ Konsole/ScreenWindow#getSelectionStart(44820809252bebc4).( int& column , int& line );
132 /**
133 * Retrieves the end of the selection within the window.
134 */
135 void getSelectionEndcxx . . $ Konsole/ScreenWindow#getSelectionEnd(44820809252bebc4).( int& column , int& line );
136 /**
137 * Returns true if the character at @p line , @p column is part of the selection.
138 */
139 bool isSelectedcxx . . $ Konsole/ScreenWindow#isSelected(cf9ef193275fa6d8).( int column , int line );
140 /**
141 * Clears the current selection
142 */
143 void clearSelectioncxx . . $ Konsole/ScreenWindow#clearSelection(49f6e7a06ebc5aa8).();
144
145 /** Sets the number of lines in the window */
146 void setWindowLinescxx . . $ Konsole/ScreenWindow#setWindowLines(d4f767463ce0a6b3).(int lines);
147 /** Returns the number of lines in the window */
148 int windowLinescxx . . $ Konsole/ScreenWindow#windowLines(455f465bc33b4cdf).() const;
149 /** Returns the number of columns in the window */
150 int windowColumnscxx . . $ Konsole/ScreenWindow#windowColumns(455f465bc33b4cdf).() const;
151
152 /** Returns the total number of lines in the screen */
153 int lineCountcxx . . $ Konsole/ScreenWindow#lineCount(455f465bc33b4cdf).() const;
154 /** Returns the total number of columns in the screen */
155 int columnCountcxx . . $ Konsole/ScreenWindow#columnCount(455f465bc33b4cdf).() const;
156
157 /** Returns the index of the line which is currently at the top of this window */
158 int currentLinecxx . . $ Konsole/ScreenWindow#currentLine(455f465bc33b4cdf).() const;
159
160 /**
161 * Returns the position of the cursor
162 * within the window.
163 */
164 QPointcxx . . $ QPoint# cursorPositioncxx . . $ Konsole/ScreenWindow#cursorPosition(75d69cfbd3c4b2dd).() const;
165
166 /**
167 * Convenience method. Returns true if the window is currently at the bottom
168 * of the screen.
169 */
170 bool atEndOfOutputcxx . . $ Konsole/ScreenWindow#atEndOfOutput(50ce9a9e25b4a850).() const;
171
172 /** Scrolls the window so that @p line is at the top of the window */
173 void scrollTocxx . . $ Konsole/ScreenWindow#scrollTo(d4f767463ce0a6b3).( int line );
174
175 /** Describes the units which scrollBy() moves the window by. */
176 enum RelativeScrollModecxx . . $ Konsole/ScreenWindow#RelativeScrollMode#
177 {
178 /** Scroll the window down by a given number of lines. */
179 ScrollLinescxx . . $ Konsole/ScreenWindow#ScrollLines.,
180 /**
181 * Scroll the window down by a given number of pages, where
182 * one page is windowLines() lines
183 */
184 ScrollPagescxx . . $ Konsole/ScreenWindow#ScrollPages.
185 };
186
187 /**
188 * Scrolls the window relative to its current position on the screen.
189 *
190 * @param mode Specifies whether @p amount refers to the number of lines or the number
191 * of pages to scroll.
192 * @param amount The number of lines or pages ( depending on @p mode ) to scroll by. If
193 * this number is positive, the view is scrolled down. If this number is negative, the view
194 * is scrolled up.
195 */
196 void scrollBycxx . . $ Konsole/ScreenWindow#scrollBy(f912647b3bb3f396).( RelativeScrollModecxx . . $ Konsole/ScreenWindow#RelativeScrollMode# mode , int amount );
197
198 /**
199 * Specifies whether the window should automatically move to the bottom
200 * of the screen when new output is added.
201 *
202 * If this is set to true, the window will be moved to the bottom of the associated screen ( see
203 * screen() ) when the notifyOutputChanged() method is called.
204 */
205 void setTrackOutputcxx . . $ Konsole/ScreenWindow#setTrackOutput(b45ddcbc8423892c).(bool trackOutput);
206 /**
207 * Returns whether the window automatically moves to the bottom of the screen as
208 * new output is added. See setTrackOutput()
209 */
210 bool trackOutputcxx . . $ Konsole/ScreenWindow#trackOutput(50ce9a9e25b4a850).() const;
211
212 /**
213 * Returns the text which is currently selected.
214 *
215 * @param preserveLineBreaks See Screen::selectedText()
216 */
217 QStringcxx . . $ QString# selectedTextcxx . . $ Konsole/ScreenWindow#selectedText(11ecdffe9192d1a2).( bool preserveLineBreaks ) const;
218
219 public slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
220 /**
221 * Notifies the window that the contents of the associated terminal screen have changed.
222 * This moves the window to the bottom of the screen if trackOutput() is true and causes
223 * the outputChanged() signal to be emitted.
224 */
225 void notifyOutputChangedcxx . . $ Konsole/ScreenWindow#notifyOutputChanged(49f6e7a06ebc5aa8).();
226
227 void handleCommandFromKeyboardcxx . . $ Konsole/ScreenWindow#handleCommandFromKeyboard(16cb6c07cd6749eb).(KeyboardTranslatorcxx . . $ Konsole/KeyboardTranslator#::Commandcxx . . $ Konsole/KeyboardTranslator#Command# command);
228
229 signalscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:89:14`!:
230 /**
231 * Emitted when the contents of the associated terminal screen (see screen()) changes.
232 */
233 void outputChangedcxx . . $ Konsole/ScreenWindow#outputChanged(49f6e7a06ebc5aa8).();
234
235 /**
236 * Emitted when the screen window is scrolled to a different position.
237 *
238 * @param line The line which is now at the top of the window.
239 */
240 void scrolledcxx . . $ Konsole/ScreenWindow#scrolled(d4f767463ce0a6b3).(int line);
241
242 /** Emitted when the selection is changed. */
243 void selectionChangedcxx . . $ Konsole/ScreenWindow#selectionChanged(49f6e7a06ebc5aa8).();
244
245 void scrollToEndcxx . . $ Konsole/ScreenWindow#scrollToEnd(49f6e7a06ebc5aa8).();
246
247 private:
248 int endWindowLinecxx . . $ Konsole/ScreenWindow#endWindowLine(455f465bc33b4cdf).() const;
249 void fillUnusedAreacxx . . $ Konsole/ScreenWindow#fillUnusedArea(49f6e7a06ebc5aa8).();
250
251 Screencxx . . $ Konsole/Screen#* _screencxx . . $ Konsole/ScreenWindow#_screen.; // see setScreen() , screen()
252 Charactercxx . . $ Konsole/Character#* _windowBuffercxx . . $ Konsole/ScreenWindow#_windowBuffer.;
253 int _windowBufferSizecxx . . $ Konsole/ScreenWindow#_windowBufferSize.;
254 bool _bufferNeedsUpdatecxx . . $ Konsole/ScreenWindow#_bufferNeedsUpdate.;
255
256 int _windowLinescxx . . $ Konsole/ScreenWindow#_windowLines.;
257 int _currentLinecxx . . $ Konsole/ScreenWindow#_currentLine.; // see scrollTo() , currentLine()
258 bool _trackOutputcxx . . $ Konsole/ScreenWindow#_trackOutput.; // see setTrackOutput() , trackOutput()
259 int _scrollCountcxx . . $ Konsole/ScreenWindow#_scrollCount.; // count of lines which the window has been scrolled by since
260 // the last call to resetScrollCount()
261 };
262
263 }
264 #endif // SCREENWINDOW_H