xref: /haiku/src/apps/haikudepot/textview/TextSelection.h (revision d7f7bf2d890f652e20b8cf34e9b4c6ae1d3e20eb)
1*d7f7bf2dSAxel Dörfler /*
2*d7f7bf2dSAxel Dörfler  * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
3*d7f7bf2dSAxel Dörfler  * All rights reserved. Distributed under the terms of the MIT License.
4*d7f7bf2dSAxel Dörfler  */
5*d7f7bf2dSAxel Dörfler #ifndef TEXT_SELECTION_H
6*d7f7bf2dSAxel Dörfler #define TEXT_SELECTION_H
7*d7f7bf2dSAxel Dörfler 
8*d7f7bf2dSAxel Dörfler 
9*d7f7bf2dSAxel Dörfler #include <SupportDefs.h>
10*d7f7bf2dSAxel Dörfler 
11*d7f7bf2dSAxel Dörfler 
12*d7f7bf2dSAxel Dörfler class TextSelection {
13*d7f7bf2dSAxel Dörfler public:
14*d7f7bf2dSAxel Dörfler 								TextSelection();
15*d7f7bf2dSAxel Dörfler 								TextSelection(int32 anchor, int32 caret);
16*d7f7bf2dSAxel Dörfler 								TextSelection(const TextSelection& other);
17*d7f7bf2dSAxel Dörfler 
18*d7f7bf2dSAxel Dörfler 			TextSelection&		operator=(const TextSelection& other);
19*d7f7bf2dSAxel Dörfler 			bool				operator==(const TextSelection& other) const;
20*d7f7bf2dSAxel Dörfler 			bool				operator!=(const TextSelection& other) const;
21*d7f7bf2dSAxel Dörfler 
22*d7f7bf2dSAxel Dörfler 			void				SetAnchor(int32 anchor);
Anchor()23*d7f7bf2dSAxel Dörfler 	inline	int32				Anchor() const
24*d7f7bf2dSAxel Dörfler 									{ return fAnchor; }
25*d7f7bf2dSAxel Dörfler 
26*d7f7bf2dSAxel Dörfler 			void				SetCaret(int32 caret);
Caret()27*d7f7bf2dSAxel Dörfler 	inline	int32				Caret() const
28*d7f7bf2dSAxel Dörfler 									{ return fCaret; }
29*d7f7bf2dSAxel Dörfler 
30*d7f7bf2dSAxel Dörfler private:
31*d7f7bf2dSAxel Dörfler 			int32				fAnchor;
32*d7f7bf2dSAxel Dörfler 			int32				fCaret;
33*d7f7bf2dSAxel Dörfler };
34*d7f7bf2dSAxel Dörfler 
35*d7f7bf2dSAxel Dörfler 
36*d7f7bf2dSAxel Dörfler #endif // TEXT_SELECTION_H
37