• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Konsole

  • kde-4.14
  • applications
  • konsole
  • src
ScreenWindow.h
Go to the documentation of this file.
1 /*
2  Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
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_H
22 
23 // Qt
24 #include <QtCore/QObject>
25 #include <QtCore/QPoint>
26 #include <QtCore/QRect>
27 
28 // Konsole
29 #include "Character.h"
30 
31 namespace Konsole
32 {
33 class Screen;
34 
52 class ScreenWindow : public QObject
53 {
54  Q_OBJECT
55 
56 public:
66  explicit ScreenWindow(Screen* screen, QObject* parent = 0);
67  virtual ~ScreenWindow();
68 
70  void setScreen(Screen* screen);
72  Screen* screen() const;
73 
81  Character* getImage();
82 
87  QVector<LineProperty> getLineProperties();
88 
100  int scrollCount() const;
101 
105  void resetScrollCount();
106 
114  QRect scrollRegion() const;
115 
116 
120  void setCurrentResultLine(int line);
121  int currentResultLine() const;
122 
127  void setSelectionStart(int column , int line , bool columnMode);
132  void setSelectionEnd(int column , int line);
133 
143  void setSelectionByLineRange(int start, int end);
144 
148  void getSelectionStart(int& column , int& line);
152  void getSelectionEnd(int& column , int& line);
156  bool isSelected(int column , int line);
160  void clearSelection();
161 
163  void setWindowLines(int lines);
165  int windowLines() const;
167  int windowColumns() const;
168 
170  int lineCount() const;
172  int columnCount() const;
173 
175  int currentLine() const;
176 
181  QPoint cursorPosition() const;
182 
187  bool atEndOfOutput() const;
188 
190  void scrollTo(int line);
191 
193  enum RelativeScrollMode {
195  ScrollLines,
200  ScrollPages
201  };
202 
213  void scrollBy(RelativeScrollMode mode, int amount, bool fullPage);
214 
222  void setTrackOutput(bool trackOutput);
227  bool trackOutput() const;
228 
235  QString selectedText(bool preserveLineBreaks, bool trimTrailingSpaces = false) const;
236 
237 public slots:
243  void notifyOutputChanged();
244 
245 signals:
249  void outputChanged();
250 
251  void currentResultLineChanged();
252 
258  void scrolled(int line);
259 
261  void selectionChanged();
262 
263 private:
264  int endWindowLine() const;
265  void fillUnusedArea();
266 
267  Screen* _screen; // see setScreen() , screen()
268  Character* _windowBuffer;
269  int _windowBufferSize;
270  bool _bufferNeedsUpdate;
271 
272  int _windowLines;
273  int _currentLine; // see scrollTo() , currentLine()
274  int _currentResultLine;
275  bool _trackOutput; // see setTrackOutput() , trackOutput()
276  int _scrollCount; // count of lines which the window has been scrolled by since
277  // the last call to resetScrollCount()
278 };
279 }
280 #endif // SCREENWINDOW_H
Konsole::ScreenWindow::scrollRegion
QRect scrollRegion() const
Returns the area of the window which was last scrolled, this is usually the whole window area...
Definition: ScreenWindow.cpp:286
Konsole::ScreenWindow::currentResultLine
int currentResultLine() const
Definition: ScreenWindow.cpp:217
Konsole::ScreenWindow::setSelectionEnd
void setSelectionEnd(int column, int line)
Sets the end of the selection to the given line and column within the window.
Definition: ScreenWindow.cpp:146
Konsole::ScreenWindow::notifyOutputChanged
void notifyOutputChanged()
Notifies the window that the contents of the associated terminal screen have changed.
Definition: ScreenWindow.cpp:296
Konsole::ScreenWindow::clearSelection
void clearSelection()
Clears the current selection.
Definition: ScreenWindow.cpp:170
Konsole::ScreenWindow::getLineProperties
QVector< LineProperty > getLineProperties()
Returns the line attributes associated with the lines of characters which are currently visible throu...
Definition: ScreenWindow.cpp:113
Konsole::ScreenWindow::currentLine
int currentLine() const
Returns the index of the line which is currently at the top of this window.
Definition: ScreenWindow.cpp:212
Konsole::ScreenWindow::trackOutput
bool trackOutput() const
Returns whether the window automatically moves to the bottom of the screen as new output is added...
Definition: ScreenWindow.cpp:271
QPoint
Konsole::ScreenWindow::columnCount
int columnCount() const
Returns the total number of columns in the screen.
Definition: ScreenWindow.cpp:197
Konsole::ScreenWindow::scrollBy
void scrollBy(RelativeScrollMode mode, int amount, bool fullPage)
Scrolls the window relative to its current position on the screen.
Definition: ScreenWindow.cpp:232
Konsole::ScreenWindow::setSelectionByLineRange
void setSelectionByLineRange(int start, int end)
Sets the selection as the range specified by line start and line end in the whole history...
Definition: ScreenWindow.cpp:154
Konsole::ScreenWindow::cursorPosition
QPoint cursorPosition() const
Returns the position of the cursor within the window.
Definition: ScreenWindow.cpp:202
Konsole::ScreenWindow::selectedText
QString selectedText(bool preserveLineBreaks, bool trimTrailingSpaces=false) const
Returns the text which is currently selected.
Definition: ScreenWindow.cpp:123
Konsole::ScreenWindow::scrollCount
int scrollCount() const
Returns the number of lines which the region of the window specified by scrollRegion() has been scrol...
Definition: ScreenWindow.cpp:276
Konsole::Character
A single character in the terminal which consists of a unicode character value, foreground and backgr...
Definition: Character.h:77
QRect
Konsole::ScreenWindow::atEndOfOutput
bool atEndOfOutput() const
Convenience method.
Definition: ScreenWindow.cpp:244
Konsole::ScreenWindow::outputChanged
void outputChanged()
Emitted when the contents of the associated terminal screen (see screen()) changes.
QObject
Konsole::ScreenWindow
Provides a window onto a section of a terminal screen.
Definition: ScreenWindow.h:52
Konsole::Screen
An image of characters with associated attributes.
Definition: Screen.h:74
Konsole::ScreenWindow::scrollTo
void scrollTo(int line)
Scrolls the window so that line is at the top of the window.
Definition: ScreenWindow.cpp:249
Konsole::ScreenWindow::windowColumns
int windowColumns() const
Returns the number of columns in the window.
Definition: ScreenWindow.cpp:187
QString
Konsole::ScreenWindow::~ScreenWindow
virtual ~ScreenWindow()
Definition: ScreenWindow.cpp:42
Character.h
Konsole::ScreenWindow::getSelectionEnd
void getSelectionEnd(int &column, int &line)
Retrieves the end of the selection within the window.
Definition: ScreenWindow.cpp:133
Konsole::ScreenWindow::isSelected
bool isSelected(int column, int line)
Returns true if the character at line , column is part of the selection.
Definition: ScreenWindow.cpp:165
Konsole::ScreenWindow::getSelectionStart
void getSelectionStart(int &column, int &line)
Retrieves the start of the selection within the window.
Definition: ScreenWindow.cpp:128
Konsole::ScreenWindow::getImage
Character * getImage()
Returns the image of characters which are currently visible through this window onto the screen...
Definition: ScreenWindow.cpp:58
Konsole::ScreenWindow::setCurrentResultLine
void setCurrentResultLine(int line)
What line the next search will start from.
Definition: ScreenWindow.cpp:222
QVector< LineProperty >
Konsole::ScreenWindow::resetScrollCount
void resetScrollCount()
Resets the count of scrolled lines returned by scrollCount()
Definition: ScreenWindow.cpp:281
Konsole::ScreenWindow::screen
Screen * screen() const
Returns the screen which this window looks onto.
Definition: ScreenWindow.cpp:53
Konsole::ScreenWindow::setSelectionStart
void setSelectionStart(int column, int line, bool columnMode)
Sets the start of the selection to the given line and column within the window.
Definition: ScreenWindow.cpp:138
Konsole::ScreenWindow::selectionChanged
void selectionChanged()
Emitted when the selection is changed.
Konsole::ScreenWindow::currentResultLineChanged
void currentResultLineChanged()
Konsole::ScreenWindow::setWindowLines
void setWindowLines(int lines)
Sets the number of lines in the window.
Definition: ScreenWindow.cpp:177
Konsole::ScreenWindow::scrolled
void scrolled(int line)
Emitted when the screen window is scrolled to a different position.
Konsole::ScreenWindow::RelativeScrollMode
RelativeScrollMode
Describes the units which scrollBy() moves the window by.
Definition: ScreenWindow.h:193
Konsole::ScreenWindow::setScreen
void setScreen(Screen *screen)
Sets the screen which this window looks onto.
Definition: ScreenWindow.cpp:46
QObject::parent
QObject * parent() const
Konsole::ScreenWindow::lineCount
int lineCount() const
Returns the total number of lines in the screen.
Definition: ScreenWindow.cpp:192
Konsole::ScreenWindow::setTrackOutput
void setTrackOutput(bool trackOutput)
Specifies whether the window should automatically move to the bottom of the screen when new output is...
Definition: ScreenWindow.cpp:266
Konsole::ScreenWindow::ScrollPages
Scroll the window down by a given number of pages, where one page is windowLines() lines...
Definition: ScreenWindow.h:200
Konsole::ScreenWindow::windowLines
int windowLines() const
Returns the number of lines in the window.
Definition: ScreenWindow.cpp:182
Konsole::ScreenWindow::ScreenWindow
ScreenWindow(Screen *screen, QObject *parent=0)
Constructs a new screen window with the given parent.
Definition: ScreenWindow.cpp:28
Konsole::ScreenWindow::ScrollLines
Scroll the window down by a given number of lines.
Definition: ScreenWindow.h:195
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal