00001 /* -------------------------------------------------------------------------- */ 00002 /* */ 00003 /* [emulation.h] Fundamental Terminal Emulation */ 00004 /* */ 00005 /* -------------------------------------------------------------------------- */ 00006 /* */ 00007 /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 00008 /* */ 00009 /* This file is part of Konsole - an X terminal for KDE */ 00010 /* */ 00011 /* -------------------------------------------------------------------------- */ 00012 /* */ 00013 /* Ported Konsole to Qt/Embedded */ 00014 /* */ 00015 /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 00016 /* */ 00017 /* -------------------------------------------------------------------------- */ 00018 /* -------------------------------------------------------------------------- */ 00019 /* */ 00020 /* made to a layer between io_layer and widget */ 00021 /* */ 00022 /* Copyright (C) 2002 by opie developers <opie@handhelds.org> */ 00023 /* */ 00024 /* -------------------------------------------------------------------------- */ 00025 00026 #ifndef EMULATION_LAYER_H 00027 #define EMULATION_LAYER_H 00028 00029 #include "widget_layer.h" 00030 #include "screen.h" 00031 #include <qtimer.h> 00032 #include <stdio.h> 00033 #include <qtextcodec.h> 00034 #include "keytrans.h" 00035 00036 class EmulationLayer : public QObject 00037 { Q_OBJECT 00038 00039 public: 00040 00041 EmulationLayer( WidgetLayer* gui ); 00042 ~EmulationLayer(); 00043 00044 public: 00045 virtual void setHistory(bool on); 00046 virtual bool history(); 00047 00048 public slots: // signals incoming from Widget 00049 00050 virtual void onImageSizeChange(int lines, int columns); 00051 virtual void onHistoryCursorChange(int cursor); 00052 virtual void onKeyPress(QKeyEvent*); 00053 00054 virtual void clearSelection(); 00055 virtual void onSelectionBegin(const int x, const int y); 00056 virtual void onSelectionExtend(const int x, const int y); 00057 virtual void setSelection(const bool preserve_line_breaks); 00058 00059 public slots: // signals incoming from data source 00060 00064 void onRcvBlock(const QByteArray&); 00065 00066 signals: 00067 00071 void sndBlock(const QByteArray&); 00072 00073 void ImageSizeChanged(int lines, int columns); 00074 00075 void changeColumns(int columns); 00076 00077 void changeTitle(int arg, const char* str); 00078 00079 00080 public: 00081 00085 virtual void onRcvChar(int); 00086 00087 virtual void setMode (int) = 0; 00088 virtual void resetMode(int) = 0; 00089 00093 virtual void sendString(const char*) = 0; 00094 00099 virtual void sendString(const QByteArray&) = 0; 00100 00101 virtual void setConnect(bool r); 00102 void setColumns(int columns); 00103 00104 void setKeytrans(int no); 00105 void setKeytrans(const char * no); 00106 00107 protected: 00108 00109 WidgetLayer* gui; 00110 Screen* scr; // referes to one `screen' 00111 Screen* screen[2]; // 0 = primary, 1 = alternate 00112 void setScreen(int n); // set `scr' to `screen[n]' 00113 00114 bool connected; // communicate with widget 00115 00116 void setCodec(int c); // codec number, 0 = locale, 1=utf8 00117 00118 QTextCodec* codec; 00119 QTextCodec* localeCodec; 00120 QTextDecoder* decoder; 00121 00122 KeyTrans* keytrans; 00123 00124 // refreshing related material. 00125 // this is localized in the class. 00126 private slots: // triggered by timer 00127 00128 void showBulk(); 00129 00130 private: 00131 00132 void bulkNewline(); 00133 void bulkStart(); 00134 void bulkEnd(); 00135 00136 private: 00137 00138 QTimer bulk_timer; 00139 int bulk_nlcnt; // bulk newline counter 00140 char* SelectedText; 00141 int bulk_incnt; // bulk counter 00142 00143 }; 00144 00145 #endif // ifndef EMULATION_H
1.4.2