SoQt  1.6.2
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoQtBasic.h
1#ifndef SOQT_BASIC_H
2#define SOQT_BASIC_H
3
4// NB: this is not a pure configure-input file, it's also a config header...
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/* Some useful inline template functions:
41 * SoQtMin(Val1, Val2) - returns minimum value
42 * SoQtMax(Val1, Val2) - returns maximum value
43 * SoQtClamp(Val, Min, Max) - returns clamped value
44 * SoQtSwap(Val1, Val2) - swaps the two values (no return value)
45 */
46
47template <class Type>
48inline Type SoQtAbs(Type Val) {
49 return (Val < 0) ? -Val : Val;
50}
51
52template <class Type>
53inline Type SoQtMin(Type a, Type b) {
54 return (b < a) ? b : a;
55}
56
57template <class Type>
58inline Type SoQtMax(Type a, Type b) {
59 return (b > a) ? b : a;
60}
61
62template <class Type>
63inline Type SoQtClamp(Type val, Type min, Type max) {
64 return SoQtMax(min, SoQtMin(max, val));
65}
66
67template <class Type>
68inline void SoQtSwap(Type & a, Type & b) {
69 Type t = a; a = b; b = t;
70}
71
72// *************************************************************************
73
74#define __COIN_SOQT__
75
76#if ! defined(SOQT_MAJOR_VERSION)
77#define SOQT_MAJOR_VERSION 1
78#endif /* ! SOQT_MAJOR_VERSION */
79#if ! defined(SOQT_MINOR_VERSION)
80#define SOQT_MINOR_VERSION 6
81#endif /* ! SOQT_MINOR_VERSION */
82#if ! defined(SOQT_MICRO_VERSION)
83#define SOQT_MICRO_VERSION 2
84#endif /* ! SOQT_MICRO_VERSION */
85#if ! defined(SOQT_BETA_VERSION)
86#define SOQT_BETA_VERSION
87#endif /* ! SOQT_BETA_VERSION */
88#if ! defined(SOQT_VERSION)
89#define SOQT_VERSION "1.6.2"
90#endif /* ! SOQT_VERSION */
91
92// *************************************************************************
93
94/* Precaution to avoid an error easily made by the application programmer. */
95#ifdef SOQT_DLL_API
96# error Leave the internal SOQT_DLL_API define alone.
97#endif /* SOQT_DLL_API */
98
99/*
100 On Microsoft Windows platforms, one of these defines must always be set when
101 building application programs:
102
103 - "SOQT_DLL", when the application programmer is using the
104 library in the form of a dynamic link library (DLL)
105
106 - "SOQT_NOT_DLL", when the application programmer is using the
107 library in the form of a static object library (LIB)
108
109 Note that either SOQT_DLL or SOQT_NOT_DLL _must_ be defined by
110 the application programmer on Microsoft Windows platforms, otherwise the
111 #error statement will be hit. Set up one or the other of these two
112 defines in your compiler environment according to how the library
113 was built -- as a DLL (use "SOQT_DLL") or as a LIB (use
114 "SOQT_NOT_DLL").
115
116 (Setting up defines for the compiler is typically done by either
117 adding something like "/DSOQT_DLL" to the compiler's argument
118 line (for command-line build processes), or by adding the define to
119 the list of preprocessor symbols in your IDE GUI (in the MSVC IDE,
120 this is done from the "Project"->"Settings" menu, choose the "C/C++"
121 tab, then "Preprocessor" from the drop down list and add the
122 appropriate define)).
123
124 It is extremely important that the application programmer uses the
125 correct define, as using "SOQT_NOT_DLL" when "SOQT_DLL" is
126 correct is likely to cause mysterious crashes.
127 */
128#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
129# ifdef SOQT_INTERNAL
130# ifdef SOQT_MAKE_DLL
131# define SOQT_DLL_API __declspec(dllexport)
132# endif /* SOQT_MAKE_DLL */
133# else /* !SOQT_INTERNAL */
134# ifdef SOQT_DLL
135# define SOQT_DLL_API __declspec(dllimport)
136# else /* !SOQT_DLL */
137# ifndef SOQT_NOT_DLL
138# error Define either SOQT_DLL or SOQT_NOT_DLL as appropriate for your linkage! See Inventor/Qt/SoQtBasic.h for further instructions.
139# endif /* SOQT_NOT_DLL */
140# endif /* !SOQT_DLL */
141# endif /* !SOQT_MAKE_DLL */
142#endif /* Microsoft Windows */
143
144/* Empty define to avoid errors when _not_ compiling an Microsoft Windows DLL. */
145#ifndef SOQT_DLL_API
146# define SOQT_DLL_API
147#endif /* !SOQT_DLL_API */
148
149#ifndef GUI_TOOLKIT_VERSION
150#define GUI_TOOLKIT_VERSION "5153"
151#endif /* GUI_TOOLKIT_VERSION */
152
153#endif // ! SOQT_BASIC_H