00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
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
00133 uint textWidth(
KateTextCursor &cursor,
int xPos, uint startCol = 0);
00134
00135
00136 uint textPos(uint line,
int xPos, uint startCol = 0);
00137 uint textPos(
const TextLine::Ptr &,
int xPos, uint startCol = 0);
00138
00139
00140 uint fontHeight();
00141
00142
00143 uint documentHeight();
00144
00145
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
00164
int m_tabWidth;
00165 uint m_schema;
00166
00167
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