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 12class TextSelection { 13public: 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); 23 inline int32 Anchor() const 24 { return fAnchor; } 25 26 void SetCaret(int32 caret); 27 inline int32 Caret() const 28 { return fCaret; } 29 30private: 31 int32 fAnchor; 32 int32 fCaret; 33}; 34 35 36#endif // TEXT_SELECTION_H 37