• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

Konsole::Screen

Konsole::Screen Class Reference

An image of characters with associated attributes. More...

#include <Screen.h>

List of all members.


Public Member Functions

void backspace ()
void backtab (int n)
int bottomMargin () const
void changeTabStop (bool set)
void checkSelection (int from, int to)
void clear ()
void clearEntireLine ()
void clearEntireScreen ()
void clearSelection ()
void clearTabStops ()
void clearToBeginOfLine ()
void clearToBeginOfScreen ()
void clearToEndOfLine ()
void clearToEndOfScreen ()
void compose (const QString &compose)
void cursorDown (int n)
void cursorLeft (int n)
void cursorRight (int n)
void cursorUp (int n)
void deleteChars (int n)
void deleteLines (int n)
void displayCharacter (unsigned short c)
int droppedLines () const
void eraseChars (int n)
int getColumns () const
int getCursorX () const
int getCursorY () const
int getHistLines () const
void getImage (Character *dest, int size, int startLine, int endLine) const
QVector< LineProperty > getLineProperties (int startLine, int endLine) const
int getLines () const
bool getMode (int mode) const
const HistoryType & getScroll () const
void getSelectionEnd (int &column, int &line) const
void getSelectionStart (int &column, int &line) const
bool hasScroll () const
void helpAlign ()
void home ()
void index ()
void insertChars (int n)
void insertLines (int n)
bool isSelected (const int column, const int line) const
QRect lastScrolledRegion () const
void newLine ()
void nextLine ()
void reset (bool clearScreen=true)
void resetDroppedLines ()
void resetMode (int mode)
void resetRendition (int rendition)
void resetScrolledLines ()
void resizeImage (int new_lines, int new_columns)
void restoreCursor ()
void restoreMode (int mode)
void reverseIndex ()
void saveCursor ()
void saveMode (int mode)
 Screen (int lines, int columns)
void scrollDown (int n)
int scrolledLines () const
void scrollUp (int n)
QString selectedText (bool preserveLineBreaks) const
void setBackColor (int space, int color)
void setCursorX (int x)
void setCursorY (int y)
void setCursorYX (int y, int x)
void setDefaultMargins ()
void setDefaultRendition ()
void setForeColor (int space, int color)
void setLineProperty (LineProperty property, bool enable)
void setMargins (int topLine, int bottomLine)
void setMode (int mode)
void setRendition (int rendition)
void setScroll (const HistoryType &, bool copyPreviousScroll=true)
void setSelectionEnd (const int column, const int line)
void setSelectionStart (const int column, const int line, const bool blockSelectionMode)
void tab (int n=1)
int topMargin () const
void toStartOfLine ()
void writeLinesToStream (TerminalCharacterDecoder *decoder, int fromLine, int toLine) const
void writeSelectionToStream (TerminalCharacterDecoder *decoder, bool preserveLineBreaks=true) const
 ~Screen ()

Static Public Member Functions

static void fillWithDefaultChar (Character *dest, int count)

Detailed Description

An image of characters with associated attributes.

The terminal emulation ( Emulation ) receives a serial stream of characters from the program currently running in the terminal. From this stream it creates an image of characters which is ultimately rendered by the display widget ( TerminalDisplay ). Some types of emulation may have more than one screen image.

getImage() is used to retrieve the currently visible image which is then used by the display widget to draw the output from the terminal.

The number of lines of output history which are kept in addition to the current screen image depends on the history scroll being used to store the output. The scroll is specified using setScroll() The output history can be retrieved using writeToStream()

The screen image has a selection associated with it, specified using setSelectionStart() and setSelectionEnd(). The selected text can be retrieved using selectedText(). When getImage() is used to retrieve the visible image, characters which are part of the selection have their colours inverted.

Definition at line 71 of file Screen.h.


Constructor & Destructor Documentation

Screen::Screen ( int  lines,
int  columns 
)

Construct a new screen image of size lines by columns.

Definition at line 72 of file Screen.cpp.

Screen::~Screen (  ) 

Destructor

Definition at line 99 of file Screen.cpp.


Member Function Documentation

void Screen::backspace (  ) 

Moves the cursor one column to the left and erases the character at the new cursor position.

Definition at line 550 of file Screen.cpp.

void Screen::backtab ( int  n  ) 

Moves the cursor n tab-stops to the left.

Definition at line 575 of file Screen.cpp.

int Screen::bottomMargin (  )  const

Returns the bottom line of the scrolling region.

Definition at line 160 of file Screen.cpp.

void Screen::changeTabStop ( bool  set  ) 

Sets or removes a tab stop at the cursor's current column.

Definition at line 591 of file Screen.cpp.

void Screen::checkSelection ( int  from,
int  to 
)

TODO Document me.

Definition at line 615 of file Screen.cpp.

void Screen::clear (  ) 

Clear the entire screen and move the cursor to the home position.

Equivalent to calling clearEntireScreen() followed by home().

Definition at line 544 of file Screen.cpp.

void Screen::clearEntireLine (  ) 

Clears the whole of the line on which the cursor is currently positioned.

Definition at line 967 of file Screen.cpp.

void Screen::clearEntireScreen (  ) 

Clear the whole screen, moving the current screen contents into the history first.

Definition at line 937 of file Screen.cpp.

void Screen::clearSelection (  ) 

Clears the current selection.

Definition at line 1012 of file Screen.cpp.

void Screen::clearTabStops (  ) 

Clears all the tab stops.

Definition at line 586 of file Screen.cpp.

void Screen::clearToBeginOfLine (  ) 

Clears from the current cursor position to the beginning of the line.

Definition at line 962 of file Screen.cpp.

void Screen::clearToBeginOfScreen (  ) 

Clear the area of the screen from the current cursor position to the start of the screen.

Definition at line 932 of file Screen.cpp.

void Screen::clearToEndOfLine (  ) 

Clears from the current cursor position to the end of the line.

Definition at line 957 of file Screen.cpp.

void Screen::clearToEndOfScreen (  ) 

Clear the area of the screen from the current cursor position to the end of the screen.

Definition at line 927 of file Screen.cpp.

void Screen::compose ( const QString &  compose  ) 

Definition at line 693 of file Screen.cpp.

void Screen::cursorDown ( int  n  ) 

Move the cursor down by n lines.

The cursor will stop at the bottom margin.

Definition at line 114 of file Screen.cpp.

void Screen::cursorLeft ( int  n  ) 

Move the cursor to the left by n columns.

The cursor will stop at the first column.

Definition at line 123 of file Screen.cpp.

void Screen::cursorRight ( int  n  ) 

Move the cursor to the right by n columns.

The cursor will stop at the right-most column.

Definition at line 131 of file Screen.cpp.

void Screen::cursorUp ( int  n  ) 

Move the cursor up by n lines.

The cursor will stop at the top margin.

Definition at line 105 of file Screen.cpp.

void Screen::deleteChars ( int  n  ) 

Delete n characters beginning from the current cursor position.

If n is 0 then one character is deleted.

Definition at line 196 of file Screen.cpp.

void Screen::deleteLines ( int  n  ) 

Removes n lines beginning from the current cursor position.

The position of the cursor is not altered. If n is 0 then one line is removed.

Definition at line 230 of file Screen.cpp.

void Screen::displayCharacter ( unsigned short  c  ) 

Displays a new character at the current cursor position.

If the cursor is currently positioned at the right-edge of the screen and line wrapping is enabled then the character is added at the start of a new line below the current one.

If the MODE_Insert screen mode is currently enabled then the character is inserted at the current cursor position, otherwise it will replace the character already at the current cursor position.

Definition at line 625 of file Screen.cpp.

int Screen::droppedLines (  )  const

Returns the number of lines of output which have been dropped from the history since the last call to resetDroppedLines().

If the history is not unlimited then it will drop the oldest lines of output if new lines are added when it is full.

Definition at line 710 of file Screen.cpp.

void Screen::eraseChars ( int  n  ) 

Erase n characters beginning from the current cursor position.

This is equivalent to over-writing n characters starting with the current cursor position with spaces. If n is 0 then one character is erased.

Definition at line 189 of file Screen.cpp.

void Screen::fillWithDefaultChar ( Character *  dest,
int  count 
) [static]

Fills the buffer dest with count instances of the default (ie.

blank) Character style.

Definition at line 1370 of file Screen.cpp.

int Konsole::Screen::getColumns (  )  const [inline]

Return the number of columns.

Definition at line 386 of file Screen.h.

int Screen::getCursorX (  )  const

Returns the column which the cursor is positioned at.

Definition at line 798 of file Screen.cpp.

int Screen::getCursorY (  )  const

Returns the line which the cursor is positioned on.

Definition at line 803 of file Screen.cpp.

int Screen::getHistLines (  )  const

Return the number of lines in the history buffer.

Definition at line 1334 of file Screen.cpp.

void Screen::getImage ( Character *  dest,
int  size,
int  startLine,
int  endLine 
) const

Returns the current screen image.

The result is an array of Characters of size [getLines()][getColumns()] which must be freed by the caller after use.

Parameters:
dest Buffer to copy the characters into
size Size of dest in Characters
startLine Index of first line to copy
endLine Index of last line to copy

Definition at line 456 of file Screen.cpp.

QVector< LineProperty > Screen::getLineProperties ( int  startLine,
int  endLine 
) const

Returns the additional attributes associated with lines in the image.

The most important attribute is LINE_WRAPPED which specifies that the line is wrapped, other attributes control the size of characters in the line.

Definition at line 491 of file Screen.cpp.

int Konsole::Screen::getLines (  )  const [inline]

Return the number of lines.

Definition at line 383 of file Screen.h.

bool Screen::getMode ( int  mode  )  const

Returns whether the specified screen mode is enabled or not .

Definition at line 270 of file Screen.cpp.

const HistoryType & Screen::getScroll (  )  const

Returns the type of storage used to keep lines in the history.

Definition at line 1358 of file Screen.cpp.

void Screen::getSelectionEnd ( int &  column,
int &  line 
) const

Retrieves the end of the selection or the cursor position if there is no selection.

Definition at line 1032 of file Screen.cpp.

void Screen::getSelectionStart ( int &  column,
int &  line 
) const

Retrieves the start of the selection or the cursor position if there is no selection.

Definition at line 1019 of file Screen.cpp.

bool Screen::hasScroll (  )  const

Returns true if this screen keeps lines that are scrolled off the screen in a history buffer.

Definition at line 1353 of file Screen.cpp.

void Screen::helpAlign (  ) 

Fills the entire screen with the letter 'E'.

fill screen with 'E' This is to aid screen alignment

Definition at line 952 of file Screen.cpp.

void Screen::home (  ) 

Sets the position of the cursor to the 'home' position at the top-left corner of the screen (0,0).

Definition at line 787 of file Screen.cpp.

void Screen::index (  ) 

Move the cursor down one line.

If the cursor is on the bottom line of the scrolling region (as returned by bottomMargin()) the scrolling region is scrolled up by one line instead.

Definition at line 165 of file Screen.cpp.

void Screen::insertChars ( int  n  ) 

Insert n blank characters beginning from the current cursor position.

The position of the cursor is not altered. If n is 0 then one character is inserted.

Definition at line 217 of file Screen.cpp.

void Screen::insertLines ( int  n  ) 

Inserts lines beginning from the current cursor position.

The position of the cursor is not altered. If n is 0 then one line is inserted.

Definition at line 236 of file Screen.cpp.

bool Screen::isSelected ( const int  column,
const int  line 
) const

Returns true if the character at (column, line) is part of the current selection.

Definition at line 1091 of file Screen.cpp.

QRect Screen::lastScrolledRegion (  )  const

Returns the region of the image which was last scrolled.

This is the area of the image from the top margin to the bottom margin when the last scroll occurred.

Definition at line 730 of file Screen.cpp.

void Screen::newLine (  ) 

Moves the cursor down one line, if the MODE_NewLine mode flag is enabled then the cursor is returned to the leftmost column first.

Equivalent to NextLine() if the MODE_NewLine flag is set or index() otherwise.

Definition at line 608 of file Screen.cpp.

void Screen::nextLine (  ) 

Moves the cursor down one line and positions it at the beginning of the line.

Equivalent to calling Return() followed by index()

Definition at line 183 of file Screen.cpp.

void Screen::reset ( bool  clearScreen = true  ) 

Resets the state of the screen.

This resets the various screen modes back to their default states. The cursor style and colors are reset (as if setDefaultRendition() had been called)

  • Line wrapping is enabled.
  • Origin mode is disabled.
  • Insert mode is disabled.
  • Cursor mode is enabled. TODO Document me
  • Screen mode is disabled. TODO Document me
  • New line mode is disabled. TODO Document me

If clearScreen is true then the screen contents are erased entirely, otherwise they are unaltered.

Definition at line 525 of file Screen.cpp.

void Screen::resetDroppedLines (  ) 

Resets the count of the number of lines dropped from the history.

Definition at line 714 of file Screen.cpp.

void Screen::resetMode ( int  mode  ) 

Resets (clears) the specified screen mode.

Definition at line 251 of file Screen.cpp.

void Screen::resetRendition ( int  rendition  ) 

Disables the given rendition flag.

Rendition flags control the appearance of characters on the screen.

See also:
Character::rendition

Definition at line 978 of file Screen.cpp.

void Screen::resetScrolledLines (  ) 

Resets the count of the number of lines that the image has been scrolled up or down by, see scrolledLines().

Definition at line 718 of file Screen.cpp.

void Screen::resizeImage ( int  new_lines,
int  new_columns 
)

Resizes the image to a new fixed size of new_lines by new_columns.

In the case that new_columns is smaller than the current number of columns, existing lines are not truncated. This prevents characters from being lost if the terminal display is resized smaller and then larger again.

The top and bottom margins are reset to the top and bottom of the new screen size. Tab stops are also reset and the current selection is cleared.

Definition at line 294 of file Screen.cpp.

void Screen::restoreCursor (  ) 

Restores the position and appearance of the cursor.

See saveCursor()

Definition at line 284 of file Screen.cpp.

void Screen::restoreMode ( int  mode  ) 

Restores the state of a screen mode saved by calling saveMode().

Definition at line 265 of file Screen.cpp.

void Screen::reverseIndex (  ) 

Move the cursor up one line.

If the cursor is on the top line of the scrolling region (as returned by topMargin()) the scrolling region is scrolled down by one line instead.

Definition at line 174 of file Screen.cpp.

void Screen::saveCursor (  ) 

Saves the current position and appearance (text color and style) of the cursor.

It can be restored by calling restoreCursor()

Definition at line 275 of file Screen.cpp.

void Screen::saveMode ( int  mode  ) 

Saves the state of the specified screen mode.

It can be restored using restoreMode()

Definition at line 260 of file Screen.cpp.

void Screen::scrollDown ( int  n  ) 

Scroll the scrolling region of the screen down by n lines.

The scrolling region is initially the whole screen, but can be changed using setMargins()

Definition at line 747 of file Screen.cpp.

int Screen::scrolledLines (  )  const

Returns the number of lines that the image has been scrolled up or down by, since the last call to resetScrolledLines().

a positive return value indicates that the image has been scrolled up, a negative return value indicates that the image has been scrolled down.

Definition at line 706 of file Screen.cpp.

void Screen::scrollUp ( int  n  ) 

Scroll the scrolling region of the screen up by n lines.

The scrolling region is initially the whole screen, but can be changed using setMargins()

Definition at line 723 of file Screen.cpp.

QString Screen::selectedText ( bool  preserveLineBreaks  )  const

Convenience method.

Returns the currently selected text.

Parameters:
preserveLineBreaks Specifies whether new line characters should be inserted into the returned text at the end of each terminal line.

Definition at line 1104 of file Screen.cpp.

void Screen::setBackColor ( int  space,
int  color 
)

Sets the cursor's background color.

Parameters:
space The color space used by the color argumnet.
color The new background color. The meaning of this depends on the color space used.
See also:
CharacterColor

Definition at line 1002 of file Screen.cpp.

void Screen::setCursorX ( int  x  ) 

Position the cursor at column x.

Definition at line 773 of file Screen.cpp.

void Screen::setCursorY ( int  y  ) 

Position the cursor on line y.

Definition at line 780 of file Screen.cpp.

void Screen::setCursorYX ( int  y,
int  x 
)

Position the cursor at line y, column x.

Definition at line 768 of file Screen.cpp.

void Screen::setDefaultMargins (  ) 

Resets the scrolling margins back to the top and bottom lines of the screen.

Definition at line 336 of file Screen.cpp.

void Screen::setDefaultRendition (  ) 

Resets the cursor's color back to the default and sets the character's rendition flags back to the default settings.

Definition at line 984 of file Screen.cpp.

void Screen::setForeColor ( int  space,
int  color 
)

Sets the cursor's foreground color.

Parameters:
space The color space used by the color argument
color The new foreground color. The meaning of this depends on the color space used.
See also:
CharacterColor

Definition at line 992 of file Screen.cpp.

void Screen::setLineProperty ( LineProperty  property,
bool  enable 
)

Sets or clears an attribute of the current line.

Parameters:
property The attribute to set or clear Possible properties are: LINE_WRAPPED: Specifies that the line is wrapped. LINE_DOUBLEWIDTH: Specifies that the characters in the current line should be double the normal width. LINE_DOUBLEHEIGHT:Specifies that the characters in the current line should be double the normal height. Double-height lines are formed of two lines containing the same characters, with both having the LINE_DOUBLEHEIGHT attribute. This allows other parts of the code to work on the assumption that all lines are the same height.
enable true to apply the attribute to the current line or false to remove it

Definition at line 1363 of file Screen.cpp.

void Screen::setMargins ( int  topLine,
int  bottomLine 
)

Sets the margins for scrolling the screen.

Parameters:
topLine The top line of the new scrolling margin.
bottomLine The bottom line of the new scrolling margin.

Definition at line 138 of file Screen.cpp.

void Screen::setMode ( int  mode  ) 

Sets (enables) the specified screen mode.

Definition at line 242 of file Screen.cpp.

void Screen::setRendition ( int  rendition  ) 

Enables the given rendition flag.

Rendition flags control the appearance of characters on the screen.

See also:
Character::rendition

Definition at line 972 of file Screen.cpp.

void Screen::setScroll ( const HistoryType &  t,
bool  copyPreviousScroll = true 
)

Sets the type of storage used to keep lines in the history.

If copyPreviousScroll is true then the contents of the previous history buffer are copied into the new scroll.

Definition at line 1339 of file Screen.cpp.

void Screen::setSelectionEnd ( const int  column,
const int  line 
)

Sets the end of the current selection.

Parameters:
column The column index of the last character in the selection.
line The line index of the last character in the selection.

Definition at line 1056 of file Screen.cpp.

void Screen::setSelectionStart ( const int  column,
const int  line,
const bool  blockSelectionMode 
)

Sets the start of the selection.

Parameters:
column The column index of the first character in the selection.
line The line index of the first character in the selection.
blockSelectionMode True if the selection is in column mode.

Definition at line 1045 of file Screen.cpp.

void Screen::tab ( int  n = 1  ) 

Moves the cursor n tab-stops to the right.

Definition at line 562 of file Screen.cpp.

int Screen::topMargin (  )  const

Returns the top line of the scrolling region.

Definition at line 156 of file Screen.cpp.

void Screen::toStartOfLine (  ) 

Moves the cursor to the beginning of the current line.

Equivalent to setCursorX(0)

Definition at line 793 of file Screen.cpp.

void Screen::writeLinesToStream ( TerminalCharacterDecoder *  decoder,
int  fromLine,
int  toLine 
) const

Copies part of the output to a stream.

Parameters:
decoder A decoder which coverts terminal characters into text
from The first line in the history to retrieve
to The last line in the history to retrieve

Definition at line 1270 of file Screen.cpp.

void Screen::writeSelectionToStream ( TerminalCharacterDecoder *  decoder,
bool  preserveLineBreaks = true 
) const

Copies the selected characters, set using.

See also:
setSelBeginXY and

setSelExtentXY into a stream.

Parameters:
decoder A decoder which converts terminal characters into text. PlainTextDecoder is the most commonly used decoder which coverts characters into plain text with no formatting.
preserveLineBreaks Specifies whether new line characters should be inserted into the returned text at the end of each terminal line.

Definition at line 1122 of file Screen.cpp.


The documentation for this class was generated from the following files:
  • Screen.h
  • Screen.cpp

Konsole

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

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal