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