edbee - Qt Editor Library
textcaretcache.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <QHash>
9 
10 
11 namespace edbee {
12 
13 
14 class TextDocument;
15 class TextRenderer;
16 class TextRangeSet;
17 
20 {
21 public:
22  TextCaretCache( TextDocument* doc, TextRenderer* renderer );
23 
24  void clear();
25  void fill( TextRangeSet& selection );
26  void replaceAll( TextCaretCache& cache );
27 
28  int xpos( int offset );
29  void add( int offset, int xpos );
30  void add( int offset );
31 
32  void caretMovedFromOldOffsetToNewOffset( int oldOffset, int newOffset );
33 
34  bool isFilled();
35 
36 
37  void dump();
38 
39 private:
40 
41  TextDocument* textDocumentRef_;
42  TextRenderer* textRendererRef_;
43 // QVector<int> xPosCache_; ///< The xpos cache for the carets
44  QHash<int,int> xPosCache_;
45 };
46 
47 } // edbee
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition: textdocument.h:40
A class for rendering the text.
Definition: textrenderer.h:34
bool isFilled()
This method checks if the cache is filled.
Definition: textcaretcache.cpp:100
void add(int offset, int xpos)
Adds an xposition for the given offset.
Definition: textcaretcache.cpp:72
int xpos(int offset)
Definition: textcaretcache.cpp:56
void caretMovedFromOldOffsetToNewOffset(int oldOffset, int newOffset)
This method should be called if the caret moves from th.
Definition: textcaretcache.cpp:88
void fill(TextRangeSet &selection)
Definition: textcaretcache.cpp:33
TextCaretCache(TextDocument *doc, TextRenderer *renderer)
The text document cache.
Definition: textcaretcache.cpp:20
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
void clear()
Definition: textcaretcache.cpp:27
A special cache. For remembering the x-coordinates of the carets.
Definition: textcaretcache.h:19
void replaceAll(TextCaretCache &cache)
This method replaces all cached content with the one given.
Definition: textcaretcache.cpp:48
The basic textrange class. A simple class of textrange with a simple vector implementation.
Definition: textrange.h:198
void dump()
Definition: textcaretcache.cpp:105