SoXt  1.4.1
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoXtDevice.h
1#ifndef SOXT_DEVICE_H
2#define SOXT_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 SoXt 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/Xt/SoXtBasic.h> // Contains __COIN_SOXT__ define.
46
47#ifdef __COIN_SOQT__
48#include <qevent.h>
49typedef void SoXtEventHandler(Widget, void *, XAnyEvent*, bool *);
50#endif // __COIN_SOQT__
51#ifdef __COIN_SOXT__
52#include <X11/Intrinsic.h>
53typedef void SoXtEventHandler(Widget, XtPointer, XEvent *, Boolean *);
54#endif // __COIN_SOXT__
55#ifdef __COIN_SOGTK__
56#include <gtk/gtk.h>
57typedef gint SoXtEventHandler(Widget, XAnyEvent*, gpointer);
58#endif // __COIN_SOGTK__
59#ifdef __COIN_SOWIN__
60#include <windows.h>
61typedef LRESULT SoXtEventHandler(Widget, UINT, WPARAM, LPARAM);
62#endif // __COIN_SOWIN__
63#ifdef __COIN_SOWX__
64#include <wx/wx.h>
65typedef void SoXtEventHandler(Widget, void *, XAnyEvent*, bool *);
66#endif // __COIN_SOWX__
67
68// *************************************************************************
69
70#include <Inventor/SbLinear.h>
71#include <Inventor/Xt/SoXtObject.h>
72
73class SoEvent;
74
75// *************************************************************************
76
77class SOXT_DLL_API SoXtDevice : public SoXtObject {
78 SOXT_OBJECT_ABSTRACT_HEADER(SoXtDevice, SoXtObject);
79
80public:
81 virtual ~SoXtDevice();
82
83 virtual void enable(Widget w, SoXtEventHandler * handler, void * closure) = 0;
84 virtual void disable(Widget w, SoXtEventHandler * handler, void * closure) = 0;
85
86 virtual const SoEvent * translateEvent(XAnyEvent* event) = 0;
87
88 void setWindowSize(const SbVec2s size);
89 SbVec2s getWindowSize(void) const;
90
91 static void initClasses(void);
92
93protected:
94 SoXtDevice(void);
95
96 void setEventPosition(SoEvent * event, int x, int y) const;
97 static SbVec2s getLastEventPosition(void);
98
99 void addEventHandler(Widget, SoXtEventHandler *, void *);
100 void removeEventHandler(Widget, SoXtEventHandler *, void *);
101 void invokeHandlers(XAnyEvent* event);
102
103private:
104 class SoXtDeviceP * pimpl;
105 friend class SoXtDeviceP;
106};
107
108// *************************************************************************
109
110#endif // !SOXT_DEVICE_H
The SoXtDevice class is the base class for the translation devices.
Definition SoXtDevice.h:77
virtual const SoEvent * translateEvent(XAnyEvent *event)=0
virtual void disable(Widget w, SoXtEventHandler *handler, void *closure)=0
virtual void enable(Widget w, SoXtEventHandler *handler, void *closure)=0
The SoXtObject class is the common superclass for all SoXt component classes.
Definition SoXtObject.h:48