Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoQtDevice.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : David Mott (MMM yyyy)
22** Modified by : Gavin Bell (MMM yyyy)
23**=======================================================================*/
24
25
26#ifndef _SO_QT_DEVICE_
27#define _SO_QT_DEVICE_
29#include <Inventor/SbLinear.h>
31
32#include <QObject>
33#include <QEvent>
34#include <QScreen>
35#include <QApplication>
36#include <QWindow>
37#include <Inventor/Qt/SoQtDef.h>
39
40
41// Stuff for SoQtMouse/Keyboard
42#define EventMask int
43#ifdef _WIN32
44#define ButtonPressMask 0x01
45#define ButtonReleaseMask 0x02
46#define PointerMotionMask 0x04
47#define ButtonMotionMask 0x08
48#define KeyPressMask 0x10
49#define KeyReleaseMask 0x20
50#define EnterWindowMask 0x40
51#define LeaveWindowMask 0x80
52#elif defined __APPLE__
53#define ButtonPressMask 0x01
54#define ButtonReleaseMask 0x02
55#define PointerMotionMask 0x04
56#define ButtonMotionMask 0x08
57#define KeyPressMask 0x10
58#define KeyReleaseMask 0x20
59#define EnterWindowMask 0x40
60#define LeaveWindowMask 0x80
61#else
62#define NoEventMask 0L
63#define KeyPressMask (1L<<0)
64#define KeyReleaseMask (1L<<1)
65#define ButtonPressMask (1L<<2)
66#define ButtonReleaseMask (1L<<3)
67#define EnterWindowMask (1L<<4)
68#define LeaveWindowMask (1L<<5)
69#define PointerMotionMask (1L<<6)
70#define PointerMotionHintMask (1L<<7)
71#define Button1MotionMask (1L<<8)
72#define Button2MotionMask (1L<<9)
73#define Button3MotionMask (1L<<10)
74#define Button4MotionMask (1L<<11)
75#define Button5MotionMask (1L<<12)
76#define ButtonMotionMask (1L<<13)
77#endif
78
79class QEvent;
80
101class SoQtDevice : public QObject
102{
103
104 Q_OBJECT
105
106public:
112 virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void* unused=NULL) = 0;
113
117 virtual void disable(QWidget *w, XtEventHandler f, XtPointer data) = 0;
118
125 virtual const SoEvent *translateEvent(QEvent *event) = 0;
126
136 void setWindowSize(const SbVec2s &s);
137
141 const SbVec2s &getWindowSize() const { return winSize; }
142
143private:
152 void setEventPosition(SoEvent *event, float x, float y) const;
153
154 //because qt doesn't give us the widget of an event we have to keep track on it
155 //and set it with enable and disable
156 QWidget *deviceWidget;
157
158private:
159 SbVec2s winSize; // size of the window this device works in, in pixels
160
161};
162
163#endif /* _SO_QT_DEVICE_ */
void * XtPointer
Definition SoQtDef.h:118
#define XtEventHandler
Definition SoWinDef.h:121
2D vector class.
Definition SbVec.h:700
Base class for all events.
Definition SoEvent.h:116
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Definition SoQtDevice.h:102
const SbVec2s & getWindowSize() const
Gets the size of the window, in pixels, this device is registered for.
Definition SoQtDevice.h:141
virtual void disable(QWidget *w, XtEventHandler f, XtPointer data)=0
Disables the device for the passed widget.
virtual void enable(QWidget *w, XtEventHandler f, XtPointer data, void *unused=NULL)=0
Enables the device for the passed widget.
void setWindowSize(const SbVec2s &s)
Sets the size of the window this device is registered for.
virtual const SoEvent * translateEvent(QEvent *event)=0
Attempts to convert the passed event into an SoEvent.