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