qwsdisplay_qws.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QWSDISPLAY_QWS_H
00043 #define QWSDISPLAY_QWS_H
00044 
00045 #include <QtCore/qobject.h>
00046 #include <QtCore/qbytearray.h>
00047 #include <QtGui/qregion.h>
00048 #include <QtGui/qimage.h>
00049 #include <QtGui/qwindowdefs.h>
00050 #include <QtCore/qlist.h>
00051 
00052 QT_BEGIN_HEADER
00053 
00054 QT_BEGIN_NAMESPACE
00055 
00056 QT_MODULE(Gui)
00057 
00058 class QWSEvent;
00059 class QWSMouseEvent;
00060 class QWSQCopMessageEvent;
00061 class QVariant;
00062 class QLock;
00063 
00064 class QWSWindowInfo
00065 {
00066 
00067 public:
00068 
00069     int winid;
00070     unsigned int clientid;
00071     QString name;
00072 
00073 };
00074 
00075 #define QT_QWS_PROPERTY_CONVERTSELECTION 999
00076 #define QT_QWS_PROPERTY_WINDOWNAME 998
00077 #define QT_QWS_PROPERTY_MARKEDTEXT 997
00078 
00079 class QWSDisplay;
00080 extern Q_GUI_EXPORT QWSDisplay *qt_fbdpy;
00081 
00082 class Q_GUI_EXPORT QWSDisplay
00083 {
00084 public:
00085     QWSDisplay();
00086     ~QWSDisplay();
00087 
00088     static QWSDisplay* instance() { return qt_fbdpy; }
00089 
00090     bool eventPending() const;
00091     QWSEvent *getEvent();
00092 //    QWSRegionManager *regionManager() const;
00093 
00094     uchar* frameBuffer() const;
00095     int width() const;
00096     int height() const;
00097     int depth() const;
00098     int pixmapDepth() const;
00099     bool supportsDepth(int) const;
00100 
00101     uchar *sharedRam() const;
00102     int sharedRamSize() const;
00103 
00104 #ifndef QT_NO_QWS_PROPERTIES
00105     void addProperty(int winId, int property);
00106     void setProperty(int winId, int property, int mode, const QByteArray &data);
00107     void setProperty(int winId, int property, int mode, const char * data);
00108     void removeProperty(int winId, int property);
00109     bool getProperty(int winId, int property, char *&data, int &len);
00110 #endif // QT_NO_QWS_PROPERTIES
00111 
00112     QList<QWSWindowInfo> windowList();
00113     int windowAt(const QPoint &);
00114 
00115     void setIdentity(const QString &appName);
00116     void nameRegion(int winId, const QString& n, const QString &c);
00117     void requestRegion(int winId, const QString &surfacekey,
00118                        const QByteArray &surfaceData,
00119                        const QRegion &region);
00120     void repaintRegion(int winId, int windowFlags, bool opaque, QRegion);
00121     void moveRegion(int winId, int dx, int dy);
00122     void destroyRegion(int winId);
00123     void requestFocus(int winId, bool get);
00124     void setAltitude(int winId, int altitude, bool fixed = false);
00125     void setOpacity(int winId, int opacity);
00126     int takeId();
00127     void setSelectionOwner(int winId, const QTime &time);
00128     void convertSelection(int winId, int selectionProperty, const QString &mimeTypes);
00129     void defineCursor(int id, const QBitmap &curs, const QBitmap &mask,
00130                         int hotX, int hotY);
00131     void destroyCursor(int id);
00132     void selectCursor(QWidget *w, unsigned int id);
00133     void setCursorPosition(int x, int y);
00134     void grabMouse(QWidget *w, bool grab);
00135     void grabKeyboard(QWidget *w, bool grab);
00136     void playSoundFile(const QString&);
00137     void registerChannel(const QString &channel);
00138     void sendMessage(const QString &channel, const QString &msg,
00139                        const QByteArray &data);
00140     void flushCommands();
00141 #ifndef QT_NO_QWS_INPUTMETHODS
00142     void sendIMUpdate(int type, int winId, int widgetid);
00143     void resetIM();
00144     void sendIMResponse(int winId, int property, const QVariant &result);
00145     void sendIMMouseEvent(int index, bool isPress);
00146 #endif
00147     QWSQCopMessageEvent* waitForQCopResponse();
00148     void sendFontCommand(int type, const QByteArray &fontName);
00149 
00150     void setWindowCaption(QWidget *w, const QString &);
00151 
00152     // Lock display for access only by this process
00153     static bool initLock(const QString &filename, bool create = false);
00154     static bool grabbed();
00155     static void grab();
00156     static void grab(bool write);
00157     static void ungrab();
00158 
00159     static void setTransformation(int transformation, int screenNo = -1);
00160     static void setRawMouseEventFilter(void (*filter)(QWSMouseEvent *));
00161 
00162 private:
00163     friend int qt_fork_qapplication();
00164     friend void qt_app_reinit( const QString& newAppName );
00165     friend class QApplication;
00166     friend class QCopChannel;
00167     friend class QWSEmbedWidget;
00168     friend class QWSEmbedWidgetPrivate;
00169     class Data;
00170     friend class Data;
00171     Data *d;
00172 
00173     friend class QWSMemorySurface;
00174     friend class QWSOnScreenSurface;
00175     friend class QWSDirectPainterSurface;
00176     int getPropertyLen;
00177     char *getPropertyData;
00178     static QLock *lock;
00179 };
00180 
00181 QT_END_NAMESPACE
00182 
00183 QT_END_HEADER
00184 
00185 #endif // QWSDISPLAY_QWS_H