summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/emulation_layer.h
authoribotty <ibotty>2002-10-05 21:19:16 (UTC)
committer ibotty <ibotty>2002-10-05 21:19:16 (UTC)
commit6e217b24b1eb09d922e35dc5126fa5ec578915b8 (patch) (side-by-side diff)
tree478d1018936e5846ed916263c27d856f886290b8 /noncore/apps/opie-console/emulation_layer.h
parent76feb33042f707be87763308eb76dd8c9fd1bd62 (diff)
downloadopie-6e217b24b1eb09d922e35dc5126fa5ec578915b8.zip
opie-6e217b24b1eb09d922e35dc5126fa5ec578915b8.tar.gz
opie-6e217b24b1eb09d922e35dc5126fa5ec578915b8.tar.bz2
initial commit
to get something started (and increase my stats ;)
Diffstat (limited to 'noncore/apps/opie-console/emulation_layer.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/emulation_layer.h146
1 files changed, 146 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/emulation_layer.h b/noncore/apps/opie-console/emulation_layer.h
new file mode 100644
index 0000000..0f54331
--- a/dev/null
+++ b/noncore/apps/opie-console/emulation_layer.h
@@ -0,0 +1,146 @@
+/* -------------------------------------------------------------------------- */
+/* */
+/* [emulation.h] Fundamental Terminal Emulation */
+/* */
+/* -------------------------------------------------------------------------- */
+/* */
+/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
+/* */
+/* This file is part of Konsole - an X terminal for KDE */
+/* */
+/* -------------------------------------------------------------------------- */
+/* */
+/* Ported Konsole to Qt/Embedded */
+/* */
+/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
+/* */
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+/* */
+/* made to a layer between io_layer and widget */
+/* */
+/* Copyright (C) 2002 by opie developers <opie@handhelds.org> */
+/* */
+/* -------------------------------------------------------------------------- */
+
+#ifndef EMULATION_LAYER_H
+#define EMULATION_LAYER_H
+
+#include "widget.h"
+#include "screen.h"
+#include <qtimer.h>
+#include <stdio.h>
+#include <qtextcodec.h>
+#include "keytrans.h"
+
+class EmulationLayer : public QObject
+{ Q_OBJECT
+
+public:
+
+ EmulationLayer(Widget* gui);
+ ~EmulationLayer();
+
+public:
+ virtual void setHistory(bool on);
+ virtual bool history();
+
+public slots: // signals incoming from Widget
+
+ virtual void onImageSizeChange(int lines, int columns);
+ virtual void onHistoryCursorChange(int cursor);
+ virtual void onKeyPress(QKeyEvent*);
+
+ virtual void clearSelection();
+ virtual void onSelectionBegin(const int x, const int y);
+ virtual void onSelectionExtend(const int x, const int y);
+ virtual void setSelection(const BOOL preserve_line_breaks);
+
+public slots: // signals incoming from data source
+
+ /**
+ * to be called, when new data arrives
+ */
+ void onRcvBlock(const QByteArray&);
+
+signals:
+
+ /**
+ * will send data, encoded to suit emulation
+ */
+ void sndBlock(const QByteArray&);
+
+ void ImageSizeChanged(int lines, int columns);
+
+ void changeColumns(int columns);
+
+ void changeTitle(int arg, const char* str);
+
+
+public:
+
+ /**
+ * process single char (decode)
+ */
+ virtual void onRcvChar(int);
+
+ virtual void setMode (int) = 0;
+ virtual void resetMode(int) = 0;
+
+ /**
+ * @deprecated use qbytearray instead
+ */
+ virtual void sendString(const char*) = 0;
+
+ /**
+ * sends a string to IOLayer
+ * encodes to suit emulation before
+ */
+ virtual void sendString(const QByteArray&) = 0;
+
+ virtual void setConnect(bool r);
+ void setColumns(int columns);
+
+ void setKeytrans(int no);
+ void setKeytrans(const char * no);
+
+protected:
+
+ Widget* gui;
+ Screen* scr; // referes to one `screen'
+ Screen* screen[2]; // 0 = primary, 1 = alternate
+ void setScreen(int n); // set `scr' to `screen[n]'
+
+ bool connected; // communicate with widget
+
+ void setCodec(int c); // codec number, 0 = locale, 1=utf8
+
+ QTextCodec* codec;
+ QTextCodec* localeCodec;
+ QTextDecoder* decoder;
+
+ KeyTrans* keytrans;
+
+// refreshing related material.
+// this is localized in the class.
+private slots: // triggered by timer
+
+ void showBulk();
+
+private:
+
+ void bulkNewline();
+ void bulkStart();
+ void bulkEnd();
+
+private:
+
+ QTimer bulk_timer;
+ int bulk_nlcnt; // bulk newline counter
+ char* SelectedText;
+ int bulk_incnt; // bulk counter
+
+
+};
+
+#endif // ifndef EMULATION_H