00001
00002
00003
00004
00005
00006
00007
00008 #ifndef EQ_EVENT_H
00009 #define EQ_EVENT_H
00010
00011 #include <eq/client/renderContext.h>
00012
00013 #include <eq/base/base.h>
00014 #include <eq/base/log.h>
00015
00016 namespace eq
00017 {
00024 enum KeyCode
00025 {
00026 KC_ESCAPE = 256,
00027 KC_BACKSPACE,
00028 KC_RETURN,
00029 KC_TAB,
00030 KC_HOME,
00031 KC_LEFT,
00032 KC_UP,
00033 KC_RIGHT,
00034 KC_DOWN,
00035 KC_PAGE_UP,
00036 KC_PAGE_DOWN,
00037 KC_END,
00038 KC_F1,
00039 KC_F2,
00040 KC_F3,
00041 KC_F4,
00042 KC_F5,
00043 KC_F6,
00044 KC_F7,
00045 KC_F8,
00046 KC_F9,
00047 KC_F10,
00048 KC_F11,
00049 KC_F12,
00050 KC_F13,
00051 KC_F14,
00052 KC_F15,
00053 KC_F16,
00054 KC_F17,
00055 KC_F18,
00056 KC_F19,
00057 KC_F20,
00058 KC_F21,
00059 KC_F22,
00060 KC_F23,
00061 KC_F24,
00062 KC_SHIFT_L,
00063 KC_SHIFT_R,
00064 KC_CONTROL_L,
00065 KC_CONTROL_R,
00066 KC_ALT_L,
00067 KC_ALT_R,
00068 KC_VOID = 0xFFFFFF
00069 };
00070
00076 enum PointerButton
00077 {
00078 PTR_BUTTON_NONE = EQ_BIT_NONE,
00079 PTR_BUTTON1 = EQ_BIT1,
00080 PTR_BUTTON2 = EQ_BIT2,
00081 PTR_BUTTON3 = EQ_BIT3,
00082 PTR_BUTTON4 = EQ_BIT4,
00083 PTR_BUTTON5 = EQ_BIT5
00084 };
00085
00086 struct ResizeEvent
00087 {
00088 int32_t x;
00089 int32_t y;
00090 int32_t w;
00091 int32_t h;
00092 };
00093 struct PointerEvent
00094 {
00095 int32_t x;
00096 int32_t y;
00097 int32_t dx;
00098 int32_t dy;
00099 uint32_t buttons;
00100 uint32_t button;
00101 };
00102 struct KeyEvent
00103 {
00104 uint32_t key;
00105
00106 };
00107
00108 struct Statistic
00109 {
00110 enum Type
00111 {
00112 NONE = 0,
00113 CHANNEL_CLEAR,
00114 CHANNEL_DRAW,
00115 CHANNEL_DRAW_FINISH,
00116 CHANNEL_ASSEMBLE,
00117 CHANNEL_READBACK,
00118 CHANNEL_TRANSMIT,
00119 CHANNEL_TRANSMIT_NODE,
00120 CHANNEL_WAIT_FRAME,
00121 CHANNEL_COMPRESS,
00122 WINDOW_FINISH,
00123 WINDOW_SWAP_BARRIER,
00124 WINDOW_SWAP,
00125 NODE_TRANSMIT,
00126 NODE_COMPRESS,
00127 CONFIG_START_FRAME,
00128 CONFIG_FINISH_FRAME,
00129 CONFIG_WAIT_FINISH_FRAME,
00130 TYPE_ALL
00131 };
00132
00133 Type type;
00134 uint32_t frameNumber;
00135 int64_t startTime;
00136 int64_t endTime;
00137 char resourceName[32];
00138 };
00139
00140 # define EQ_USER_EVENT_SIZE 32
00141 struct UserEvent
00142 {
00143 char data[ EQ_USER_EVENT_SIZE ];
00144 };
00145
00146 struct Event
00147 {
00148 Event();
00149
00150 enum Type
00151 {
00152 EXPOSE = 0,
00153 WINDOW_RESIZE,
00154 WINDOW_CLOSE,
00155 WINDOW_HIDE,
00156 WINDOW_SHOW,
00157 WINDOW_SCREENSAVER,
00158 #ifdef EQ_USE_DEPRECATED
00159 RESIZE = WINDOW_RESIZE,
00160 #endif
00161 POINTER_MOTION,
00162 POINTER_BUTTON_PRESS,
00163 POINTER_BUTTON_RELEASE,
00164 KEY_PRESS,
00165 KEY_RELEASE,
00166 CHANNEL_RESIZE,
00167 STATISTIC,
00168 VIEW_RESIZE,
00169 UNKNOWN,
00170 USER,
00171 ALL
00172 };
00173
00174 uint32_t type;
00175 uint32_t originator;
00176
00177 union
00178 {
00179 ResizeEvent resize;
00180 ResizeEvent show;
00181 ResizeEvent hide;
00182
00183 PointerEvent pointer;
00184 PointerEvent pointerMotion;
00185 PointerEvent pointerButtonPress;
00186 PointerEvent pointerButtonRelease;
00187
00188 KeyEvent key;
00189 KeyEvent keyPress;
00190 KeyEvent keyRelease;
00191
00192 Statistic statistic;
00193
00194 UserEvent user;
00195 };
00196
00197 RenderContext context;
00198 };
00199
00200 EQ_EXPORT std::ostream& operator << ( std::ostream&, const Event& );
00201 EQ_EXPORT std::ostream& operator << ( std::ostream&, const Event::Type& );
00202 EQ_EXPORT std::ostream& operator << ( std::ostream&, const ResizeEvent& );
00203 EQ_EXPORT std::ostream& operator << ( std::ostream&, const PointerEvent& );
00204 EQ_EXPORT std::ostream& operator << ( std::ostream&, const KeyEvent& );
00205 EQ_EXPORT std::ostream& operator << ( std::ostream&, const Statistic& );
00206 }
00207
00208 #endif // EQ_EVENT_H
00209