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
00040 #ifndef PCL_VISUALIZATION_MOUSE_EVENT_H_
00041 #define PCL_VISUALIZATION_MOUSE_EVENT_H_
00042
00043 #include "keyboard_event.h"
00044
00045 namespace pcl
00046 {
00047 namespace visualization
00048 {
00049 class MouseEvent
00050 {
00051 public:
00052 typedef enum
00053 {
00054 MouseMove = 1,
00055 MouseButtonPress,
00056 MouseButtonRelease,
00057 MouseScrollDown,
00058 MouseScrollUp,
00059 MouseDblClick
00060 } Type;
00061
00062 typedef enum
00063 {
00064 NoButton = 0,
00065 LeftButton,
00066 MiddleButton,
00067 RightButton,
00068 VScroll
00069 } MouseButton;
00070
00080 inline MouseEvent (const Type& type, const MouseButton& button,
00081 unsigned int x, unsigned int y,
00082 bool alt, bool ctrl, bool shift);
00083
00087 inline const Type&
00088 getType () const;
00089
00093 inline void
00094 setType (const Type& type);
00095
00099 inline const MouseButton&
00100 getButton () const;
00101
00103 inline void
00104 setButton (const MouseButton& button);
00105
00109 inline unsigned int
00110 getX () const;
00111
00115 inline unsigned int
00116 getY () const;
00117
00121 inline unsigned int
00122 getKeyboardModifiers () const;
00123
00124 protected:
00125 Type type_;
00126 MouseButton button_;
00127 unsigned int pointer_x_;
00128 unsigned int pointer_y_;
00129 unsigned int key_state_;
00130 };
00131
00132 MouseEvent::MouseEvent (const Type& type, const MouseButton& button,
00133 unsigned x, unsigned y,
00134 bool alt, bool ctrl, bool shift)
00135 : type_ (type)
00136 , button_ (button)
00137 , pointer_x_ (x)
00138 , pointer_y_ (y)
00139 , key_state_ (0)
00140 {
00141 if (alt)
00142 key_state_ = KeyboardEvent::Alt;
00143
00144 if (ctrl)
00145 key_state_ |= KeyboardEvent::Ctrl;
00146
00147 if (shift)
00148 key_state_ |= KeyboardEvent::Shift;
00149 }
00150
00151 const MouseEvent::Type&
00152 MouseEvent::getType () const
00153 {
00154 return (type_);
00155 }
00156
00157 void
00158 MouseEvent::setType (const Type& type)
00159 {
00160 type_ = type;
00161 }
00162
00163 const MouseEvent::MouseButton&
00164 MouseEvent::getButton () const
00165 {
00166 return (button_);
00167 }
00168
00169 void
00170 MouseEvent::setButton (const MouseButton& button)
00171 {
00172 button_ = button;
00173 }
00174
00175 unsigned int
00176 MouseEvent::getX () const
00177 {
00178 return (pointer_x_);
00179 }
00180
00181 unsigned int
00182 MouseEvent::getY () const
00183 {
00184 return (pointer_y_);
00185 }
00186
00187 unsigned int
00188 MouseEvent::getKeyboardModifiers () const
00189 {
00190 return (key_state_);
00191 }
00192
00193 }
00194 }
00195
00196 #endif
00197