OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
sceneviewerinput.hpp
Go to the documentation of this file.
1 
4 /* OpenCMISS-Zinc Library
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #ifndef CMZN_SCENEVIEWERINPUT_HPP__
10 #define CMZN_SCENEVIEWERINPUT_HPP__
11 
12 #include "zinc/sceneviewerinput.h"
13 #include "zinc/sceneviewer.hpp"
14 
15 namespace OpenCMISS
16 {
17 namespace Zinc
18 {
19 
28 {
29 protected:
30  cmzn_sceneviewerinput_id id;
31 
32 public:
38  {
39  BUTTON_TYPE_INVALID = CMZN_SCENEVIEWERINPUT_BUTTON_TYPE_INVALID,
41  BUTTON_TYPE_LEFT = CMZN_SCENEVIEWERINPUT_BUTTON_TYPE_LEFT,
43  BUTTON_TYPE_MIDDLE = CMZN_SCENEVIEWERINPUT_BUTTON_TYPE_MIDDLE,
45  BUTTON_TYPE_RIGHT = CMZN_SCENEVIEWERINPUT_BUTTON_TYPE_RIGHT,
47  BUTTON_TYPE_SCROLL_DOWN = CMZN_SCENEVIEWERINPUT_BUTTON_TYPE_SCROLL_DOWN,
49  BUTTON_TYPE_SCROLL_UP = CMZN_SCENEVIEWERINPUT_BUTTON_TYPE_SCROLL_UP
51  };
52 
56  enum EventType
57  {
58  EVENT_TYPE_INVALID = CMZN_SCENEVIEWERINPUT_EVENT_TYPE_INVALID,
60  EVENT_TYPE_MOTION_NOTIFY = CMZN_SCENEVIEWERINPUT_EVENT_TYPE_MOTION_NOTIFY,
62  EVENT_TYPE_BUTTON_PRESS = CMZN_SCENEVIEWERINPUT_EVENT_TYPE_BUTTON_PRESS,
64  EVENT_TYPE_BUTTON_RELEASE = CMZN_SCENEVIEWERINPUT_EVENT_TYPE_BUTTON_RELEASE,
66  EVENT_TYPE_KEY_PRESS = CMZN_SCENEVIEWERINPUT_EVENT_TYPE_KEY_PRESS,
68  EVENT_TYPE_KEY_RELEASE = CMZN_SCENEVIEWERINPUT_EVENT_TYPE_KEY_RELEASE
70  };
71 
76  {
77  MODIFIER_FLAG_NONE = CMZN_SCENEVIEWERINPUT_MODIFIER_FLAG_NONE,
79  MODIFIER_FLAG_SHIFT = CMZN_SCENEVIEWERINPUT_MODIFIER_FLAG_SHIFT,
81  MODIFIER_FLAG_CONTROL = CMZN_SCENEVIEWERINPUT_MODIFIER_FLAG_CONTROL,
83  MODIFIER_FLAG_ALT = CMZN_SCENEVIEWERINPUT_MODIFIER_FLAG_ALT,
85  MODIFIER_FLAG_BUTTON1 = CMZN_SCENEVIEWERINPUT_MODIFIER_FLAG_BUTTON1
87  };
88 
93  typedef int ModifierFlags;
94 
95  Sceneviewerinput() : id(0)
96  { }
97 
98  // takes ownership of C-style region reference
99  explicit Sceneviewerinput(cmzn_sceneviewerinput_id in_sceneviewerinput_id) :
100  id(in_sceneviewerinput_id)
101  { }
102 
103  Sceneviewerinput(const Sceneviewerinput& sceneviewerinput) :
104  id(cmzn_sceneviewerinput_access(sceneviewerinput.id))
105  { }
106 
107  Sceneviewerinput& operator=(const Sceneviewerinput& sceneviewerinput)
108  {
109  cmzn_sceneviewerinput_id temp_id = cmzn_sceneviewerinput_access(sceneviewerinput.id);
110  if (0 != id)
111  {
112  cmzn_sceneviewerinput_destroy(&id);
113  }
114  id = temp_id;
115  return *this;
116  }
117 
118  ~Sceneviewerinput()
119  {
120  if (0 != id)
121  {
122  cmzn_sceneviewerinput_destroy(&id);
123  }
124  }
125 
131  bool isValid() const
132  {
133  return (0 != id);
134  }
135 
141  cmzn_sceneviewerinput_id getId() const
142  {
143  return id;
144  }
145 
153  int setPosition(int x, int y)
154  {
155  return cmzn_sceneviewerinput_set_position(id, x, y);
156  }
157 
164  int setButtonType(ButtonType buttonType)
165  {
166  return cmzn_sceneviewerinput_set_button_type(id, static_cast<cmzn_sceneviewerinput_button_type>(buttonType));
167  }
168 
175  int setEventType(EventType eventType)
176  {
177  return cmzn_sceneviewerinput_set_event_type(id, static_cast<cmzn_sceneviewerinput_event_type>(eventType));
178  }
179 
187  int setModifierFlags(ModifierFlags modifierFlags)
188  {
189  return cmzn_sceneviewerinput_set_modifier_flags(id, modifierFlags);
190  }
191 
192 };
193 
195 {
196  return Sceneviewerinput(cmzn_sceneviewer_create_sceneviewerinput(id));
197 }
198 
200 {
201  return cmzn_sceneviewer_process_sceneviewerinput(id, input.getId());
202 }
203 
204 } // namespace Zinc
205 }
206 
207 #endif
EventType
Definition: sceneviewerinput.hpp:56
cmzn_sceneviewerinput_id getId() const
Definition: sceneviewerinput.hpp:141
Sceneviewerinput createSceneviewerinput()
Definition: sceneviewerinput.hpp:194
int ModifierFlags
Definition: sceneviewerinput.hpp:93
Definition: sceneviewerinput.hpp:41
int setPosition(int x, int y)
Definition: sceneviewerinput.hpp:153
int processSceneviewerinput(const Sceneviewerinput &input)
Definition: sceneviewerinput.hpp:199
bool isValid() const
Definition: sceneviewerinput.hpp:131
int setButtonType(ButtonType buttonType)
Definition: sceneviewerinput.hpp:164
ModifierFlag
Definition: sceneviewerinput.hpp:75
Definition: sceneviewerinput.hpp:83
int setModifierFlags(ModifierFlags modifierFlags)
Definition: sceneviewerinput.hpp:187
Describes a mouse event for processing by the sceneviewer.
Definition: sceneviewerinput.hpp:27
int setEventType(EventType eventType)
Definition: sceneviewerinput.hpp:175
ButtonType
Definition: sceneviewerinput.hpp:37
Definition: sceneviewerinput.hpp:45