1 // Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2011 Dzmitry KAMIAHIN (dnk-88) <dnk-88@tut.by>
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010 Winch Gate Property Limited
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include <nel/misc/types_nl.h>
25 #include <nel/misc/rgba.h>
26 #include <nel/misc/event_emitter.h>
29 #include <QtOpenGL/QGLWidget>
30 #include <QtGui/QWidget>
34 /* TODO every platform should use QWidget */
35 #if defined(NL_OS_WINDOWS)
36 typedef QWidget QNeLWidget
;
37 #elif defined(NL_OS_MAC)
38 typedef QWidget QNeLWidget
;
39 #elif defined(NL_OS_UNIX)
40 typedef QGLWidget QNeLWidget
;
54 @brief Responsible for interaction between Qt and NeL.
55 @details Automatically begins to update the render if the widget is visible
56 or suspends the updating of render if the widget is hidden.
58 class QNLWidget
: public QNeLWidget
63 QNLWidget(QWidget
*parent
);
66 /// Set the update interval renderer
67 void setInterval(int msec
);
69 /// Set the background color.
70 void setBackgroundColor(NLMISC::CRGBA backgroundColor
);
77 inline NLMISC::CRGBA
backgroundColor() const
79 return m_backgroundColor
;
82 NL3D::UDriver
*driver() const
87 virtual QPaintEngine
*paintEngine() const
93 void updatePreRender();
94 void updatePostRender();
100 virtual void showEvent(QShowEvent
*showEvent
);
101 virtual void hideEvent(QHideEvent
*hideEvent
);
103 #if defined(NL_OS_WINDOWS)
104 virtual bool winEvent(MSG
*message
, long *result
);
105 #elif defined(NL_OS_MAC)
106 virtual bool macEvent(EventHandlerCallRef caller
, EventRef event
);
107 #elif defined(NL_OS_UNIX)
108 virtual bool x11Event(XEvent
*event
);
115 QNLWidget(const QNLWidget
&);
116 QNLWidget
&operator=(const QNLWidget
&);
118 NL3D::UDriver
*m_driver
;
119 NLMISC::CRGBA m_backgroundColor
;
127 }; /* class QNLWidget */
129 } /* namespace NLQT */
132 #endif // QNEL_WIDGET_H