root/middleware-offline/trunk/_src/eidmw/eidgui/qtsingleapplication.h @ 271

Revision 271, 2.9 KB (checked in by vsilva, 6 years ago)

First official release

Line 
1/****************************************************************************
2**
3** Copyright (C) 2003-2007 Trolltech ASA. All rights reserved.
4**
5** This file is part of a Qt Solutions component.
6**
7** Licensees holding a valid Qt Solutions License Agreement may use this
8** file in accordance with the rights, responsibilities, and obligations
9** contained therein. Please consult your licensing agreement or contact
10** sales@trolltech.com if any conditions of this licensing are not clear
11** to you.
12**
13** Further information about Qt Solutions licensing is available at:
14** http://www.trolltech.com/products/qt/addon/solutions/
15** or by contacting info@trolltech.com.
16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19**
20****************************************************************************/
21#ifndef QTSINGLEAPPLICATION_H
22#define QTSINGLEAPPLICATION_H
23
24#include <QtGui/QApplication>
25#ifdef Q_WS_MAC
26#include <CoreFoundation/CoreFoundation.h>
27#endif
28
29class QtSingletonPrivate;
30class QtSingletonSysPrivate;
31class QWidget;
32
33#if defined(Q_WS_WIN)
34#  if !defined(QT_QTSINGLEAPPLICATION_EXPORT) && !defined(QT_QTSINGLEAPPLICATION_IMPORT)
35#    define QT_QTSINGLEAPPLICATION_EXPORT
36#  elif defined(QT_QTSINGLEAPPLICATION_IMPORT)
37#    if defined(QT_QTSINGLEAPPLICATION_EXPORT)
38#      undef QT_QTSINGLEAPPLICATION_EXPORT
39#    endif
40#    define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllimport)
41#  elif defined(QT_QTSINGLEAPPLICATION_EXPORT)
42#    undef QT_QTSINGLEAPPLICATION_EXPORT
43#    define QT_QTSINGLEAPPLICATION_EXPORT __declspec(dllexport)
44#  endif
45#else
46#  define QT_QTSINGLEAPPLICATION_EXPORT
47#endif
48
49class QT_QTSINGLEAPPLICATION_EXPORT QtSingleApplication : public QApplication
50{
51    Q_OBJECT
52public:
53    QtSingleApplication(const QString &id, int &argc, char **argv, Type = GuiClient);
54#ifdef Q_WS_X11
55    QtSingleApplication(Display* dpy, const QString &id, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
56#endif
57    ~QtSingleApplication();
58
59    bool isRunning() const;
60    QString id() const;
61
62    void initialize(bool activate = true);
63    void setActivationWindow(QWidget* aw);
64    QWidget* activationWindow() const;
65
66protected:
67#if defined(Q_WS_X11)
68    bool x11EventFilter(XEvent *msg);
69#endif
70
71public Q_SLOTS:
72    bool sendMessage(const QString &message, int timeout = 5000);
73    virtual void activateWindow();
74
75Q_SIGNALS:
76    void messageReceived(const QString& message);
77
78private:
79    friend class QtSingletonSysPrivate;
80#ifdef Q_WS_MAC
81    friend CFDataRef MyCallBack(CFMessagePortRef, SInt32, CFDataRef, void *);
82#endif
83    QtSingletonPrivate *d;
84    QtSingletonSysPrivate *sysd;
85    QWidget* actWin;
86
87    void sysInit();
88    void sysCleanup();
89};
90
91#endif //QTSINGLEAPPLICATION_H
Note: See TracBrowser for help on using the browser.