]>
Commit | Line | Data |
---|---|---|
65ec6247 RD |
1 | // Scintilla source code edit control |
2 | /** @file WindowAccessor.h | |
3 | ** Implementation of BufferAccess and StylingAccess on a Scintilla | |
4 | ** rapid easy access to contents of a Scintilla. | |
5 | **/ | |
6 | // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> | |
f6bcfd97 BP |
7 | // The License.txt file describes the conditions under which this software may be distributed. |
8 | ||
7e0c58e9 RD |
9 | #ifdef SCI_NAMESPACE |
10 | namespace Scintilla { | |
11 | #endif | |
12 | ||
65ec6247 RD |
13 | /** |
14 | */ | |
9e96e16f | 15 | |
f6bcfd97 BP |
16 | class WindowAccessor : public Accessor { |
17 | // Private so WindowAccessor objects can not be copied | |
18 | WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} | |
19 | WindowAccessor &operator=(const WindowAccessor &) { return *this; } | |
20 | protected: | |
21 | WindowID id; | |
9e96e16f | 22 | PropertyGet &props; |
f6bcfd97 BP |
23 | int lenDoc; |
24 | ||
25 | char styleBuf[bufferSize]; | |
26 | int validLen; | |
27 | char chFlags; | |
28 | char chWhile; | |
29 | unsigned int startSeg; | |
30 | ||
31 | bool InternalIsLeadByte(char ch); | |
32 | void Fill(int position); | |
33 | public: | |
9e96e16f | 34 | WindowAccessor(WindowID id_, PropertyGet &props_) : |
88a8b04e | 35 | Accessor(), id(id_), props(props_), |
d134f170 | 36 | lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { |
f6bcfd97 BP |
37 | } |
38 | ~WindowAccessor(); | |
a834585d | 39 | bool Match(int pos, const char *s); |
f6bcfd97 BP |
40 | char StyleAt(int position); |
41 | int GetLine(int position); | |
42 | int LineStart(int line); | |
43 | int LevelAt(int line); | |
44 | int Length(); | |
45 | void Flush(); | |
46 | int GetLineState(int line); | |
47 | int SetLineState(int line, int state); | |
88a8b04e RD |
48 | int GetPropertyInt(const char *key, int defaultValue=0) { |
49 | return props.GetInt(key, defaultValue); | |
f6bcfd97 | 50 | } |
65ec6247 RD |
51 | char *GetProperties() { |
52 | return props.ToString(); | |
53 | } | |
f6bcfd97 BP |
54 | |
55 | void StartAt(unsigned int start, char chMask=31); | |
7e0c58e9 | 56 | void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; |
f6bcfd97 BP |
57 | unsigned int GetStartSegment() { return startSeg; } |
58 | void StartSegment(unsigned int pos); | |
59 | void ColourTo(unsigned int pos, int chAttr); | |
60 | void SetLevel(int line, int level); | |
61 | int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); | |
7e0c58e9 | 62 | void IndicatorFill(int start, int end, int indicator, int value); |
f6bcfd97 | 63 | }; |
7e0c58e9 RD |
64 | |
65 | #ifdef SCI_NAMESPACE | |
66 | } | |
67 | #endif |