# kate Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 getSelectionBounds(uint line, uint lineLength, uint &start, uint &end);
    00184
    00192     void paintTextLine(QPainter& paint, const KateLineRange* range, int xStart, int xEnd, const KateTextCursor* cursor = 0L, const KateTextRange* bracketmark = 0L);
    00193
    00203     bool paintTextLineBackground(QPainter& paint, int line, bool isCurrentLine, int xStart, int xEnd);
    00204
    00212     KateAttribute* attribute(uint pos);
    00213
    00214   private:
    00220     void paintWhitespaceMarker(QPainter &paint, uint x, uint y);
    00221
    00222     KateDocument* m_doc;
    00223     KateView *m_view;
    00224
    00225     // cache of config values
    00226     int m_tabWidth;
    00227     uint m_schema;
    00228
    00229     // some internal flags
    00230     KateRenderer::caretStyles m_caretStyle;
    00231     bool m_drawCaret;
    00232     bool m_showSelections;
    00233     bool m_showTabs;
    00234     bool m_printerFriendly;
    00235
    00236     QMemArray<KateAttribute> *m_attributes;
    00237
    00241   public:
    00242     inline KateRendererConfig *config () { return m_config; };
    00243
    00244     void updateConfig ();
    00245
    00246   private:
    00247     KateRendererConfig *m_config;
    00248 };
    00249
    00250 #endif

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:36 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003