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 KATERENDERER_H 00023 #define KATERENDERER_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 LineRange; 00035 class KateRendererConfig; 00036 00041 class KateRenderer 00042 { 00043 public: 00044 enum caretStyles { 00045 Insert, 00046 Replace 00047 }; 00048 00049 KateRenderer(KateDocument* doc, KateView *view = 0); 00050 ~KateRenderer(); 00051 00052 void updateAttributes (); 00053 00057 bool drawCaret() const; 00058 00062 void setDrawCaret(bool drawCaret); 00063 00067 bool caretStyle() const; 00068 00072 void setCaretStyle(int style); 00073 00078 bool showTabs() const; 00079 00083 void setShowTabs(bool showTabs); 00084 00088 void setTabWidth(int tabWidth); 00089 00093 bool showSelections() const; 00094 00099 void setShowSelections(bool showSelections); 00100 00104 void increaseFontSizes(); 00105 void decreaseFontSizes(); 00106 const QFont* currentFont(); 00107 const QFontMetrics* currentFontMetrics(); 00108 00113 bool isPrinterFriendly() const; 00114 00120 void setPrinterFriendly(bool printerFriendly); 00121 00126 // Width calculators 00127 uint spaceWidth(); 00128 uint textWidth(const TextLine::Ptr &, int cursorCol); 00129 uint textWidth(const TextLine::Ptr &textLine, uint startcol, uint maxwidth, bool *needWrap, int *endX = 0); 00130 uint textWidth(const KateTextCursor &cursor); 00131 00132 // Cursor constrainer 00133 uint textWidth(KateTextCursor &cursor, int xPos, uint startCol = 0); 00134 00135 // Column calculators 00136 uint textPos(uint line, int xPos, uint startCol = 0); 00137 uint textPos(const TextLine::Ptr &, int xPos, uint startCol = 0); 00138 00139 // Font height 00140 uint fontHeight(); 00141 00142 // Document height 00143 uint documentHeight(); 00144 00145 // Selection boundaries 00146 bool selectBounds(uint line, uint &start, uint &end, uint lineLength); 00147 00155 void paintTextLine(QPainter& paint, const LineRange* range, int xStart, int xEnd, const KateTextCursor* cursor = 0L, const KateTextRange* bracketmark = 0L); 00156 00157 KateAttribute* attribute(uint pos); 00158 00159 private: 00160 KateDocument* m_doc; 00161 KateView *m_view; 00162 00163 // cache of config values 00164 int m_tabWidth; 00165 uint m_schema; 00166 00167 // some internal flags 00168 int m_caretStyle; 00169 bool m_drawCaret; 00170 bool m_showSelections; 00171 bool m_showTabs; 00172 bool m_printerFriendly; 00173 00174 QMemArray<KateAttribute> *m_attributes; 00175 00179 public: 00180 inline KateRendererConfig *config () { return m_config; }; 00181 00182 void updateConfig (); 00183 00184 private: 00185 KateRendererConfig *m_config; 00186 }; 00187 00188 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 12 15:10:11 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003