Equalizer  1.2.1
event.h
00001 
00002 /* Copyright (c) 2006-2011, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *                    2011, Cedric Stalder <cedric.stalder@gmail.com> 
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017 */
00018 
00019 #ifndef EQ_EVENT_H
00020 #define EQ_EVENT_H
00021 
00022 #include <eq/client/api.h>
00023 #include <eq/client/statistic.h>     // member
00024 #include <eq/client/types.h>
00025 #include <eq/fabric/renderContext.h> // member
00026 
00027 
00028 namespace eq
00029 {
00036     enum KeyCode
00037     {
00038         KC_ESCAPE = 256,
00039         KC_BACKSPACE,
00040         KC_RETURN,
00041         KC_TAB,
00042         KC_HOME,
00043         KC_LEFT,
00044         KC_UP,
00045         KC_RIGHT,
00046         KC_DOWN,
00047         KC_PAGE_UP,
00048         KC_PAGE_DOWN,
00049         KC_END,
00050         KC_F1,
00051         KC_F2,
00052         KC_F3,
00053         KC_F4,
00054         KC_F5,
00055         KC_F6,
00056         KC_F7,
00057         KC_F8,
00058         KC_F9,
00059         KC_F10,
00060         KC_F11,
00061         KC_F12,
00062         KC_F13,
00063         KC_F14,
00064         KC_F15,
00065         KC_F16,
00066         KC_F17,
00067         KC_F18,
00068         KC_F19,
00069         KC_F20,
00070         KC_F21,
00071         KC_F22,
00072         KC_F23,
00073         KC_F24,
00074         KC_SHIFT_L,
00075         KC_SHIFT_R,
00076         KC_CONTROL_L,
00077         KC_CONTROL_R,
00078         KC_ALT_L,
00079         KC_ALT_R,
00080         KC_VOID = 0xFFFFFF /* == XK_VoidSymbol */
00081     };
00082 
00088     enum PointerButton
00089     {
00090         PTR_BUTTON_NONE = EQ_BIT_NONE,
00091         PTR_BUTTON1     = EQ_BIT1,
00092         PTR_BUTTON2     = EQ_BIT2,
00093         PTR_BUTTON3     = EQ_BIT3,
00094         PTR_BUTTON4     = EQ_BIT4,
00095         PTR_BUTTON5     = EQ_BIT5,
00096         PTR_BUTTON6     = EQ_BIT6,
00097         PTR_BUTTON7     = EQ_BIT7
00098     };
00099 
00104     struct ResizeEvent
00105     {
00106         int32_t x; 
00107         int32_t y; 
00108         int32_t w; 
00109         int32_t h; 
00110         float dw;  
00111         float dh;  
00112     };
00113 
00115     struct PointerEvent
00116     {
00117         int32_t x;             
00118         int32_t y;             
00119         int32_t dx;            
00120         int32_t dy;            
00121         uint32_t buttons;      
00122         uint32_t button;       
00123         int32_t xAxis;         
00124         int32_t yAxis;         
00125     };
00126 
00128     struct KeyEvent
00129     {
00130         uint32_t key; 
00131         // TODO modifier state
00132     };
00133 
00138     struct MagellanEvent
00139     {
00140         uint32_t button;       
00141         uint32_t buttons;      
00142         int16_t xAxis;         
00143         int16_t yAxis;         
00144         int16_t zAxis;         
00145         int16_t xRotation;     
00146         int16_t yRotation;     
00147         int16_t zRotation;     
00148     };
00149 
00150 #   define EQ_USER_EVENT_SIZE 128
00151 
00157     struct UserEvent
00158     {
00159         char data[ EQ_USER_EVENT_SIZE ]; 
00160     };
00161 
00171     struct Event
00172     {
00174         EQ_API Event();
00175 
00177         enum Type // Also update string table in event.cpp
00178         {
00179             WINDOW_EXPOSE = 0,    
00180             WINDOW_RESIZE,        
00181             WINDOW_CLOSE,         
00182             WINDOW_HIDE,          
00183             WINDOW_SHOW,          
00184             WINDOW_SCREENSAVER,   
00185 #ifdef EQ_USE_DEPRECATED
00186             POINTER_MOTION,       
00187 
00188             POINTER_BUTTON_PRESS,
00190             POINTER_BUTTON_RELEASE,
00191             POINTER_WHEEL,        
00192 
00193             CHANNEL_POINTER_MOTION = POINTER_MOTION, 
00195             CHANNEL_POINTER_BUTTON_PRESS = POINTER_BUTTON_PRESS,
00197             CHANNEL_POINTER_BUTTON_RELEASE = POINTER_BUTTON_RELEASE,
00199             WINDOW_POINTER_WHEEL = POINTER_WHEEL, 
00200 #else
00201 
00202             CHANNEL_POINTER_MOTION, 
00204             CHANNEL_POINTER_BUTTON_PRESS,
00206             CHANNEL_POINTER_BUTTON_RELEASE,
00208             WINDOW_POINTER_WHEEL, 
00209 #endif
00210 
00211             WINDOW_POINTER_MOTION,  
00213             WINDOW_POINTER_BUTTON_PRESS,
00215             WINDOW_POINTER_BUTTON_RELEASE,
00216 
00217             KEY_PRESS,            
00218             KEY_RELEASE,          
00219             CHANNEL_RESIZE,       
00220             STATISTIC,            
00221             VIEW_RESIZE,          
00222             EXIT,                 
00223             MAGELLAN_AXIS,        
00224             MAGELLAN_BUTTON,      
00225             UNKNOWN,              
00226 
00227             USER = UNKNOWN + 5, // some buffer for binary-compatible patches
00228             ALL // must be last
00229         };
00230 
00231         
00232         uint32_t type;           
00233 
00234         // keep before 'uint128_t originator' for alignment
00235         uint32_t serial;       
00236 
00238         int64_t time;
00239 
00241         uint128_t originator;
00242 
00244         union
00245         {
00246             ResizeEvent   resize;             
00247             ResizeEvent   show;               
00248             ResizeEvent   hide;               
00249             
00250             PointerEvent  pointer;            
00251             PointerEvent  pointerMotion;      
00252             PointerEvent  pointerButtonPress; 
00253             PointerEvent  pointerButtonRelease; 
00254             PointerEvent  pointerWheel;       
00255 
00256             KeyEvent      key;                
00257             KeyEvent      keyPress;           
00258             KeyEvent      keyRelease;         
00259 
00260             Statistic     statistic;          
00261             MagellanEvent magellan;           
00262 
00263             UserEvent     user;               
00264         };
00265      
00267         RenderContext context;
00268     };
00269 
00271     EQ_API std::ostream& operator << ( std::ostream&, const Event& );
00273     EQ_API std::ostream& operator << ( std::ostream&, const Event::Type& );
00275     EQ_API std::ostream& operator << ( std::ostream&, const ResizeEvent& );
00277     EQ_API std::ostream& operator << ( std::ostream&, const PointerEvent& );
00279     EQ_API std::ostream& operator << ( std::ostream&, const KeyEvent& );
00281     EQ_API std::ostream& operator << ( std::ostream&, const MagellanEvent& );
00282 }
00283 
00284 #endif // EQ_EVENT_H
00285 
Generated on Fri Jun 8 2012 15:44:30 for Equalizer 1.2.1 by  doxygen 1.8.0