]>
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 | ||
65ec6247 RD |
9 | /** |
10 | */ | |
f6bcfd97 BP |
11 | class WindowAccessor : public Accessor { |
12 | // Private so WindowAccessor objects can not be copied | |
13 | WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} | |
14 | WindowAccessor &operator=(const WindowAccessor &) { return *this; } | |
15 | protected: | |
16 | WindowID id; | |
17 | PropSet &props; | |
18 | int lenDoc; | |
19 | ||
20 | char styleBuf[bufferSize]; | |
21 | int validLen; | |
22 | char chFlags; | |
23 | char chWhile; | |
24 | unsigned int startSeg; | |
25 | ||
26 | bool InternalIsLeadByte(char ch); | |
27 | void Fill(int position); | |
28 | public: | |
29 | WindowAccessor(WindowID id_, PropSet &props_) : | |
30 | Accessor(), id(id_), props(props_), | |
d134f170 | 31 | lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { |
f6bcfd97 BP |
32 | } |
33 | ~WindowAccessor(); | |
34 | char StyleAt(int position); | |
35 | int GetLine(int position); | |
36 | int LineStart(int line); | |
37 | int LevelAt(int line); | |
38 | int Length(); | |
39 | void Flush(); | |
40 | int GetLineState(int line); | |
41 | int SetLineState(int line, int state); | |
42 | int GetPropertyInt(const char *key, int defaultValue=0) { | |
43 | return props.GetInt(key, defaultValue); | |
44 | } | |
65ec6247 RD |
45 | char *GetProperties() { |
46 | return props.ToString(); | |
47 | } | |
f6bcfd97 BP |
48 | |
49 | void StartAt(unsigned int start, char chMask=31); | |
50 | void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; | |
51 | unsigned int GetStartSegment() { return startSeg; } | |
52 | void StartSegment(unsigned int pos); | |
53 | void ColourTo(unsigned int pos, int chAttr); | |
54 | void SetLevel(int line, int level); | |
55 | int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); | |
56 | }; |