Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoWinDevice.h
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-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25
26#ifndef _SO_WIN_DEVICE_
27#define _SO_WIN_DEVICE_
28
29#include <Inventor/Win/SoWinBeginStrict.h>
30#include <windows.h>
31#include <Inventor/Win/SoWinDef.h>
32
33#include <Inventor/SbLinear.h>
34#include <Inventor/events/SoEvent.h>
35
59 public:
65 virtual void enable(SoWidget w, XtEventHandler f,
66 XtPointer data, Window win = NULL) = 0;
70 virtual void disable(SoWidget w, XtEventHandler f, XtPointer data) = 0;
71
78 virtual const SoEvent * translateEvent(XAnyEvent *msg) = 0;
79
89 void setWindowSize(const SbVec2s &s) { winSize = s; }
93 const SbVec2s & getWindowSize() const { return winSize; }
94
95 private:
103 inline void setEventPosition(SoEvent *event, float x, float y) const;
104
105 SoWidget deviceWidget;
106
107 private:
108 SbVec2s winSize; // size of the window this device works in
109
110};
111
112// Inline functions
113void
114SoWinDevice::setEventPosition(SoEvent *event, float x, float y) const
115{
116 event->setPosition(SbVec2f(x, (((float)winSize[1]) - 1.f) - y));
117}
118
119#include <Inventor/Win/SoWinEndStrict.h>
120
121#endif /* _SO_WIN_DEVICE_ */
122
2D vector class.
Definition SbVec.h:76
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 SoWinDevice.h:58
virtual void disable(SoWidget w, XtEventHandler f, XtPointer data)=0
Disables the device.
virtual const SoEvent * translateEvent(XAnyEvent *msg)=0
Attempts to convert the passed message into an SoEvent.
void setWindowSize(const SbVec2s &s)
Sets the size of the window this device is registered for.
Definition SoWinDevice.h:89
const SbVec2s & getWindowSize() const
Gets the size of the window this device is registered for.
Definition SoWinDevice.h:93
virtual void enable(SoWidget w, XtEventHandler f, XtPointer data, Window win=NULL)=0
Enables the device for the passed window handle.
void * XtPointer
Definition SoQtDef.h:122