kate Library API Documentation

katerenderer.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2003 Hamish Rodda <rodda@kde.org> 00003 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00004 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00005 Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License version 2 as published by the Free Software Foundation. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef __KATE_RENDERER_H__ 00023 #define __KATE_RENDERER_H__ 00024 00025 #include "katecursor.h" 00026 #include "kateattribute.h" 00027 #include "katetextline.h" 00028 00029 #include <qfont.h> 00030 #include <qfontmetrics.h> 00031 00032 class KateDocument; 00033 class KateView; 00034 class KateLineRange; 00035 class KateRendererConfig; 00036 00042 class KateRenderer 00043 { 00044 public: 00048 enum caretStyles { 00049 Insert, 00050 Replace 00051 }; 00052 00058 KateRenderer(KateDocument* doc, KateView *view = 0); 00059 00063 ~KateRenderer(); 00064 00069 void updateAttributes (); 00070 00075 inline bool drawCaret() const { return m_drawCaret; } 00076 00081 void setDrawCaret(bool drawCaret); 00082 00087 inline KateRenderer::caretStyles caretStyle() const { return m_caretStyle; } 00088 00093 void setCaretStyle(KateRenderer::caretStyles style); 00094 00100 inline bool showTabs() const { return m_showTabs; } 00101 00106 void setShowTabs(bool showTabs); 00107 00112 void setTabWidth(int tabWidth); 00113 00118 inline bool showSelections() const { return m_showSelections; } 00119 00125 void setShowSelections(bool showSelections); 00126 00130 void increaseFontSizes(); 00131 void decreaseFontSizes(); 00132 const QFont* currentFont(); 00133 const QFontMetrics* currentFontMetrics(); 00134 00139 bool isPrinterFriendly() const; 00140 00146 void setPrinterFriendly(bool printerFriendly); 00147 00152 // Width calculators 00153 uint spaceWidth(); 00154 uint textWidth(const KateTextLine::Ptr &, int cursorCol); 00155 uint textWidth(const KateTextLine::Ptr &textLine, uint startcol, uint maxwidth, bool *needWrap, int *endX = 0); 00156 uint textWidth(const KateTextCursor &cursor); 00157 00158 // Cursor constrainer 00159 uint textWidth(KateTextCursor &cursor, int xPos, uint startCol = 0); 00160 00161 // Column calculators 00170 uint textPos(uint line, int xPos, uint startCol = 0, bool nearest=true); 00174 uint textPos(const KateTextLine::Ptr &, int xPos, uint startCol = 0, bool nearest=true); 00175 00176 // Font height 00177 uint fontHeight(); 00178 00179 // Document height 00180 uint documentHeight(); 00181 00182 // Selection boundaries 00183 bool selectBounds(uint line, uint &start, uint &end, uint lineLength); 00184 00192 void paintTextLine(QPainter& paint, const KateLineRange* range, int xStart, int xEnd, const KateTextCursor* cursor = 0L, const KateTextRange* bracketmark = 0L); 00193 00194 KateAttribute* attribute(uint pos); 00195 00196 private: 00197 KateDocument* m_doc; 00198 KateView *m_view; 00199 00200 // cache of config values 00201 int m_tabWidth; 00202 uint m_schema; 00203 00204 // some internal flags 00205 KateRenderer::caretStyles m_caretStyle; 00206 bool m_drawCaret; 00207 bool m_showSelections; 00208 bool m_showTabs; 00209 bool m_printerFriendly; 00210 00211 QMemArray<KateAttribute> *m_attributes; 00212 00216 public: 00217 inline KateRendererConfig *config () { return m_config; }; 00218 00219 void updateConfig (); 00220 00221 private: 00222 KateRendererConfig *m_config; 00223 }; 00224 00225 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:35:13 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003