-
Notifications
You must be signed in to change notification settings - Fork 0
/
QSciter.h
74 lines (58 loc) · 1.8 KB
/
QSciter.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
#pragma once
#include <QWidget>
#include <QUrl>
#include <QTimer>
/* Forward declarations */
struct SCITER_CALLBACK_NOTIFICATION;
typedef SCITER_CALLBACK_NOTIFICATION* LPSCITER_CALLBACK_NOTIFICATION;
struct SCN_SET_CURSOR;
typedef SCN_SET_CURSOR* LPSCN_SET_CURSOR;
/**
* Sciter widget
*/
class QSciter : public QWidget
{
Q_OBJECT;
/** Heartbeat timer */
QTimer eventTimer;
protected:
/** Handle of the sciter instance */
void* sciterHandle = nullptr;
public:
/** Constructor and destructor */
QSciter(QWidget * parent = nullptr);
~QSciter();
/** Loads the URL into the sciter window */
void load(const QUrl & url);
/** Public notification handler: call if callback gets replaced */
unsigned int handleNotification(LPSCITER_CALLBACK_NOTIFICATION pnm);
/** returns the sciter handle */
inline void * handle()
{
return sciterHandle;
}
private:
/** Creates sciter window */
void createSciterWindow();
/** Translate qt key to sciter code */
unsigned int translateKey(int vk, quint32 nativeKeycode);
/** Sets the cursor */
void setSciterCursor(LPSCN_SET_CURSOR cursor);
private slots:
/** Heartbeat */
void onTimerEvent();
protected:
void resizeEvent(QResizeEvent * resevent) override;
void paintEvent(QPaintEvent * resevent) override;
void mousePressEvent(QMouseEvent * event) override;
void mouseReleaseEvent(QMouseEvent * event) override;
void mouseDoubleClickEvent(QMouseEvent * event) override;
void mouseMoveEvent(QMouseEvent * event) override;
void wheelEvent(QWheelEvent * event) override;
void keyPressEvent(QKeyEvent * event) override;
void keyReleaseEvent(QKeyEvent * event) override;
void focusInEvent(QFocusEvent * event) override;
void focusOutEvent(QFocusEvent * event) override;
void enterEvent(QEnterEvent * event) override;
void leaveEvent(QEvent * event) override;
};