Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
9.5 KiB

  1. //=========== Copyright Valve Corporation, All rights reserved. ===============//
  2. //
  3. // Purpose:
  4. //=============================================================================//
  5. #ifndef UIEVENTS_H
  6. #define UIEVENTS_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "uievent.h"
  11. #include "uieventcodes.h"
  12. #include "layout/stylesymbol.h"
  13. #include "localization/ilocalize.h"
  14. class IVideoPlayer;
  15. namespace panorama
  16. {
  17. // general panel events
  18. DECLARE_PANEL_EVENT1( AddStyle, const char * );
  19. DECLARE_PANEL_EVENT1( RemoveStyle, const char * );
  20. DECLARE_PANEL_EVENT1( ToggleStyle, const char * );
  21. DECLARE_PANEL_EVENT1( AddStyleToEachChild, const char * );
  22. DECLARE_PANEL_EVENT1( RemoveStyleFromEachChild, const char * );
  23. DECLARE_PANEL_EVENT0( PanelLoaded );
  24. DECLARE_PANEL_EVENT0( CheckChildrenScrolledIntoView );
  25. DECLARE_PANEL_EVENT2( ScrollPanelIntoView, ScrollBehavior_t, bool );
  26. DECLARE_PANEL_EVENT0( ScrolledIntoView );
  27. DECLARE_PANEL_EVENT0( ScrolledOutOfView );
  28. DECLARE_PANEL_EVENT2( LoadLayoutFileAsync, const char *, bool );
  29. DECLARE_PANEL_EVENT1( AppendChildrenFromLayoutFileAsync, const char * );
  30. DECLARE_PANEL_EVENT2( LoadLayoutFromXMLStringAsync, const char *, bool );
  31. DECLARE_PANEL_EVENT2( LoadLayoutFromBase64XMLStringAsync, const char *, bool );
  32. DECLARE_PANEL_EVENT1( Activated, EPanelEventSource_t );
  33. DECLARE_PANEL_EVENT1( Cancelled, EPanelEventSource_t );
  34. DECLARE_PANEL_EVENT1( ContextMenu, EPanelEventSource_t );
  35. DECLARE_PANEL_EVENT1( LocalizationChanged, const ILocalizationString * );
  36. DECLARE_PANEL_EVENT0( InputFocusSet );
  37. DECLARE_PANEL_EVENT0( InputFocusLost );
  38. DECLARE_PANORAMA_EVENT1( InputFocusTopLevelChanged, CPanelPtr< CPanel2D > );
  39. DECLARE_PANEL_EVENT0( SetInputFocus );
  40. DECLARE_PANEL_EVENT0( ShowTooltip );
  41. DECLARE_PANEL_EVENT0( StyleFlagsChanged );
  42. DECLARE_PANEL_EVENT0( StyleClassesChanged );
  43. DECLARE_PANEL_EVENT0( PanelStyleChanged );
  44. DECLARE_PANEL_EVENT1( AnimationStart, CPanoramaSymbol );
  45. DECLARE_PANEL_EVENT1( AnimationEnd, CPanoramaSymbol );
  46. DECLARE_PANEL_EVENT1( PropertyTransitionEnd, CStyleSymbol );
  47. DECLARE_PANEL_EVENT1( CopyStringToClipboard, const char * );
  48. DECLARE_PANEL_EVENT1( SetAllChildrenActivationEnabled, bool );
  49. DECLARE_PANEL_EVENT2( SetPanelEvent, const char *, const char * );
  50. DECLARE_PANEL_EVENT1( ClearPanelEvent, const char * );
  51. DECLARE_PANEL_EVENT2( IfHasClassEvent, const char *, IUIEvent * );
  52. DECLARE_PANEL_EVENT2( IfNotHasClassEvent, const char *, IUIEvent * );
  53. DECLARE_PANEL_EVENT2( IfHoverOtherEvent, const char *, IUIEvent * );
  54. DECLARE_PANEL_EVENT2( IfNotHoverOtherEvent, const char *, IUIEvent * );
  55. DECLARE_PANEL_EVENT0( ScrollToTop );
  56. DECLARE_PANEL_EVENT0( ScrollToBottom );
  57. DECLARE_PANEL_EVENT3( LoadAsyncComplete, bool, ELoadLayoutAsyncDetails, bool );
  58. DECLARE_PANEL_EVENT1( SetPanelSelected, bool );
  59. DECLARE_PANEL_EVENT0( ResetToDefaultValue );
  60. DECLARE_PANEL_EVENT0( TogglePanelSelected );
  61. DECLARE_PANEL_EVENT1( SetChildPanelsSelected, bool );
  62. DECLARE_PANEL_EVENT0( ScrollPanelLeft );
  63. DECLARE_PANEL_EVENT0( ScrollPanelRight );
  64. DECLARE_PANEL_EVENT0( ScrollPanelUp );
  65. DECLARE_PANEL_EVENT0( ScrollPanelDown );
  66. DECLARE_PANEL_EVENT0( PagePanelLeft );
  67. DECLARE_PANEL_EVENT0( PagePanelRight );
  68. DECLARE_PANEL_EVENT0( PagePanelUp );
  69. DECLARE_PANEL_EVENT0( PagePanelDown );
  70. DECLARE_PANEL_EVENT1( DropdownMenuFocusChanged, CPanelPtr< IUIPanel > );
  71. // window events
  72. class CTopLevelWindow;
  73. DECLARE_PANORAMA_EVENT1( WindowGotFocus, IUIWindow * );
  74. DECLARE_PANORAMA_EVENT1( WindowLostFocus, IUIWindow * );
  75. DECLARE_PANORAMA_EVENT1( WindowCursorShown, IUIWindow * );
  76. DECLARE_PANORAMA_EVENT1( WindowCursorHidden, IUIWindow * );
  77. DECLARE_PANORAMA_EVENT1( WindowShown, IUIWindow * );
  78. DECLARE_PANORAMA_EVENT1( WindowHidden, IUIWindow * );
  79. DECLARE_PANORAMA_EVENT1( WindowOffScreen, IUIWindow * );
  80. DECLARE_PANORAMA_EVENT1( WindowOnScreen, IUIWindow * );
  81. // global events
  82. DECLARE_PANORAMA_EVENT0( QuitApp );
  83. DECLARE_PANORAMA_EVENT0( ExitSteam );
  84. DECLARE_PANORAMA_EVENT0( ShutdownMachine );
  85. DECLARE_PANORAMA_EVENT0( RestartMachine );
  86. DECLARE_PANORAMA_EVENT0( SuspendMachine );
  87. DECLARE_PANORAMA_EVENT0( TurnOffActiveController );
  88. DECLARE_PANORAMA_EVENT0( GoOffline );
  89. DECLARE_PANORAMA_EVENT0( GoOnline );
  90. DECLARE_PANORAMA_EVENT0( ShowQuitDialog );
  91. DECLARE_PANORAMA_EVENT0( ChangeUser );
  92. DECLARE_PANORAMA_EVENT0( ToggleDebugger );
  93. DECLARE_PANORAMA_EVENT0( ShowPanelZoo );
  94. DECLARE_PANORAMA_EVENT0( DumpMemory );
  95. DECLARE_PANORAMA_EVENT0( ProfileOn );
  96. DECLARE_PANORAMA_EVENT0( ProfileOff );
  97. DECLARE_PANORAMA_EVENT0( ToggleConsole );
  98. DECLARE_PANORAMA_EVENT0( Refresh );
  99. DECLARE_PANORAMA_EVENT1( MoveUp, int );
  100. DECLARE_PANORAMA_EVENT1( MoveDown, int );
  101. DECLARE_PANORAMA_EVENT1( MoveLeft, int );
  102. DECLARE_PANORAMA_EVENT1( MoveRight, int );
  103. DECLARE_PANORAMA_EVENT0( ScrollUp );
  104. DECLARE_PANORAMA_EVENT0( ScrollDown );
  105. DECLARE_PANORAMA_EVENT0( ScrollLeft );
  106. DECLARE_PANORAMA_EVENT0( ScrollRight );
  107. DECLARE_PANORAMA_EVENT0( PageUp );
  108. DECLARE_PANORAMA_EVENT0( PageDown );
  109. DECLARE_PANORAMA_EVENT0( PageLeft );
  110. DECLARE_PANORAMA_EVENT0( PageRight );
  111. DECLARE_PANORAMA_EVENT1( TabForward, int );
  112. DECLARE_PANORAMA_EVENT1( TabBackward, int );
  113. DECLARE_PANORAMA_EVENT0( GamepadInserted );
  114. DECLARE_PANORAMA_EVENT0( GamepadRemoved );
  115. DECLARE_PANORAMA_EVENT1( ReloadStyleFile, CPanoramaSymbol );
  116. DECLARE_PANORAMA_EVENT1( TopLevelWindowClose, IUIWindow* ); // fired when top level window is destructing while all children are still valid
  117. DECLARE_PANORAMA_EVENT1( TopLevelWindowClosed, IUIWindow* ); // fired after top level window has already destroyed all children
  118. DECLARE_PANORAMA_EVENT0( GamepadInput );
  119. DECLARE_PANEL_EVENT0( DeletePanel );
  120. DECLARE_PANORAMA_EVENT0( ActivateMainWindow );
  121. DECLARE_PANORAMA_EVENT2( ToggleFullscreen, IUIWindow*, bool );
  122. DECLARE_PANORAMA_EVENT0( GuideButton );
  123. DECLARE_PANORAMA_EVENT0( GuideButtonUp );
  124. DECLARE_PANORAMA_EVENT2( SoundFinished, const char *, HAUDIOSAMPLE );
  125. DECLARE_PANORAMA_EVENT0( None ); // short circuited in the bind code not to fire an event
  126. DECLARE_PANORAMA_EVENT1( ExecuteSteamURL, const char * );
  127. DECLARE_PANORAMA_EVENT0( UserInputActive );
  128. DECLARE_PANORAMA_EVENT1( AsyncPanoramaQuitWithError, const char * );
  129. DECLARE_PANORAMA_EVENT0( GameControllerMappingChanged );
  130. DECLARE_PANORAMA_EVENT0( StopStreaming );
  131. DECLARE_PANORAMA_EVENT0( CloseModalDialog );
  132. DECLARE_PANORAMA_EVENT2( SoundVolumeChanged, ESoundType, float );
  133. DECLARE_PANORAMA_EVENT1( SoundMuteChanged, bool );
  134. DECLARE_PANORAMA_EVENT1( ActiveControllerTypeChanged, EActiveControllerType );
  135. void OnActiveControllerTypeChangedDefaultHandler( IUIPanel *pPanel, EActiveControllerType eActiveControllerType );
  136. DECLARE_PANORAMA_EVENT0( MediaVolumeMute );
  137. DECLARE_PANORAMA_EVENT0( MediaVolumeDown );
  138. DECLARE_PANORAMA_EVENT0( MediaVolumeUp );
  139. DECLARE_PANORAMA_EVENT0( MediaNextTrack );
  140. DECLARE_PANORAMA_EVENT0( MediaPrevTrack );
  141. DECLARE_PANORAMA_EVENT0( MediaStop );
  142. DECLARE_PANORAMA_EVENT0( MediaPlayPause );
  143. DECLARE_PANORAMA_EVENT0( SteamPadRightHighActivity );
  144. DECLARE_PANORAMA_EVENT2( JSConsoleOutput, CPanelPtr< CPanel2D >, const char * );
  145. // Not necessarily universal but shared across multiple panels
  146. DECLARE_PANORAMA_EVENT0( RemoveUser );
  147. DECLARE_PANEL_EVENT0( PollingForSteamClientUpdate );
  148. DECLARE_PANORAMA_EVENT0( SettingsPanelShown );
  149. // Event to wrap any other event up async
  150. DECLARE_PANORAMA_EVENT2( AsyncEvent, float, IUIEvent * );
  151. // Request from some UI to show a URL in the systems browser, may be hooked and handled differently in different applications, not handled by default in panorama itself
  152. DECLARE_PANEL_EVENT1( BrowserGoToURL, const char * );
  153. DECLARE_PANORAMA_EVENT0( AsyncPanoramaSurfaceLost ); // 3d surface detected that its output became unavailable, currently fired by Linux on VTT switch
  154. DECLARE_PANORAMA_EVENT0( AsyncPanoramaSurfaceReturned ); // 3d surface detected that its previously lost surface is now renderable again but will need a full reload
  155. // When text input handler is coming up or down, bool = true when showing, = false for hiding
  156. DECLARE_PANEL_EVENT1( TextInputHandlerStateChange, bool );
  157. // InMemoryFileUpdate event params:
  158. // 1 - symbol of file that changed
  159. // 2 - location in file that changed
  160. // 3 - old size
  161. // 4 - new size
  162. DECLARE_PANORAMA_EVENT4( InMemoryFileUpdate, CPanoramaSymbol, uint, uint, uint );
  163. DECLARE_PANORAMA_EVENT0( InMemoryFilesSaved );
  164. // video player events
  165. DECLARE_PANORAMA_EVENT1( VideoPlayerInitalized, IVideoPlayer* );
  166. DECLARE_PANORAMA_EVENT1( VideoPlayerRepeated, IVideoPlayer* );
  167. DECLARE_PANORAMA_EVENT1( VideoPlayerEnded, IVideoPlayer* );
  168. DECLARE_PANORAMA_EVENT1( VideoPlayerPlaybackStateChange, IVideoPlayer* );
  169. DECLARE_PANORAMA_EVENT1( VideoPlayerChangedRepresentation, IVideoPlayer* );
  170. DECLARE_PANORAMA_EVENT2( OverlayGamepadInputMsg, panorama::IUIWindow *, InputMessage_t * )
  171. // debugger events
  172. DECLARE_PANORAMA_EVENT0( CreateDebuggerWindow );
  173. DECLARE_PANORAMA_EVENT0( CloseDebuggerWindow );
  174. DECLARE_PANORAMA_EVENT0( BeginDebuggerInspect );
  175. DECLARE_PANEL_EVENT2( JSONWebAPIResponse, KeyValues *, void * );
  176. // panel drag events
  177. DECLARE_PANEL_EVENT1( DragStart, IUIPanel** ); // first event for drag sent to panel user started dragging on (must be marked with draggable="true")
  178. DECLARE_PANEL_EVENT1( DragEnter, panorama::CPanelPtr< panorama::IUIPanel > ); // sent to panel drag is hovering over
  179. DECLARE_PANEL_EVENT1( DragDrop, panorama::CPanelPtr< panorama::IUIPanel > ); // sent to panel where user released mouse while dragging
  180. DECLARE_PANEL_EVENT1( DragLeave, panorama::CPanelPtr< panorama::IUIPanel > ); // sent to panel drag stopped hovering over
  181. DECLARE_PANEL_EVENT1( DragEnd, panorama::CPanelPtr< panorama::IUIPanel > ); // sent to panel which received DragStart after Drop event was sent
  182. } // namespace panorama
  183. #endif // UIEVENTS_H