/* 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 #include "component.h" #include "textedit.h" class LabelComponent: public Component { enum { LEFT, CENTER, RIGHT }; string txt; char alignment; public: LabelComponent(); void remoteMethod(int cmd); virtual void setText(const string &); const string &getText() const { return txt; } void setAlign(int a); void paint(DrawingContext *); void getfocus(); }; class Button: public LabelComponent { public: Button(); void key(int ky); void getfocus(); }; class CheckBox: public Button { bool checked; public: CheckBox(); void remoteMethod(int cmd); void setState(bool state); void getfocus(); void paint(DrawingContext *); }; class TextComponent: public TextEdit { TextComponent(const TextComponent &); void operator=(const TextComponent &); protected: int columns; // restrict input to column width if > 0 public: TextComponent(); void remoteMethod(int cmd); virtual const string getText() const = 0; virtual void setText(string) = 0; void setEditable(bool); void key(int); void getfocus(); ~TextComponent(); }; class TextField: public TextComponent { TextField(const TextField &); void operator=(const TextField &); public: TextField() { } void remoteMethod(int cmd); const string getText() const; void setText(string); void move(int r,int c); void reform(bool); void insch(char c); void key(int); #if 0 void paint(DrawingContext *); Dimension size() const; void setCursor(int x,int y); #endif }; class TextArea: public TextComponent { TextArea(const TextArea &); void operator=(const TextArea &); public: TextArea() { } const string getText() const; void append(const string &); void append(char c) { append(string(1,c)); } void setText(string); void insertText(const string &txt,int pos) { replaceText(txt,pos,pos); } void remoteMethod(int cmd); };