wvdbusserver: implement NameHasOwner request.
[wvstreams.git] / include / wvqthook.h
blobc0c2bf481c18106e2187f2d8bbbf55d5d0066c7d
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * A Qt object that invokes its callback whenever it receives
6 * an event. This is useful for deferring processing to the
7 * Qt event loop. Use it to avoid problems resulting from the
8 * non-reentrant nature of WvStream::execute().
9 */
10 #ifndef __WVQTHOOK_H
11 #define __WVQTHOOK_H
13 #include <qobject.h>
14 #include <qevent.h>
15 #include "wvtr1.h"
17 class WvQtHook;
18 // parameters are: WvQtHook &, int type, void *data
19 typedef wv::function<void(WvQtHook&, int, void*)> WvQtHookCallback;
21 class WvQtHook : public QObject
23 Q_OBJECT
24 WvQtHookCallback callback;
26 public:
27 WvQtHook(WvQtHookCallback _callback = NULL);
29 // sets the callback function to be invoked
30 void setcallback(WvQtHookCallback _callback);
32 // posts an event to the Qt event loop to be sent to the
33 // attached callback later
34 void post(int type = 0, void *data = NULL);
36 // sends an event to the attached callback now
37 void send(int type = 0, void *data = NULL);
39 // internal
40 virtual bool event(QEvent *event);
43 #endif // __WVQTHOOK_H