• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • part
katerenderer.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2003 Hamish Rodda <rodda@kde.org>
3 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
4 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
5 Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License version 2 as published by the Free Software Foundation.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#ifndef __KATE_RENDERER_H__
23#define __KATE_RENDERER_H__
24
25#include "katecursor.h"
26#include "kateattribute.h"
27#include "katetextline.h"
28
29#include <tqfont.h>
30#include <tqfontmetrics.h>
31
32class KateDocument;
33class KateView;
34class KateLineRange;
35class KateRendererConfig;
36
42class KateRenderer
43{
44public:
48 enum caretStyles {
49 Insert,
50 Replace
51 };
52
58 KateRenderer(KateDocument* doc, KateView *view = 0);
59
63 ~KateRenderer();
64
69 void updateAttributes ();
70
75 inline bool drawCaret() const { return m_drawCaret; }
76
81 void setDrawCaret(bool drawCaret);
82
87 inline KateRenderer::caretStyles caretStyle() const { return m_caretStyle; }
88
93 void setCaretStyle(KateRenderer::caretStyles style);
94
100 inline bool showTabs() const { return m_showTabs; }
101
106 void setShowTabs(bool showTabs);
107
112 void setTabWidth(int tabWidth);
113
118 bool showIndentLines() const;
119
124 void setShowIndentLines(bool showLines);
125
130 void setIndentWidth(int indentWidth);
131
136 inline bool showSelections() const { return m_showSelections; }
137
143 void setShowSelections(bool showSelections);
144
148 void increaseFontSizes();
149 void decreaseFontSizes();
150 const TQFont* currentFont();
151 const TQFontMetrics* currentFontMetrics();
152
157 bool isPrinterFriendly() const;
158
164 void setPrinterFriendly(bool printerFriendly);
165
170 // Width calculators
171 uint spaceWidth();
172 uint textWidth(const KateTextLine::Ptr &, int cursorCol);
173 uint textWidth(const KateTextLine::Ptr &textLine, uint startcol, uint maxwidth, bool *needWrap, int *endX = 0);
174 uint textWidth(const KateTextCursor &cursor);
175
176 // Cursor constrainer
177 uint textWidth(KateTextCursor &cursor, int xPos, uint startCol = 0);
178
179 // Column calculators
188 uint textPos(uint line, int xPos, uint startCol = 0, bool nearest=true);
192 uint textPos(const KateTextLine::Ptr &, int xPos, uint startCol = 0, bool nearest=true);
193
194 // Font height
195 uint fontHeight();
196
197 // Document height
198 uint documentHeight();
199
200 // Selection boundaries
201 bool getSelectionBounds(uint line, uint lineLength, uint &start, uint &end);
202
210 void paintTextLine(TQPainter& paint, const KateLineRange* range, int xStart, int xEnd, const KateTextCursor* cursor = 0L, const KateBracketRange* bracketmark = 0L);
211
221 bool paintTextLineBackground(TQPainter& paint, int line, bool isCurrentLine, int xStart, int xEnd);
222
230 KateAttribute* attribute(uint pos);
231
232 private:
238 void paintWhitespaceMarker(TQPainter &paint, uint x, uint y);
239
241 void paintIndentMarker(TQPainter &paint, uint x, uint y);
242
243 KateDocument* m_doc;
244 KateView *m_view;
245
246 // cache of config values
247 int m_tabWidth;
248 int m_indentWidth;
249 uint m_schema;
250
251 // some internal flags
252 KateRenderer::caretStyles m_caretStyle;
253 bool m_drawCaret;
254 bool m_showSelections;
255 bool m_showTabs;
256 bool m_printerFriendly;
257
258 TQMemArray<KateAttribute> *m_attributes;
259
263 public:
264 inline KateRendererConfig *config () { return m_config; };
265
266 void updateConfig ();
267
268 private:
269 KateRendererConfig *m_config;
270};
271
272#endif
KateAttribute
The Attribute class incorporates all text decorations supported by Kate.
Definition: kateattribute.h:33
KateRenderer
Handles all of the work of rendering the text (used for the views and printing)
Definition: katerenderer.h:43
KateRenderer::setShowTabs
void setShowTabs(bool showTabs)
Set whether a mark should be painted to help identifying tabs.
Definition: katerenderer.cpp:87
KateRenderer::setIndentWidth
void setIndentWidth(int indentWidth)
Sets the width of the tab.
Definition: katerenderer.cpp:107
KateRenderer::setShowSelections
void setShowSelections(bool showSelections)
Set whether the view's selections should be shown.
Definition: katerenderer.cpp:116
KateRenderer::config
KateRendererConfig * config()
Configuration.
Definition: katerenderer.h:264
KateRenderer::caretStyle
KateRenderer::caretStyles caretStyle() const
The style of the caret (text cursor) to be painted.
Definition: katerenderer.h:87
KateRenderer::setDrawCaret
void setDrawCaret(bool drawCaret)
Set whether the caret (text cursor) will be drawn.
Definition: katerenderer.cpp:77
KateRenderer::isPrinterFriendly
bool isPrinterFriendly() const
Definition: katerenderer.cpp:139
KateRenderer::textPos
uint textPos(uint line, int xPos, uint startCol=0, bool nearest=true)
Definition: katerenderer.cpp:943
KateRenderer::setPrinterFriendly
void setPrinterFriendly(bool printerFriendly)
Configure this renderer to paint in a printer-friendly fashion.
Definition: katerenderer.cpp:144
KateRenderer::showIndentLines
bool showIndentLines() const
Definition: katerenderer.cpp:97
KateRenderer::paintTextLineBackground
bool paintTextLineBackground(TQPainter &paint, int line, bool isCurrentLine, int xStart, int xEnd)
Paint the background of a line.
Definition: katerenderer.cpp:152
KateRenderer::attribute
KateAttribute * attribute(uint pos)
This takes an in index, and returns all the attributes for it.
Definition: katerenderer.cpp:69
KateRenderer::showTabs
bool showTabs() const
Definition: katerenderer.h:100
KateRenderer::drawCaret
bool drawCaret() const
Determine whether the caret (text cursor) will be drawn.
Definition: katerenderer.h:75
KateRenderer::showSelections
bool showSelections() const
Show the view's selection?
Definition: katerenderer.h:136
KateRenderer::paintTextLine
void paintTextLine(TQPainter &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.
Definition: katerenderer.cpp:253
KateRenderer::setTabWidth
void setTabWidth(int tabWidth)
Sets the width of the tab.
Definition: katerenderer.cpp:92
KateRenderer::caretStyles
caretStyles
Style of Caret (Insert or Replace mode)
Definition: katerenderer.h:48
KateRenderer::KateRenderer
KateRenderer(KateDocument *doc, KateView *view=0)
Constructor.
Definition: katerenderer.cpp:37
KateRenderer::increaseFontSizes
void increaseFontSizes()
Change to a different font (soon to be font set?)
Definition: katerenderer.cpp:121
KateRenderer::setCaretStyle
void setCaretStyle(KateRenderer::caretStyles style)
Set the style of caret to be painted.
Definition: katerenderer.cpp:82
KateRenderer::setShowIndentLines
void setShowIndentLines(bool showLines)
Set whether a guide should be painted to help identifying indent lines.
Definition: katerenderer.cpp:102
KateRenderer::updateAttributes
void updateAttributes()
update the highlighting attributes (for example after an hl change or after hl config changed)
Definition: katerenderer.cpp:63
KateRenderer::~KateRenderer
~KateRenderer()
Destructor.
Definition: katerenderer.cpp:57
KateRenderer::spaceWidth
uint spaceWidth()
Text width & height calculation functions...
Definition: katerenderer.cpp:1039
KateTextCursor
Simple cursor class with no document pointer.
Definition: katecursor.h:34
TDESharedPtr

kate

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

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.9.4
This website is maintained by Timothy Pearson.