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

Kate

KateRenderer Class Reference

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

#include <katerenderer.h>

List of all members.


Public Types

enum  caretStyles { Insert, Replace }

Public Member Functions

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

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).

Enumerator:
Insert 
Replace 

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 37 of file katerenderer.cpp.

KateRenderer::~KateRenderer (  ) 

Destructor.

Definition at line 57 of file katerenderer.cpp.


Member Function Documentation

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 69 of file katerenderer.cpp.

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.

KateRendererConfig* KateRenderer::config (  )  [inline]

Configuration.

Definition at line 264 of file katerenderer.h.

const QFont * KateRenderer::currentFont (  ) 

Definition at line 922 of file katerenderer.cpp.

const QFontMetrics * KateRenderer::currentFontMetrics (  ) 

Definition at line 927 of file katerenderer.cpp.

void KateRenderer::decreaseFontSizes (  ) 

Definition at line 129 of file katerenderer.cpp.

uint KateRenderer::documentHeight (  ) 

Definition at line 972 of file katerenderer.cpp.

bool KateRenderer::drawCaret (  )  const [inline]

Determine whether the caret (text cursor) will be drawn.

Returns:
should it be drawn?

Definition at line 75 of file katerenderer.h.

uint KateRenderer::fontHeight (  ) 

Definition at line 967 of file katerenderer.cpp.

bool KateRenderer::getSelectionBounds ( uint  line,
uint  lineLength,
uint &  start,
uint &  end 
)

Definition at line 977 of file katerenderer.cpp.

void KateRenderer::increaseFontSizes (  ) 

Change to a different font (soon to be font set?).

Definition at line 121 of file katerenderer.cpp.

bool KateRenderer::isPrinterFriendly (  )  const

Returns:
whether the renderer is configured to paint in a printer-friendly fashion.

Definition at line 139 of file katerenderer.cpp.

void KateRenderer::paintTextLine ( QPainter &  paint,
const KateLineRange *  range,
int  xStart,
int  xEnd,
const KateTextCursor *  cursor = 0L,
const KateBracketRange *  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 253 of file katerenderer.cpp.

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 152 of file katerenderer.cpp.

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

Set the style of caret to be painted.

Parameters:
style style to set

Definition at line 82 of file katerenderer.cpp.

void KateRenderer::setDrawCaret ( bool  drawCaret  ) 

Set whether the caret (text cursor) will be drawn.

Parameters:
drawCaret should caret be drawn?

Definition at line 77 of file katerenderer.cpp.

void KateRenderer::setIndentWidth ( int  indentWidth  ) 

Sets the width of the tab.

Helps performance.

Parameters:
indentWidth new indent width

Definition at line 107 of file katerenderer.cpp.

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 144 of file katerenderer.cpp.

void KateRenderer::setShowIndentLines ( bool  showLines  ) 

Set whether a guide should be painted to help identifying indent lines.

Parameters:
showLines show the indent lines?

Definition at line 102 of file katerenderer.cpp.

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 116 of file katerenderer.cpp.

void KateRenderer::setShowTabs ( bool  showTabs  ) 

Set whether a mark should be painted to help identifying tabs.

Parameters:
showTabs show the tabs?

Definition at line 87 of file katerenderer.cpp.

void KateRenderer::setTabWidth ( int  tabWidth  ) 

Sets the width of the tab.

Helps performance.

Parameters:
tabWidth new tab width

Definition at line 92 of file katerenderer.cpp.

bool KateRenderer::showIndentLines (  )  const

Returns:
whether indent lines should be shown

indent lines should be shown

Definition at line 97 of file katerenderer.cpp.

bool KateRenderer::showSelections (  )  const [inline]

Show the view's selection?

Returns:
show sels?

Definition at line 136 of file katerenderer.h.

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.

uint KateRenderer::spaceWidth (  ) 

Text width & height calculation functions.

..

Definition at line 1027 of file katerenderer.cpp.

uint KateRenderer::textPos ( const KateTextLine::Ptr &  textLine,
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 937 of file katerenderer.cpp.

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 932 of file katerenderer.cpp.

uint KateRenderer::textWidth ( KateTextCursor &  cursor,
int  xPos,
uint  startCol = 0 
)

Definition at line 876 of file katerenderer.cpp.

uint KateRenderer::textWidth ( const KateTextCursor &  cursor  ) 

Definition at line 868 of file katerenderer.cpp.

uint KateRenderer::textWidth ( const KateTextLine::Ptr &  textLine,
uint  startcol,
uint  maxwidth,
bool *  needWrap,
int *  endX = 0 
)

Definition at line 773 of file katerenderer.cpp.

uint KateRenderer::textWidth ( const KateTextLine::Ptr &  textLine,
int  cursorCol 
)

Definition at line 736 of file katerenderer.cpp.

void KateRenderer::updateAttributes (  ) 

update the highlighting attributes (for example after an hl change or after hl config changed)

Definition at line 63 of file katerenderer.cpp.

void KateRenderer::updateConfig (  ) 

Definition at line 1018 of file katerenderer.cpp.


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

Kate

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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