/* TUIpeer works in conjunction with an implementation of java.awt.Toolkit to provide a Text User Interface for programs using the Java AWT. Copyright (C) 1997-2000 Stuart D. Gathman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #pragma interface class TextSelection { int row; int col; int markrow; int markcol; bool isgap; static int cmpCursor(int r1, int c1, int r2, int c2) { return (r1 == r2) ? c1 - c2 : r1 - r2; } protected: class TextArray &txt; public: TextSelection(class TextArray &); class string getSelectedText() const; int getRow() const { return row; } int getCol() const { return col; } int getStartRow() const; int getEndRow() const; int getStartCol() const; int getEndCol() const; long getPos(int row,int col) const; long getStart() const; long getEnd() const; void setCursor(int row,int col); void setPos(long pos); void select(long start, long end); void mark(); // set mark = cursor virtual void selectionChanged(int orow,int ocol,int nrow,int ncol) = 0; bool isReversed() const; /* If rowSelected() returns false, isSelected() will always return false. If rowSelected() returns true, isSelected() may return true or false. */ bool rowSelected(int row) const; bool isSelected(int row,int col) const; bool isGap() const; };