SoQt  1.6.3
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoQtDevice.h
1#ifndef SOQT_DEVICE_H
2#define SOQT_DEVICE_H
3
4//
5
6/**************************************************************************\
7 * Copyright (c) Kongsberg Oil & Gas Technologies AS
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
13 *
14 * Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * Neither the name of the copyright holder nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36\**************************************************************************/
37
38// *************************************************************************
39//
40// Toolkit-specific typedef and include(s). Put these before any Coin
41// and/or SoQt includes, in case there are any dependency bugs in
42// the underlying native toolkit set of include files versus the
43// compiler environment's include files.
44
45#include <Inventor/Qt/SoQtBasic.h> // Contains __COIN_SOQT__ define.
46
47#ifdef __COIN_SOQT__
48#include <qevent.h>
49typedef void SoQtEventHandler(QWidget*, void *, QEvent*, bool *);
50#endif // __COIN_SOQT__
51#ifdef __COIN_SOXT__
52#include <X11/Intrinsic.h>
53typedef void SoQtEventHandler(QWidget*, XtPointer, XEvent *, Boolean *);
54#endif // __COIN_SOXT__
55#ifdef __COIN_SOGTK__
56#include <gtk/gtk.h>
57typedef gint SoQtEventHandler(QWidget*, QEvent*, gpointer);
58#endif // __COIN_SOGTK__
59#ifdef __COIN_SOWIN__
60#include <windows.h>
61typedef LRESULT SoQtEventHandler(QWidget*, UINT, WPARAM, LPARAM);
62#endif // __COIN_SOWIN__
63#ifdef __COIN_SOWX__
64#include <wx/wx.h>
65typedef void SoQtEventHandler(QWidget*, void *, QEvent*, bool *);
66#endif // __COIN_SOWX__
67
68// *************************************************************************
69
70#include <Inventor/SbLinear.h>
71#include <Inventor/Qt/SoQtObject.h>
72
73class SoEvent;
74
75// *************************************************************************
76
77class SOQT_DLL_API SoQtDevice : public SoQtObject {
78 SOQT_OBJECT_ABSTRACT_HEADER(SoQtDevice, SoQtObject);
79
80public:
81 virtual ~SoQtDevice();
82
83 virtual void enable(QWidget* w, SoQtEventHandler * handler, void * closure) = 0;
84 virtual void disable(QWidget* w, SoQtEventHandler * handler, void * closure) = 0;
85
86 virtual const SoEvent * translateEvent(QEvent* event) = 0;
87
88 void setWindowSize(const SbVec2s size);
89 SbVec2s getWindowSize(void) const;
90
91 static void initClasses(void);
92
93protected:
94 SoQtDevice(void);
95
96 void setEventPosition(SoEvent * event, int x, int y) const;
97 static SbVec2s getLastEventPosition(void);
98
99 void addEventHandler(QWidget*, SoQtEventHandler *, void *);
100 void removeEventHandler(QWidget*, SoQtEventHandler *, void *);
101 void invokeHandlers(QEvent* event);
102
103private:
104 class SoQtDeviceP * pimpl;
105 friend class SoQtDeviceP;
106};
107
108// *************************************************************************
109
110#endif // !SOQT_DEVICE_H
The SoQtDevice class is the base class for the translation devices.
Definition SoQtDevice.h:77
virtual void disable(QWidget *w, SoQtEventHandler *handler, void *closure)=0
virtual const SoEvent * translateEvent(QEvent *event)=0
virtual void enable(QWidget *w, SoQtEventHandler *handler, void *closure)=0
The SoQtObject class is the common superclass for all SoQt component classes.
Definition SoQtObject.h:48