TQt conversion of scintilla for Qt3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WindowAccessor.h 1.8KB

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