GL Studio C++ Runtime API
gls_thumb_wheel.h
Go to the documentation of this file.
1 /*! \file
2  \brief The disti::GlsThumbWheel class.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2017 by The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 #ifndef INCLUDED_GLS_THUMBWHEEL_H
41 #define INCLUDED_GLS_THUMBWHEEL_H
42 
43 #include "gls_odometer.h" // Needed to autolink the odometer lib
44 #include "glsutil.h"
45 #include "group.h"
46 
47 //////////////////// Provides support for creating DLLs ////////////////////////
48 #if( defined( GLSGEN_EXPORT_GLSTHUMBWHEEL ) || defined( GLSGEN_IMPORT_GLSTHUMBWHEEL ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
49  && defined( _MSC_VER )
50 # if defined( GLSGEN_EXPORT_GLSTHUMBWHEEL ) || defined( GLS_EXPORT_GENERATED )
51 # define GLSGEN_GLSTHUMBWHEEL_EXPORT __declspec( dllexport )
52 # else
53 # define GLSGEN_GLSTHUMBWHEEL_EXPORT __declspec( dllimport )
54 # endif
55 #else
56 # define GLSGEN_GLSTHUMBWHEEL_EXPORT
57 #endif
58 ///////////////////////////////////////////////////////////////////////////////
59 
60 #define LIB_BASE_NAME "gls_thumb_wheel"
61 #include "gls_auto_lib.h"
62 #undef LIB_BASE_NAME
63 
64 namespace disti
65 {
66 // SetValue enumerations
67 // enums for metadata attributes
68 enum
69 {
70  GLS_GLSTHUMBWHEEL_INITIAL_VAL = GLS_LAST_INITIALIZER + 1,
71  GLS_GLSTHUMBWHEEL_EMIT_DETENT_VAL_EVENT,
72  GLS_GLSTHUMBWHEEL_EMIT_LIMIT_EVENT,
73  GLS_GLSTHUMBWHEEL_EMIT_RELEASE_EVENT,
74  GLS_GLSTHUMBWHEEL_NUMBER_OF_DETENTS,
75  GLS_GLSTHUMBWHEEL_CONTINUOUS_DRAG,
76  GLS_GLSTHUMBWHEEL_DETENT_VAL,
77  GLS_GLSTHUMBWHEEL_WHICH_OBJECT_THUMBWHEEL,
78  GLS_GLSTHUMBWHEEL_WHICH_OBJECT_ODOMETER,
79  GLS_GLSTHUMBWHEEL_SOUND_INDEX
80 };
81 
82 /** Runtime implementation of a GlsThumbWheel */
83 class GlsThumbWheel : public Group
84 {
85  friend class GlsThumbWheelEditor;
86 
87 public:
88  DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
89  typedef Group _BaseClass;
90  typedef Group BaseClass;
91 
92  /** Create a new GlsThumbWheel.
93  * \param generateInstance Whether or not to generate an instance name
94  * for this inputdevice */
95  GLSGEN_GLSTHUMBWHEEL_EXPORT GlsThumbWheel( bool generateInstance = false );
96 
97  /** Destructs a GlsThumbWheel object */
98  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT ~GlsThumbWheel();
99 
100  static GLSGEN_GLSTHUMBWHEEL_EXPORT DisplayObject* CreateInstance();
101 
102  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT void SetAvailableAttributes( unsigned int value );
103 
104  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT DisplayObject* CloneObject( bool generateNames = false );
105 
106  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT void CopyProperties( DisplayObject* src );
107 
108 #ifndef GLES
109  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL );
110  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array );
111 #endif
112 
113  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler );
114  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT void Draw( void );
115 
116  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT DisplayObject* handle( DisplayEvent* ev );
117 
118  /** Calculates if this switch is horizontal or vertical relative to the y axis */
120 
121  virtual void SetValue( int spec, va_list& args );
122 
123  //////////////////////////////////////////////////
124  // GlsThumbWheel specific operations
125  //////////////////////////////////////////////////
126 
127  /** Sets current detent of the thumbwheel
128  * \param val New detent of the thumbwheel
129  */
130  GLSGEN_GLSTHUMBWHEEL_EXPORT void DetentVal( const int& val );
131 
132  /** Returns the current detent of the thumbwheel
133  * \return Current thumbwheel detent
134  */
135  GLSGEN_GLSTHUMBWHEEL_EXPORT int DetentVal();
136 
137  /** Sets current odometer index
138  * \param val New current odometer index
139  */
140  GLSGEN_GLSTHUMBWHEEL_EXPORT void IndexVal( const int& val );
141 
142  /** Returns current odometer index
143  * \return Current odometer index
144  */
145  GLSGEN_GLSTHUMBWHEEL_EXPORT int IndexVal();
146 
147  /** Sets group index for the selected odometer
148  * \param val New group index for the selected odometer
149  */
150  GLSGEN_GLSTHUMBWHEEL_EXPORT void WhichObjectOdometer( const int& val );
151 
152  /** Returns the group index for the selected odometer
153  * \return group index for the selected odometer
154  */
155  GLSGEN_GLSTHUMBWHEEL_EXPORT int WhichObjectOdometer();
156 
157  /** Sets group index for the selected ThumbWheel geometry
158  * \param val New group index for the selected ThumbWheel geometry
159  */
160  GLSGEN_GLSTHUMBWHEEL_EXPORT void WhichObjectThumbWheel( const int& val );
161 
162  /** Returns the group index for the selected ThumbWheel geometry
163  * \return group index for the selected ThumbWheel geometry
164  */
165  GLSGEN_GLSTHUMBWHEEL_EXPORT int WhichObjectThumbWheel();
166 
167  /* See base class */
168  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT DisplayObject* Pick3D( const Vector& winLoc,
169  const Vector& logicalCoords,
170  float scale,
171  const Vector& directionVector,
172  Vector& collisionWinLoc /*Returned*/,
173  const OpenGLMatrices& drawnMatrices );
174 
175 protected:
176  // plugin class attributes
177  bool _emitDetentValEvent;
178  bool _emitLimitEvent; // whether or not to emit limit events - when start or end is reached
179  bool _emitReleaseEvent;
180  int _detentVal; // range: 1 to _numberOfDetents (the detent of the thumbwheel)
181  int _indexVal; // range: 0 to _numberOfDetents - 1 (the index of the odometer)
182  int _initialVal;
183  int _numberOfDetents;
184  int _soundIndex; // index into the list of sounds
185  bool _continuousDrag; // if true, the wheel will wrap around when limit is reached
186  int _whichObjectThumbWheel; // The object index in the group to be the thumbwheel
187  int _whichObjectOdometer; // The object index in the group to be the odometer (if there is one)
188 
189  int _browserIndexThumbWheel; // need to keep track of browser Index for use in ShowProperties()
190  int _browserIndexOdometer; // need to keep track of browser Index for use in ShowProperties()
191 
192  bool _initialized;
193  bool _mouseWasDown;
194  unsigned int _currentCursor; // the current cursor used for interaction. Any other cursors are ignored while interacting.
195 
196 #ifdef GLES
197  /** Set a single attribute from the GLO file.
198  * \param data The attribute to set and its associated data.
199  */
200  virtual GLSGEN_GLSTHUMBWHEEL_EXPORT void SetFromGloData( GlsGloFileAttribute& data );
201 #endif
202 };
203 
204 } // namespace disti
205 
206 #endif
Definition: cull.h:49
virtual void SetAvailableAttributes(unsigned int value)
virtual void CopyProperties(DisplayObject *src)
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:436
Definition: dynamic_array.h:66
The disti::Group class. Implements groups of objects.
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:296
virtual ~GlsThumbWheel()
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL)
virtual DisplayObject * Pick3D(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices)
Definition: display.h:98
InputOrientationEnum InputType(void)
virtual DisplayObject * handle(DisplayEvent *ev)
InputOrientationEnum
Enumeration for Input Operators.
Definition: glsutil.h:262
The disti::GlsOdometer class.
Definition: gls_glo_file.h:982
virtual void SetValue(int spec, va_list &args)
GlsThumbWheel(bool generateInstance=false)
Definition: events.h:112
The gls_auto_lib.
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler)
Definition: gls_thumb_wheel.h:83
Definition: group.h:52
Definition: vertex.h:84
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array)
virtual DisplayObject * CloneObject(bool generateNames=false)
GL Studio helper functions.
Definition: bmpimage.h:46
virtual void Draw(void)