00001 /* 00002 * HT Editor 00003 * terminal.h 00004 * 00005 * Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de) 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License version 2 as 00009 * published by the Free Software Foundation. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __TERMINAL_H__ 00022 #define __TERMINAL_H__ 00023 00024 #include "textedit.h" 00025 00026 /* 00027 * CLASS Terminal 00028 */ 00029 00030 class Terminal: public ht_ltextfile { 00031 private: 00032 ht_streamfile *in, *out, *err; 00033 int sys_ipc_handle; 00034 // FIXME: we need line buffering using String2 00035 00036 bool append(ht_streamfile *file); 00037 00038 public: 00039 void init(ht_streamfile *in, ht_streamfile *out, ht_streamfile *err, int sys_ipc_handle); 00040 virtual void done(); 00041 /* oerwritten */ 00042 virtual UINT write(const void *buf, UINT size); 00043 /* new */ 00044 bool connected(); 00045 bool update(); 00046 }; 00047 00048 /* 00049 * CLASS TerminalViewer 00050 */ 00051 00052 class TerminalViewer: public ht_text_viewer { 00053 private: 00054 Terminal *term; 00055 00056 void do_update(); 00057 void get_pindicator_str(char *buf); 00058 public: 00059 void init(bounds *b, Terminal *term, bool own_term); 00060 virtual void done(); 00061 /* overwritten */ 00062 virtual void handlemsg(htmsg *msg); 00063 virtual bool idle(); 00064 }; 00065 00066 #endif /* __TERMINAL_H__ */ 00067