]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/include/WindowAccessor.h
extracted 4 copies of identical code into a function
[wxWidgets.git] / src / stc / scintilla / include / WindowAccessor.h
1 // WindowAccessor.h - implementation of BufferAccess and StylingAccess on a Scintilla rapid easy access to contents of a Scintilla
2 // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
3 // The License.txt file describes the conditions under which this software may be distributed.
4
5 class WindowAccessor : public Accessor {
6 // Private so WindowAccessor objects can not be copied
7 WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
8 WindowAccessor &operator=(const WindowAccessor &) { return *this; }
9 protected:
10 WindowID id;
11 PropSet &props;
12 int lenDoc;
13
14 char styleBuf[bufferSize];
15 int validLen;
16 char chFlags;
17 char chWhile;
18 unsigned int startSeg;
19
20 bool InternalIsLeadByte(char ch);
21 void Fill(int position);
22 public:
23 WindowAccessor(WindowID id_, PropSet &props_) :
24 Accessor(), id(id_), props(props_),
25 lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
26 }
27 ~WindowAccessor();
28 char StyleAt(int position);
29 int GetLine(int position);
30 int LineStart(int line);
31 int LevelAt(int line);
32 int Length();
33 void Flush();
34 int GetLineState(int line);
35 int SetLineState(int line, int state);
36 int GetPropertyInt(const char *key, int defaultValue=0) {
37 return props.GetInt(key, defaultValue);
38 }
39
40 void StartAt(unsigned int start, char chMask=31);
41 void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
42 unsigned int GetStartSegment() { return startSeg; }
43 void StartSegment(unsigned int pos);
44 void ColourTo(unsigned int pos, int chAttr);
45 void SetLevel(int line, int level);
46 int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
47 };