Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef PCL_VISUALIZATION_MOUSE_EVENT_H_
00040 #define PCL_VISUALIZATION_MOUSE_EVENT_H_
00041
00042 #include <pcl/visualization/keyboard_event.h>
00043
00044 namespace pcl
00045 {
00046 namespace visualization
00047 {
00048 class MouseEvent
00049 {
00050 public:
00051 typedef enum
00052 {
00053 MouseMove = 1,
00054 MouseButtonPress,
00055 MouseButtonRelease,
00056 MouseScrollDown,
00057 MouseScrollUp,
00058 MouseDblClick
00059 } Type;
00060
00061 typedef enum
00062 {
00063 NoButton = 0,
00064 LeftButton,
00065 MiddleButton,
00066 RightButton,
00067 VScroll
00068 } MouseButton;
00069
00080 inline MouseEvent (const Type& type, const MouseButton& button,
00081 unsigned int x, unsigned int y,
00082 bool alt, bool ctrl, bool shift,
00083 bool selection_mode = false);
00084
00088 inline const Type&
00089 getType () const;
00090
00094 inline void
00095 setType (const Type& type);
00096
00100 inline const MouseButton&
00101 getButton () const;
00102
00104 inline void
00105 setButton (const MouseButton& button);
00106
00110 inline unsigned int
00111 getX () const;
00112
00116 inline unsigned int
00117 getY () const;
00118
00122 inline unsigned int
00123 getKeyboardModifiers () const;
00124
00128 inline bool
00129 getSelectionMode () const;
00130
00131 protected:
00132 Type type_;
00133 MouseButton button_;
00134 unsigned int pointer_x_;
00135 unsigned int pointer_y_;
00136 unsigned int key_state_;
00137 bool selection_mode_;
00138 };
00139
00140 MouseEvent::MouseEvent (const Type& type, const MouseButton& button,
00141 unsigned x, unsigned y,
00142 bool alt, bool ctrl, bool shift,
00143 bool selection_mode)
00144 : type_ (type)
00145 , button_ (button)
00146 , pointer_x_ (x)
00147 , pointer_y_ (y)
00148 , key_state_ (0)
00149 , selection_mode_ (selection_mode)
00150 {
00151 if (alt)
00152 key_state_ = KeyboardEvent::Alt;
00153
00154 if (ctrl)
00155 key_state_ |= KeyboardEvent::Ctrl;
00156
00157 if (shift)
00158 key_state_ |= KeyboardEvent::Shift;
00159 }
00160
00161 const MouseEvent::Type&
00162 MouseEvent::getType () const
00163 {
00164 return (type_);
00165 }
00166
00167 void
00168 MouseEvent::setType (const Type& type)
00169 {
00170 type_ = type;
00171 }
00172
00173 const MouseEvent::MouseButton&
00174 MouseEvent::getButton () const
00175 {
00176 return (button_);
00177 }
00178
00179 void
00180 MouseEvent::setButton (const MouseButton& button)
00181 {
00182 button_ = button;
00183 }
00184
00185 unsigned int
00186 MouseEvent::getX () const
00187 {
00188 return (pointer_x_);
00189 }
00190
00191 unsigned int
00192 MouseEvent::getY () const
00193 {
00194 return (pointer_y_);
00195 }
00196
00197 unsigned int
00198 MouseEvent::getKeyboardModifiers () const
00199 {
00200 return (key_state_);
00201 }
00202
00203 bool
00204 MouseEvent::getSelectionMode () const
00205 {
00206 return (selection_mode_);
00207 }
00208
00209 }
00210 }
00211
00212 #endif
00213