Qt 4.8
qxlibwindow.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QTESTLITEWINDOW_H
43 #define QTESTLITEWINDOW_H
44 
45 #include "qxlibintegration.h"
46 
47 #include <QPlatformWindow>
48 #include <QEvent>
49 
50 #include <QObject>
51 #include <QImage>
52 
53 struct QXlibMWMHints {
55  long input_mode;
57 };
58 
59 enum {
60  MWM_HINTS_FUNCTIONS = (1L << 0),
61 
62  MWM_FUNC_ALL = (1L << 0),
63  MWM_FUNC_RESIZE = (1L << 1),
64  MWM_FUNC_MOVE = (1L << 2),
65  MWM_FUNC_MINIMIZE = (1L << 3),
66  MWM_FUNC_MAXIMIZE = (1L << 4),
67  MWM_FUNC_CLOSE = (1L << 5),
68 
69  MWM_HINTS_DECORATIONS = (1L << 1),
70 
71  MWM_DECOR_ALL = (1L << 0),
72  MWM_DECOR_BORDER = (1L << 1),
73  MWM_DECOR_RESIZEH = (1L << 2),
74  MWM_DECOR_TITLE = (1L << 3),
75  MWM_DECOR_MENU = (1L << 4),
76  MWM_DECOR_MINIMIZE = (1L << 5),
77  MWM_DECOR_MAXIMIZE = (1L << 6),
78 
79  MWM_HINTS_INPUT_MODE = (1L << 2),
80 
84 };
85 
87 {
88 public:
90  ~QXlibWindow();
91 
92 
93  void mousePressEvent(XButtonEvent*);
94  void handleMouseEvent(QEvent::Type, XButtonEvent *ev);
95 
96  void handleCloseEvent();
97  void handleEnterEvent();
98  void handleLeaveEvent();
99  void handleFocusInEvent();
100  void handleFocusOutEvent();
101 
102  void resizeEvent(XConfigureEvent *configure_event);
103  void paintEvent();
104 
105  void requestActivateWindow();
106 
107  void setGeometry(const QRect &rect);
108 
109  Qt::WindowFlags setWindowFlags(Qt::WindowFlags type);
110  Qt::WindowFlags windowFlags() const;
111  void setVisible(bool visible);
112  WId winId() const;
113  void setParent(const QPlatformWindow *window);
114  void raise();
115  void lower();
116  void setWindowTitle(const QString &title);
117 
118  void setCursor(const Cursor &cursor);
119 
120  QPlatformGLContext *glContext() const;
121 
122  Window xWindow() const;
123  GC graphicsContext() const;
124 
125  inline uint depth() const { return mDepth; }
126  QImage::Format format() const { return mFormat; }
127  Visual* visual() const { return mVisual; }
128 
129 protected:
131  void setMWMHints(const QXlibMWMHints &mwmhints);
132  QXlibMWMHints getMWMHints() const;
133 
134  void doSizeHints();
135 
136 private:
137  QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const;
138 
141 
144  Visual* mVisual;
145 
146  GC createGC();
147 
150  Qt::WindowFlags mWindowFlags;
151 };
152 
153 #endif
Format
The following image formats are available in Qt.
Definition: qimage.h:91
unsigned long WId
Definition: qwindowdefs.h:119
int type
Definition: qmetatype.cpp:239
uint depth() const
Definition: qxlibwindow.h:125
QImage::Format mFormat
Definition: qxlibwindow.h:143
static QVector< Atom > getNetWmState(QWidget *w)
QPlatformGLContext * mGLContext
Definition: qxlibwindow.h:148
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if po...
Visual * visual() const
Definition: qxlibwindow.h:127
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QPlatformWindow class provides an abstraction for top-level windows.
ulong decorations
Definition: qxlibwindow.h:54
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
NSWindow * window
Visual * mVisual
Definition: qxlibwindow.h:144
ulong functions
Definition: qxlibwindow.h:54
unsigned int uint
Definition: qglobal.h:996
Qt::WindowFlags mWindowFlags
Definition: qxlibwindow.h:150
unsigned long ulong
Definition: qglobal.h:997
Window x_window
Definition: qxlibwindow.h:139
The QPlatformGLContext class provides an abstraction for native GL contexts.
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
QXlibScreen * mScreen
Definition: qxlibwindow.h:149
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
struct _XGC * GC
Definition: qwindowdefs.h:117
QImage::Format format() const
Definition: qxlibwindow.h:126