edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
textcaretcache.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QHash>
9
10
11namespace edbee {
12
13
14class TextDocument;
15class TextRenderer;
16class TextRangeSet;
17
20public:
21 TextCaretCache( TextDocument* doc, TextRenderer* renderer );
22
23 void clear();
24 void fill( TextRangeSet& selection );
25 void replaceAll( TextCaretCache& cache );
26
27 int xpos( int offset );
28 void add( int offset, int xpos );
29 void add( int offset );
30
31 void caretMovedFromOldOffsetToNewOffset( int oldOffset, int newOffset );
32
33 bool isFilled();
34
35
36 void dump();
37
38private:
39
40 TextDocument* textDocumentRef_;
41 TextRenderer* textRendererRef_;
42// QVector<int> xPosCache_; ///< The xpos cache for the carets
43 QHash<int,int> xPosCache_;
44};
45
46} // edbee
int xpos(int offset)
Definition textcaretcache.cpp:54
void caretMovedFromOldOffsetToNewOffset(int oldOffset, int newOffset)
This method should be called if the caret moves.
Definition textcaretcache.cpp:86
TextCaretCache(TextDocument *doc, TextRenderer *renderer)
The text document cache.
Definition textcaretcache.cpp:18
void replaceAll(TextCaretCache &cache)
This method replaces all cached content with the one given.
Definition textcaretcache.cpp:46
void fill(TextRangeSet &selection)
Definition textcaretcache.cpp:31
void dump()
Definition textcaretcache.cpp:103
void clear()
Definition textcaretcache.cpp:25
bool isFilled()
This method checks if the cache is filled.
Definition textcaretcache.cpp:98
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition textdocument.h:42
The basic textrange class. A simple class of textrange with a simple vector implementation.
Definition textrange.h:202
A class for rendering the text.
Definition textrenderer.h:35
#define EDBEE_EXPORT
Definition exports.h:15
#define add(key, value)
Definition factorykeymap.cpp:13
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20