class TextLine

The TextLine represents a line of text. More...

Definition#include <kwrite_doc.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Members


Detailed Description

The TextLine represents a line of text. A text line that contains the text, an attribute for each character, an attribute for the free space behind the last character and a context number for the syntax highlight. The attribute stores the index to a table that contains fonts and colors and also if a character is selected.

 TextLine (int attribute = 0, int context = 0)

Creates an empty text line with given attribute and syntax highlight context

int  length ()

[const]

Returns the length

void  replace (int pos, int delLen, const QChar *insText, int insLen, uchar *insAttribs = 0L)

Universal text manipulation method. It can be used to insert, delete or replace text.

void  append (const QChar *s, int l)

Appends a string of length l to the textline

void  wrap (TextLine *nextLine, int pos)

Wraps the text from the given position to the end to the next line

void  unWrap (int pos, TextLine *nextLine, int len)

Wraps the text of given length from the beginning of the next line to this line at the given position

void  truncate (int newLen)

Truncates the textline to the new length

int  firstChar ()

[const]

Returns the position of the first character which is not a white space

int  lastChar ()

[const]

Returns the position of the last character which is not a white space

void  removeSpaces ()

Removes trailing spaces

QChar  getChar (int pos)

[const]

Gets the char at the given position

const QChar * getText ()

[const]

Gets the text. WARNING: it is not null terminated

const QChar * getString ()

Gets a C-like null terminated string

int  cursorX (int pos, int tabChars)

[const]

Returns the x position of the cursor at the given position, which depends on the number of tab characters

void  setAttribs (int attribute, int start, int end)

Sets the attributes from start to end -1

void  setAttr (int attribute)

Sets the attribute for the free space behind the last character

int  getAttr (int pos)

[const]

Gets the attribute at the given position

int  getAttr ()

[const]

Gets the attribute for the free space behind the last character

int  getRawAttr (int pos)

[const]

Gets the attribute, including the select state, at the given position

int  getRawAttr ()

[const]

Gets the attribute, including the select state, for the free space behind the last character

void  setContext (int context)

Sets the syntax highlight context number

int  getContext ()

[const]

Gets the syntax highlight context number

void  select (bool sel, int start, int end)

Sets the select state from start to end -1

void  selectEol (bool sel, int pos)

Sets the select state from the given position to the end, including the free space behind the last character

void  toggleSelect (int start, int end)

Toggles the select state from start to end -1

void  toggleSelectEol (int pos)

Toggles the select state from the given position to the end, including the free space behind the last character

int  numSelected ()

[const]

Returns the number of selected characters

bool  isSelected (int pos)

[const]

Returns if the character at the given position is selected

bool  isSelected ()

[const]

Returns true if the free space behind the last character is selected

int  findSelected (int pos)

[const]

Finds the next selected character, starting at the given position

int  findUnselected (int pos)

[const]

Finds the next unselected character, starting at the given position

int  findRevSelected (int pos)

[const]

Finds the previous selected character, starting at the given position

int  findRevUnselected (int pos)

[const]

Finds the previous unselected character, starting at the given position

void  markFound (int pos, int l)

Marks the text from the given position and length as found

void  unmarkFound ()

Removes the found marks

int len

[protected]

Length of the text line

int size

[protected]

Memory Size of the text line

QChar * text

[protected]

The text

uchar * attribs

[protected]

The attributes

uchar attr

[protected]

The attribute of the free space behind the end

int ctx

[protected]

The syntax highlight context


Generated by: root@porky.devel.redhat.com on Wed May 10 08:57:16 2000, using kdoc 2.0a35.