summaryrefslogtreecommitdiffstats
path: root/src/widgeteventhandler.h
blob: 058373672e42131e00b6b963bf8231bce394dfdb (plain)
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
#ifndef WIDGETHANDLER_H
#define WIDGETHANDLER_H

#include <QtGui>
#include <eventqueue.h>

class WidgetEventHandler : public QObject
{
Q_OBJECT
public:
    WidgetEventHandler(QObject *parent = 0);
    void setRootWidget(QWidget *root);
    bool shouldProcessChildWidgets(QWidget *widget);
    void recursivelyInstallEventHandler(QWidget *widget);
    void setSession(Session *session);
    Session *session();
    void handleRequest(HttpRequest *request, HttpResponse *response);
    void recursivelyAddShow(QWidget *root);
    void recursivelyAddUpdate(QWidget *root);
protected slots:
    void updatePendingWidgets();
    void textChange();

protected:
    bool handleJsonMessage(const QByteArray &message);
    void handleMousePress(const QByteArray &message);
    void handleKeyPress(const QByteArray &message);
    void handleTextUpdate(json_object* object);
    void handlePositionUpdate(json_object *object);
    void addPendingUpdate(QWidget* widget, const QRect &rect);
    bool eventFilter(QObject *object, QEvent *event);
    void widgetPaint(QWidget *widget, const QRect &updateRect);
    QRect globalGeometry(QWidget *widget);
    
    void recursivelyAddHide(QWidget *root);
    void addShowEvent(QWidget *widget);
public: //private:
    EventQueue events;
    QHash<QWidget *, QRect> pendingUpdates;
    bool graphicsWidget;
    bool grabbing;
    QWidget *rootWidget;
    QWidget *focusWidget; // hack hack
    QSet<QObject*> disableUpdates;
};

#endif