btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / terminal / TermViewHighlight.h
blob1e9e5736bd090ee01ec07582b71bb61eaacfbd85
1 /*
2 * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef TERMVIEW_HIGHLIGHT_H
6 #define TERMVIEW_HIGHLIGHT_H
9 #include <GraphicsDefs.h>
11 #include "TermPos.h"
14 class TermViewHighlighter {
15 public:
16 virtual ~TermViewHighlighter();
18 virtual rgb_color ForegroundColor() = 0;
19 virtual rgb_color BackgroundColor() = 0;
20 virtual uint32 AdjustTextAttributes(uint32 attributes);
24 class TermViewHighlight {
25 public:
26 TermViewHighlight()
28 fHighlighter(NULL),
29 fStart(-1, -1),
30 fEnd(-1, -1)
34 TermViewHighlighter* Highlighter() const
36 return fHighlighter;
39 void SetHighlighter(TermViewHighlighter* highligher)
41 fHighlighter = highligher;
44 const TermPos& Start() const
46 return fStart;
49 const TermPos& End() const
51 return fEnd;
54 bool IsEmpty() const
56 return fStart == fEnd;
59 bool RangeContains(const TermPos& pos) const
61 return pos >= fStart && pos < fEnd;
64 void SetRange(const TermPos& start, const TermPos& end)
66 fStart = start;
67 fEnd = end;
70 void ScrollRange(int32 byLines)
72 fStart.y -= byLines;
73 fEnd.y -= byLines;
76 private:
77 TermViewHighlighter* fHighlighter;
78 TermPos fStart;
79 TermPos fEnd;
83 #endif // TERMVIEW_HIGHLIGHT_H