/* 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. */ #ifndef __textedit_h #define __textedit_h #pragma interface #include "textbrowse.h" #include #include struct TextEdit: EditorBase, TextBrowse { TextEdit(StringList *model = 0); ~TextEdit(); void key(int); void cmd(int); void addch(char); void insch(char); void delch(); void insertln(int); void deleteln(int); void clrtoeol(); void replaceText(const string &txt); void replaceText(const string &txt,int start,int end); //void restoreLine(); // undo changes to current line virtual void reform(bool = false); static string pasteBuffer; private: void repaintToEOL(int row,int col); void repaintToEOL(); struct TextList: TextArray { StringList &txt; const char *operator[](int i) { if (i < 0 || i >= txt.size()) return 0; return txt[i].c_str(); } int size() { return txt.size(); } TextList(StringList &r): txt(r) { } }; TextList view; TextEdit(const TextEdit &); TextEdit&operator=(const TextEdit &); protected: StringList &txt; int wrapmargin; }; #endif