journaledSignal.h
Engine/source/core/util/journal/journaledSignal.h
Classes:
A specialized signal object for journaling input.
Public Enumerations
ApplicationMessage { Quit WindowOpen WindowClose WindowShown WindowHidden WindowDestroy GainCapture LoseCapture GainFocus LoseFocus DisplayChange GainScreen LoseScreen Timer }
InputAction { IA_MAKE = (1 << 0) IA_BREAK = (1 << 1) IA_REPEAT = (1 << 2) IA_MOVE = (1 << 3) IA_DELTA = (1 << 4) IA_BUTTON = (1 << 5) }
InputModifier { IM_LALT = (1 << 1) IM_RALT = (1 << 2) IM_LSHIFT = (1 << 3) IM_RSHIFT = (1 << 4) IM_LCTRL = (1 << 5) IM_RCTRL = (1 << 6) IM_LOPT = (1 << 7) IM_ROPT = (1 << 8) IM_ALT = IM_LALT | IM_RALT IM_SHIFT = IM_LSHIFT | IM_RSHIFT IM_CTRL = IM_LCTRL | IM_RCTRL IM_OPT = IM_LOPT | IM_ROPT }
Public Typedefs
AppEvent
void event(WindowId,InputAppMessage)
ButtonEvent
void event(WindowId,U32 modifier,U32 action,U16 button)
JournaledSignal< void(WindowId, U32, U16)>
CharEvent
void event(WindowId,U32 modifier,U16 key)
DisplayEvent
void event(WindowId)
JournaledSignal< void()>
IdleEvent
void event()
KeyEvent
void event(WindowId,U32 modifier,U32 action,U16 key)
LinearEvent
void event(WindowId,U32 modifier,U32 action,U32 axis,F32 value)
MouseEvent
void event(WindowId,U32 modifier,S32 x,S32 y, bool isRelative)
MouseWheelEvent
void event(WindowId,U32 modifier,S32 wheelDeltaX, S32 wheelDeltaY)
JournaledSignal< void(U32, U32)>
PopupMenuEvent
void event(U32 popupGUID, U32 commandID, bool& returnValue)
JournaledSignal< void(WindowId, U32, F32)>
PovEvent
void event(WindowId,U32 modifier,F32 value)
JournaledSignal< void(WindowId, S32, S32)>
ResizeEvent
void event(WindowId, S32 width, S32 height)
TimeManagerEvent
void event(S32 timeDelta)
WindowId
Detailed Description
Public Enumerations
ApplicationMessage
Enumerator
- Quit
- WindowOpen
Window opened.
- WindowClose
Window closed.
- WindowShown
Window has been shown on screen.
- WindowHidden
Window has become hidden.
- WindowDestroy
Window was destroyed.
- GainCapture
Window will capture all input.
- LoseCapture
Window will no longer capture all input.
- GainFocus
Application gains focus.
- LoseFocus
Application loses focus.
- DisplayChange
Desktop Display mode has changed.
- GainScreen
Window will acquire lock on the full screen.
- LoseScreen
Window has released lock on the full screen.
- Timer
InputAction
Enumerator
- IA_MAKE = (1 << 0)
- IA_BREAK = (1 << 1)
- IA_REPEAT = (1 << 2)
- IA_MOVE = (1 << 3)
- IA_DELTA = (1 << 4)
- IA_BUTTON = (1 << 5)
InputModifier
Enumerator
- IM_LALT = (1 << 1)
- IM_RALT = (1 << 2)
- IM_LSHIFT = (1 << 3)
- IM_RSHIFT = (1 << 4)
- IM_LCTRL = (1 << 5)
- IM_RCTRL = (1 << 6)
- IM_LOPT = (1 << 7)
- IM_ROPT = (1 << 8)
- IM_ALT = IM_LALT | IM_RALT
- IM_SHIFT = IM_LSHIFT | IM_RSHIFT
- IM_CTRL = IM_LCTRL | IM_RCTRL
- IM_OPT = IM_LOPT | IM_ROPT
Public Typedefs
typedef JournaledSignal< void(WindowId, S32)> AppEvent
void event(WindowId,InputAppMessage)
typedef JournaledSignal< void(WindowId, U32, U32, U16)> ButtonEvent
void event(WindowId,U32 modifier,U32 action,U16 button)
typedef JournaledSignal< void(WindowId, U32, U16)> CharEvent
void event(WindowId,U32 modifier,U16 key)
typedef JournaledSignal< void(WindowId)> DisplayEvent
void event(WindowId)
typedef JournaledSignal< void()> IdleEvent
void event()
typedef JournaledSignal< void(U32, F32, F32, F32, F32, S32, U16, U16, U16, U16, U8, U8)> InputEvent
typedef JournaledSignal< void(WindowId, U32, U32, U16)> KeyEvent
void event(WindowId,U32 modifier,U32 action,U16 key)
typedef JournaledSignal< void(WindowId, U32, U32, U32, F32)> LinearEvent
void event(WindowId,U32 modifier,U32 action,U32 axis,F32 value)
typedef JournaledSignal< void(WindowId, U32, S32, S32, bool)> MouseEvent
void event(WindowId,U32 modifier,S32 x,S32 y, bool isRelative)
typedef JournaledSignal< void(WindowId, U32, S32, S32)> MouseWheelEvent
void event(WindowId,U32 modifier,S32 wheelDeltaX, S32 wheelDeltaY)
typedef JournaledSignal< void(U32, U32)> PopupMenuEvent
void event(U32 popupGUID, U32 commandID, bool& returnValue)
typedef JournaledSignal< void(WindowId, U32, F32)> PovEvent
void event(WindowId,U32 modifier,F32 value)
typedef JournaledSignal< void(WindowId, S32, S32)> ResizeEvent
void event(WindowId, S32 width, S32 height)
typedef JournaledSignal< void(S32)> TimeManagerEvent
void event(S32 timeDelta)
typedef U32 WindowId
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _JOURNALEDSIGNAL_H_ 25#define _JOURNALEDSIGNAL_H_ 26 27#ifndef _UTIL_JOURNAL_JOURNAL_H_ 28#include "core/util/journal/journal.h" 29#endif 30#ifndef _TSIGNAL_H_ 31#include "core/util/tSignal.h" 32#endif 33 34template<typename Signature> class JournaledSignal; 35 36 37/// A specialized signal object for journaling input. 38/// @see Journal 39template<> 40class JournaledSignal<void()> : public Signal<void()> 41{ 42 typedef Signal<void()> Parent; 43 44public: 45 JournaledSignal() 46 { 47 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 48 } 49 50 ~JournaledSignal() 51 { 52 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 53 } 54 55 /// Fires off the bound delegates. 56 /// @see Journal::Call 57 void trigger() 58 { 59 Journal::Call((Parent*)this, &Parent::trigger); 60 } 61}; 62 63/// @copydoc JournaledSignal<void()> 64template<class A> 65class JournaledSignal<void(A)> : public Signal<void(A)> 66{ 67 typedef Signal<void(A)> Parent; 68 69public: 70 JournaledSignal() 71 { 72 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 73 } 74 75 ~JournaledSignal() 76 { 77 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 78 } 79 80 void trigger(A a) 81 { 82 Journal::Call((Parent*)this, &Parent::trigger, a); 83 } 84}; 85 86/// @copydoc JournaledSignal<void()> 87template<class A, class B> 88class JournaledSignal<void(A,B)> : public Signal<void(A,B)> 89{ 90 typedef Signal<void(A,B)> Parent; 91 92public: 93 JournaledSignal() 94 { 95 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 96 } 97 98 ~JournaledSignal() 99 { 100 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 101 } 102 103 void trigger(A a, B b) 104 { 105 Journal::Call((Parent*)this, &Parent::trigger, a, b); 106 } 107}; 108 109/// @copydoc JournaledSignal<void()> 110template<class A, class B, class C> 111class JournaledSignal<void(A,B,C)> : public Signal<void(A,B,C)> 112{ 113 typedef Signal<void(A,B,C)> Parent; 114 115public: 116 JournaledSignal() 117 { 118 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 119 } 120 121 ~JournaledSignal() 122 { 123 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 124 } 125 126 void trigger(A a, B b, C c) 127 { 128 Journal::Call((Parent*)this, &Parent::trigger, a, b, c); 129 } 130}; 131 132/// @copydoc JournaledSignal<void()> 133template<class A, class B, class C, class D> 134class JournaledSignal<void(A,B,C,D)> : public Signal<void(A,B,C,D)> 135{ 136 typedef Signal<void(A,B,C,D)> Parent; 137 138public: 139 JournaledSignal() 140 { 141 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 142 } 143 144 ~JournaledSignal() 145 { 146 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 147 } 148 149 void trigger(A a, B b, C c, D d) 150 { 151 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d); 152 } 153}; 154 155/// @copydoc JournaledSignal<void()> 156template<class A, class B, class C, class D, class E> 157class JournaledSignal<void(A,B,C,D,E)> : public Signal<void(A,B,C,D,E)> 158{ 159 typedef Signal<void(A,B,C,D,E)> Parent; 160 161public: 162 JournaledSignal() 163 { 164 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 165 } 166 167 ~JournaledSignal() 168 { 169 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 170 } 171 172 void trigger(A a, B b, C c, D d, E e) 173 { 174 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d, e); 175 } 176}; 177 178/// @copydoc JournaledSignal<void()> 179template<class A, class B, class C, class D, class E, class F> 180class JournaledSignal<void(A,B,C,D,E,F)> : public Signal<void(A,B,C,D,E,F)> 181{ 182 typedef Signal<void(A,B,C,D,E,F)> Parent; 183 184public: 185 JournaledSignal() 186 { 187 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 188 } 189 190 ~JournaledSignal() 191 { 192 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 193 } 194 195 void trigger(A a, B b, C c, D d, E e, F f) 196 { 197 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d, e, f); 198 } 199}; 200 201/// @copydoc JournaledSignal<void()> 202template<class A, class B, class C, class D, class E, class F, class G> 203class JournaledSignal<void(A,B,C,D,E,F,G)> : public Signal<void(A,B,C,D,E,F,G)> 204{ 205 typedef Signal<void(A,B,C,D,E,F,G)> Parent; 206 207public: 208 JournaledSignal() 209 { 210 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 211 } 212 213 ~JournaledSignal() 214 { 215 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 216 } 217 218 void trigger(A a, B b, C c, D d, E e, F f, G g) 219 { 220 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d, e, f, g); 221 } 222}; 223 224/// @copydoc JournaledSignal<void()> 225template<class A, class B, class C, class D, class E, class F, class G, class H> 226class JournaledSignal<void(A,B,C,D,E,F,G,H)> : public Signal<void(A,B,C,D,E,F,G,H)> 227{ 228 typedef Signal<void(A,B,C,D,E,F,G,H)> Parent; 229 230public: 231 JournaledSignal() 232 { 233 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 234 } 235 236 ~JournaledSignal() 237 { 238 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 239 } 240 241 void trigger(A a, B b, C c, D d, E e, F f, G g, H h) 242 { 243 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d, e, f, g, h); 244 } 245}; 246 247/// @copydoc JournaledSignal<void()> 248template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K> 249class JournaledSignal<void(A,B,C,D,E,F,G,H,I,J,K)> : public Signal<void(A,B,C,D,E,F,G,H,I,J,K)> 250{ 251 typedef Signal<void(A,B,C,D,E,F,G,H,I,J,K)> Parent; 252 253public: 254 JournaledSignal() 255 { 256 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 257 } 258 259 ~JournaledSignal() 260 { 261 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 262 } 263 264 void trigger(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) 265 { 266 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d, e, f, g, h, i, j, k); 267 } 268}; 269 270/// @copydoc JournaledSignal<void()> 271template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L> 272class JournaledSignal<void(A,B,C,D,E,F,G,H,I,J,K,L)> : public Signal<void(A,B,C,D,E,F,G,H,I,J,K,L)> 273{ 274 typedef Signal<void(A,B,C,D,E,F,G,H,I,J,K,L)> Parent; 275 276public: 277 JournaledSignal() 278 { 279 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 280 } 281 282 ~JournaledSignal() 283 { 284 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 285 } 286 287 void trigger(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) 288 { 289 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d, e, f, g, h, i, j, k, l); 290 } 291}; 292 293/// @copydoc JournaledSignal<void()> 294template<class A, class B, class C, class D, class E, class F, class G, class H, class I, class J, class K, class L, class M> 295class JournaledSignal<void(A,B,C,D,E,F,G,H,I,J,K,L,M)> : public Signal<void(A,B,C,D,E,F,G,H,I,J,K,L,M)> 296{ 297 typedef Signal<void(A,B,C,D,E,F,G,H,I,J,K,L,M)> Parent; 298 299public: 300 JournaledSignal() 301 { 302 Journal::DeclareFunction((Parent*)this, &Parent::trigger); 303 } 304 305 ~JournaledSignal() 306 { 307 Journal::RemoveFunction((Parent*)this, &Parent::trigger); 308 } 309 310 void trigger(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m) 311 { 312 Journal::Call((Parent*)this, &Parent::trigger, a, b, c, d, e, f, g, h, i, j, k, l, m); 313 } 314}; 315 316 317//----------------------------------------------------------------------------- 318// Common event callbacks definitions 319enum InputModifier { 320 IM_LALT = (1 << 1), 321 IM_RALT = (1 << 2), 322 IM_LSHIFT = (1 << 3), 323 IM_RSHIFT = (1 << 4), 324 IM_LCTRL = (1 << 5), 325 IM_RCTRL = (1 << 6), 326 IM_LOPT = (1 << 7), 327 IM_ROPT = (1 << 8), 328 IM_ALT = IM_LALT | IM_RALT, 329 IM_SHIFT = IM_LSHIFT | IM_RSHIFT, 330 IM_CTRL = IM_LCTRL | IM_RCTRL, 331 IM_OPT = IM_LOPT | IM_ROPT, 332}; 333 334enum InputAction { 335 IA_MAKE = (1 << 0), 336 IA_BREAK = (1 << 1), 337 IA_REPEAT = (1 << 2), 338 IA_MOVE = (1 << 3), 339 IA_DELTA = (1 << 4), 340 IA_BUTTON = (1 << 5), 341}; 342 343enum ApplicationMessage { 344 Quit, 345 WindowOpen, ///< Window opened 346 WindowClose, ///< Window closed. 347 WindowShown, ///< Window has been shown on screen 348 WindowHidden, ///< Window has become hidden 349 WindowDestroy, ///< Window was destroyed. 350 GainCapture, ///< Window will capture all input 351 LoseCapture, ///< Window will no longer capture all input 352 GainFocus, ///< Application gains focus 353 LoseFocus, ///< Application loses focus 354 DisplayChange, ///< Desktop Display mode has changed 355 GainScreen, ///< Window will acquire lock on the full screen 356 LoseScreen, ///< Window has released lock on the full screen 357 Timer, 358}; 359 360typedef U32 WindowId; 361 362/// void event() 363typedef JournaledSignal<void()> IdleEvent; 364 365/// void event(WindowId,U32 modifier,S32 x,S32 y, bool isRelative) 366typedef JournaledSignal<void(WindowId,U32,S32,S32,bool)> MouseEvent; 367 368/// void event(WindowId,U32 modifier,S32 wheelDeltaX, S32 wheelDeltaY) 369typedef JournaledSignal<void(WindowId,U32,S32,S32)> MouseWheelEvent; 370 371/// void event(WindowId,U32 modifier,U32 action,U16 key) 372typedef JournaledSignal<void(WindowId,U32,U32,U16)> KeyEvent; 373 374/// void event(WindowId,U32 modifier,U16 key) 375typedef JournaledSignal<void(WindowId,U32,U16)> CharEvent; 376 377/// void event(WindowId,U32 modifier,U32 action,U16 button) 378typedef JournaledSignal<void(WindowId,U32,U32,U16)> ButtonEvent; 379 380/// void event(WindowId,U32 modifier,U32 action,U32 axis,F32 value) 381typedef JournaledSignal<void(WindowId,U32,U32,U32,F32)> LinearEvent; 382 383/// void event(WindowId,U32 modifier,F32 value) 384typedef JournaledSignal<void(WindowId,U32,F32)> PovEvent; 385 386/// void event(WindowId,InputAppMessage) 387typedef JournaledSignal<void(WindowId,S32)> AppEvent; 388 389/// void event(WindowId) 390typedef JournaledSignal<void(WindowId)> DisplayEvent; 391 392/// void event(WindowId, S32 width, S32 height) 393typedef JournaledSignal<void(WindowId, S32, S32)> ResizeEvent; 394 395/// void event(S32 timeDelta) 396typedef JournaledSignal<void(S32)> TimeManagerEvent; 397 398// void event(U32 deviceInst, F32 fValue, F32 fValue2, F32 fValue3, F32 fValue4, S32 iValue, U16 deviceType, U16 objType, U16 ascii, U16 objInst, U8 action, U8 modifier) 399typedef JournaledSignal<void(U32,F32,F32,F32,F32,S32,U16,U16,U16,U16,U8,U8)> InputEvent; 400 401/// void event(U32 popupGUID, U32 commandID, bool& returnValue) 402typedef JournaledSignal<void(U32, U32)> PopupMenuEvent; 403 404#endif 405