kate Library: KateRenderer Class Reference (kate Library)

| # kate Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KateRenderer Class Reference

Handles all of the work of rendering the text (used for the views and printing). More...

`#include <katerenderer.h>`

Collaboration diagram for KateRenderer:

[legend]
List of all members.

## Public Types
enum | caretStyles { Insert, Replace }
## Public Member Functions
| KateRenderer (KateDocument *doc, KateView *view=0)
| ~KateRenderer ()
void | updateAttributes ()
bool | drawCaret () const
void | setDrawCaret (bool drawCaret)
KateRenderer::caretStyles | caretStyle () const
void | setCaretStyle (KateRenderer::caretStyles style)
bool | showTabs () const
void | setShowTabs (bool showTabs)
void | setTabWidth (int tabWidth)
bool | showSelections () const
void | setShowSelections (bool showSelections)
void | increaseFontSizes ()
void | decreaseFontSizes ()
const QFont * | currentFont ()
const QFontMetrics * | currentFontMetrics ()
bool | isPrinterFriendly () const
void | setPrinterFriendly (bool printerFriendly)
uint | spaceWidth ()
uint | textWidth (const KateTextLine::Ptr &, int cursorCol)
uint | textWidth (const KateTextLine::Ptr &textLine, uint startcol, uint maxwidth, bool *needWrap, int *endX=0)
uint | textWidth (const KateTextCursor &cursor)
uint | textWidth (KateTextCursor &cursor, int xPos, uint startCol=0)
uint | textPos (uint line, int xPos, uint startCol=0, bool nearest=true)
uint | textPos (const KateTextLine::Ptr &, int xPos, uint startCol=0, bool nearest=true)
uint | fontHeight ()
uint | documentHeight ()
bool | getSelectionBounds (uint line, uint lineLength, uint &start, uint &end)
void | paintTextLine (QPainter &paint, const KateLineRange *range, int xStart, int xEnd, const KateTextCursor *cursor=0L, const KateTextRange *bracketmark=0L)
bool | paintTextLineBackground (QPainter &paint, int line, bool isCurrentLine, int xStart, int xEnd)
KateAttribute * | attribute (uint pos)
KateRendererConfig * | config ()
void | updateConfig ()

## Detailed Description

Handles all of the work of rendering the text (used for the views and printing).

Definition at line 42 of file katerenderer.h.

## Member Enumeration Documentation

enum KateRenderer::caretStyles

| Style of Caret (Insert or Replace mode). Definition at line 48 of file katerenderer.h.

## Constructor & Destructor Documentation

KateRenderer::KateRenderer | ( | KateDocument * | doc,
|  | KateView * | view = `0`
| ) |

  | Constructor. Parameters:
  | doc | document to render
  | view | view which is output (0 for example for rendering to print)
Definition at line 40 of file katerenderer.cpp. References updateAttributes().

KateRenderer::~KateRenderer | ( |  | ) |

| Destructor. Definition at line 55 of file katerenderer.cpp.

## Member Function Documentation

void KateRenderer::updateAttributes | ( |  | ) |

| update the highlighting attributes (for example after an hl change or after hl config changed) Definition at line 61 of file katerenderer.cpp. References config(). Referenced by KateRenderer().

bool KateRenderer::drawCaret | ( |  | ) | const`[inline]`

  | Determine whether the caret (text cursor) will be drawn. Parameters:
  | should | it be drawn?
Definition at line 75 of file katerenderer.h. Referenced by paintTextLine().

void KateRenderer::setDrawCaret | ( | bool | drawCaret | ) |

  | Set whether the caret (text cursor) will be drawn. Parameters:
  | drawCaret | should caret be drawn?
Definition at line 75 of file katerenderer.cpp. Referenced by setPrinterFriendly().

KateRenderer::caretStyles KateRenderer::caretStyle | ( |  | ) | const`[inline]`

| The style of the caret (text cursor) to be painted. Returns: caretStyle Definition at line 87 of file katerenderer.h. Referenced by paintTextLine().

void KateRenderer::setCaretStyle | ( | KateRenderer::caretStyles | style | ) |

  | Set the style of caret to be painted. Parameters:
  | style | style to set
Definition at line 80 of file katerenderer.cpp.

bool KateRenderer::showTabs | ( |  | ) | const`[inline]`

| Returns: whether tabs should be shown (ie. a small mark drawn to identify a tab) tabs should be shown Definition at line 100 of file katerenderer.h. Referenced by paintTextLine().

void KateRenderer::setShowTabs | ( | bool | showTabs | ) |

  | Set whether a mark should be painted to help identifying tabs. Parameters:
  | showTabs | show the tabs?
Definition at line 85 of file katerenderer.cpp. Referenced by setPrinterFriendly().

void KateRenderer::setTabWidth | ( | int | tabWidth | ) |

  | Sets the width of the tab. Helps performance. Parameters:
  | tabWidth | new tab width
Definition at line 90 of file katerenderer.cpp.

bool KateRenderer::showSelections | ( |  | ) | const`[inline]`

| Show the view's selection? Returns: show sels? Definition at line 118 of file katerenderer.h. Referenced by paintTextLine(), and paintTextLineBackground().

void KateRenderer::setShowSelections | ( | bool | showSelections | ) |

  | Set whether the view's selections should be shown. The default is true. Parameters:
  | showSelections | show the selections?
Definition at line 95 of file katerenderer.cpp. Referenced by setPrinterFriendly().

void KateRenderer::increaseFontSizes | ( |  | ) |

| Change to a different font (soon to be font set?). Definition at line 100 of file katerenderer.cpp. References config(), QFont::pointSize(), and QFont::setPointSize().

bool KateRenderer::isPrinterFriendly | ( |  | ) | const

| Returns: whether the renderer is configured to paint in a printer-friendly fashion. Definition at line 118 of file katerenderer.cpp. Referenced by paintTextLine(), and paintTextLineBackground().

void KateRenderer::setPrinterFriendly | ( | bool | printerFriendly | ) |

| Configure this renderer to paint in a printer-friendly fashion. Sets the other options appropriately if true. Definition at line 123 of file katerenderer.cpp. References setDrawCaret(), setShowSelections(), and setShowTabs().

uint KateRenderer::spaceWidth | ( |  | ) |

| Text width & height calculation functions... Definition at line 902 of file katerenderer.cpp. References attribute(), config(), and KateAttribute::width().

uint KateRenderer::textPos | ( | uint | line,
|  | int | xPos,
|  | uint | startCol = `0`,
|  | bool | nearest = `true`
| ) |

| Returns: the index of the character at the horixontal position `xpos` in `line`. If `nearest` is true, the character starting nearest to `xPos` is returned. If `nearest` is false, the index of the character containing `xPos` is returned. Definition at line 809 of file katerenderer.cpp.

uint KateRenderer::textPos | ( | const KateTextLine::Ptr & | ,
|  | int | xPos,
|  | uint | startCol = `0`,
|  | bool | nearest = `true`
| ) |

| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 814 of file katerenderer.cpp. References attribute(), config(), and KateAttribute::width().

void KateRenderer::paintTextLine | ( | QPainter & | paint,
|  | const KateLineRange * | range,
|  | int | xStart,
|  | int | xEnd,
|  | const KateTextCursor * | cursor = `0L`,
|  | const KateTextRange * | bracketmark = `0L`
| ) |

| This is the ultimate function to perform painting of a text line. (supports startcol/endcol, startx/endx) The text line is painted from the upper limit of (0,0). To move that, apply a transform to your painter. Definition at line 206 of file katerenderer.cpp. References KateAttribute::bgColor(), caretStyle(), KateTextCursor::col(), QColorGroup::color(), config(), KSharedPtr< T >::data(), drawCaret(), QString::fill(), KateAttribute::font(), isPrinterFriendly(), KateAttribute::itemSet(), QString::length(), paintTextLineBackground(), KateAttribute::selectedTextColor(), KateTextCursor::setCol(), QColor::setHsv(), KateAttribute::setTextColor(), showSelections(), showTabs(), KateAttribute::textColor(), and KateAttribute::width().

bool KateRenderer::paintTextLineBackground | ( | QPainter & | paint,
|  | int | line,
|  | bool | isCurrentLine,
|  | int | xStart,
|  | int | xEnd
| ) |

| Paint the background of a line. Split off from the main paintTextLine method to make it smaller. As it's being called only once per line it shouldn't noticably affect performance and it helps readability a LOT. Returns: whether the selection has been painted or not Definition at line 131 of file katerenderer.cpp. References QColor::blue(), config(), QColor::green(), isPrinterFriendly(), QColor::isValid(), QColor::red(), QColor::setRgb(), and showSelections(). Referenced by paintTextLine().

KateAttribute * KateRenderer::attribute | ( | uint | pos | ) |

| This takes an in index, and returns all the attributes for it. For example, if you have a ktextline, and want the KateAttribute for a given position, do: attribute(myktextline->attribute(position)); Definition at line 67 of file katerenderer.cpp. References QMemArray::at(). Referenced by spaceWidth(), and textPos().

KateRendererConfig* KateRenderer::config | ( |  | ) | `[inline]`

| Configuration. Definition at line 242 of file katerenderer.h. Referenced by increaseFontSizes(), paintTextLine(), paintTextLineBackground(), spaceWidth(), textPos(), and updateAttributes().

The documentation for this class was generated from the following files:

- katerenderer.h
- katerenderer.cpp

This file is part of the documentation for kate Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:36:49 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003