-
Notifications
You must be signed in to change notification settings - Fork 2
/
qt.h
78 lines (64 loc) · 1.65 KB
/
qt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef QEMACS_QT_H
#define QEMACS_QT_H
#include <QMainWindow>
#include <QAbstractScrollArea>
#include <QApplication>
#include <QThread>
#include <QPicture>
#include <pthread.h>
class QEQtContext;
class QEQtView : public QWidget
{
Q_OBJECT
public:
QEQtView(QEQtContext *ctx, QWidget *parent = 0);
~QEQtView();
protected:
virtual void keyPressEvent(QKeyEvent *);
virtual void paintEvent(QPaintEvent *);
virtual void closeEvent (QCloseEvent *);
virtual void resizeEvent(QResizeEvent *);
virtual void mousePressEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void mouseMoveEvent(QMouseEvent *);
virtual void wheelEvent(QWheelEvent *);
void mouseEvent(QMouseEvent *);
public slots:
void slotDrawText(const QFont &, int, int, const QString &, const QColor &, bool);
void slotFillRectangle(int, int, int, int, const QColor &, bool);
void slotResizeDoubleBuffer(const QSize &);
void slotFlush();
void slotSetClip(int, int, int, int);
void slotSetCursor(int, int, int, int);
private:
QEQtContext *_ctx;
// when we draw in the double buffer, we increase this
int _repaints;
QRect _clip;
QRect _cursor;
};
class QEQtApplication : public QApplication
{
Q_OBJECT
public:
QEQtApplication();
private:
};
// opaque pointer where Qt keeps its application and
// views
class QEQtContext
{
public:
QEQtContext();
QEQtApplication *app;
QEQtView *view;
QFont font;
QMainWindow *window;
// qemacs hooks end painting here
// and we replay on paintEvent
QImage image;
int events_rd;
int events_wr;
void flush();
};
#endif