katerenderer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
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
00159 uint textWidth(KateTextCursor &cursor, int xPos, uint startCol = 0);
00160
00161
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
00177 uint fontHeight();
00178
00179
00180 uint documentHeight();
00181
00182
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
00226 int m_tabWidth;
00227 uint m_schema;
00228
00229
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.0.