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.

578 lines
24 KiB

  1. //=========== Copyright Valve Corporation, All rights reserved. ===============//
  2. //
  3. // Purpose:
  4. //=============================================================================//
  5. #ifndef IUIPANEL_H
  6. #define IUIPANEL_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "panoramatypes.h"
  11. #include "panoramasymbol.h"
  12. #include "iuirenderengine.h"
  13. #include "layout/stylefiletypes.h"
  14. #include "layout/uilength.h"
  15. #include "tier1/utlstring.h"
  16. namespace panorama
  17. {
  18. class CLayoutFile;
  19. class IUIPanelStyle;
  20. class IUIPanelClient;
  21. class IUIWindow;
  22. class IUIImageManager;
  23. class IUI3DSurface;
  24. class IUIEvent;
  25. class IUIScrollBar;
  26. typedef panorama::IUIPanelClient * ClientPanelPtr_t;
  27. typedef CUtlVector< panorama::IUIEvent * > VecUIEvents_t;
  28. //-----------------------------------------------------------------------------
  29. // Purpose: Used to provide property info to debugger for output
  30. //-----------------------------------------------------------------------------
  31. struct DebugPropertyOutput_t
  32. {
  33. DebugPropertyOutput_t() {}
  34. DebugPropertyOutput_t( const char *pchName, const char *pchValue ) : m_strName( pchName ), m_strValue( pchValue ) {}
  35. CUtlString m_strName;
  36. CUtlString m_strValue;
  37. };
  38. enum ScrollBehavior_t
  39. {
  40. SCROLL_BEHAVIOR_SCROLL_MINIMUM_DISTANCE = 0,
  41. SCROLL_BEHAVIOR_SCROLL_TO_TOPLEFT_EDGE,
  42. SCROLL_BEHAVIOR_SCROLL_TO_BOTTOMRIGHT_EDGE,
  43. SCROLL_BEHAVIOR_SCROLL_TO_CENTER,
  44. SCROLL_BEHAVIOR_DEFAULT = SCROLL_BEHAVIOR_SCROLL_MINIMUM_DISTANCE,
  45. };
  46. //-----------------------------------------------------------------------------
  47. // Purpose: Basic panel interface exposing operations used inside of panorama, rather
  48. // than operations that are part of building/laying out controls in the panorama_client module
  49. //-----------------------------------------------------------------------------
  50. class IUIPanel
  51. {
  52. public:
  53. virtual ~IUIPanel() {}
  54. // Initialize panel
  55. virtual void Initialize( IUIWindow *window, IUIPanel *parent, const char *pchID, uint32 ePanelFlags ) = 0;
  56. // Initialize a cloned panel from ourself
  57. virtual void InitClonedPanel( IUIPanel *pClone ) = 0;
  58. // Do panel2d event type registrations
  59. virtual void RegisterEventHandlersOnPanel2DType( CPanoramaSymbol symPanelType ) = 0;
  60. // Shutdown panel, should only happen right before actual deletion
  61. virtual void Shutdown() = 0;
  62. // Fire panel loaded event and mark us as now loaded, images and other panels may call this late
  63. virtual void FirePanelLoadedEvent() = 0;
  64. // Gets client type pointer value
  65. virtual void SetClientPtr( panorama::IUIPanelClient *pPtr ) = 0;
  66. virtual panorama::IUIPanelClient * ClientPtr() const = 0;
  67. // Set panel id
  68. virtual void SetID( const char *pchID ) = 0;
  69. // Get panel id
  70. virtual const char *GetID() const = 0;
  71. // Get panel type, which really calls back into client panel object
  72. virtual CPanoramaSymbol GetPanelType() const = 0;
  73. // Check for valid panel id
  74. virtual bool BHasID() const = 0;
  75. // sets & loads the layout file for this panel
  76. virtual bool BLoadLayout( const char *pchFile, bool bOverrideExisting = false, bool bPartialLayout = false ) = 0;
  77. // sets & loads the layout for this panel
  78. virtual bool BLoadLayoutFromString( const char *pchXMLString, bool bOverrideExisting = false, bool bPartialLayout = false ) = 0;
  79. // sets loads the layout file for this panel, asynchronously supporting remote http:// paths
  80. virtual void LoadLayoutAsync( const char *pchFile, bool bOverrideExisting = false, bool bPartialLayout = false ) = 0;
  81. // loads the layout file for this panel, asynchronously supporting remote http:// paths in css within
  82. virtual void LoadLayoutFromStringAsync( const char *pchXMLString, bool bOverrideExisting, bool bPartialLayout = false ) = 0;
  83. // Check if the panel has loaded layout
  84. virtual bool IsLoaded() const = 0;
  85. // Set panel's immediate parent
  86. virtual void SetParent( panorama::IUIPanel *pParent ) = 0;
  87. // Get panel's immediate parent
  88. virtual panorama::IUIPanel *GetParent() const = 0;
  89. // Get panel's parent window
  90. virtual panorama::IUIWindow *GetParentWindow() const = 0;
  91. // Set panel visibility
  92. virtual void SetVisible( bool bVisible ) = 0;
  93. // Is the panel visible (not accounting for opacity)
  94. virtual bool BIsVisible() const = 0;
  95. // Is the panel transparent (may be 'visible' and affect layout, but fully transparent)
  96. virtual bool BIsTransparent() const = 0;
  97. // Set the layout file this panel is loaded from based on a parent, shouldn't need this directly normally
  98. virtual void SetLayoutLoadedFromParent( panorama::IUIPanel *pParent ) = 0;
  99. // Returns the layout file for this panel (ie, the one it loaded if any)
  100. virtual panorama::CPanoramaSymbol GetLayoutFile() const = 0;
  101. // Returns layout file that loaded us which may have been loaded by an ancestor rather than direct parent
  102. virtual panorama::CPanoramaSymbol GetLayoutFileLoadedFrom() const = 0;
  103. // Get the current reload count for the panel's layout file - can be used to detect when a reload has occurred
  104. // Returns -1 if no layout file.
  105. virtual int GetLayoutFileReloadCount() const = 0;
  106. // searches only immediate children
  107. virtual panorama::IUIPanel *FindChild( const char *pchID ) = 0;
  108. // searches all children even outside layout file scope
  109. virtual panorama::IUIPanel *FindChildTraverse( const char *pchID ) = 0;
  110. // searches any children created from our layout file
  111. virtual IUIPanel *FindChildInLayoutFile( const char *pchID ) = 0;
  112. // searches any panel created from our layout file (so parents or children!)
  113. virtual IUIPanel *FindPanelInLayoutFile( const char *pchID ) = 0;
  114. // Check if this panel is a descendant of the passed panel
  115. virtual bool IsDescendantOf( const panorama::IUIPanel *pPanel ) const = 0;
  116. // Remove and delete all children from panel
  117. virtual void RemoveAndDeleteChildren() = 0;
  118. // Remove and delete all children matching type
  119. virtual void RemoveAndDeleteChildrenOfType( CPanoramaSymbol symPanelType ) = 0;
  120. // Child access
  121. virtual int GetChildCount() const = 0;
  122. virtual IUIPanel *GetChild( int i ) const = 0;
  123. virtual IUIPanel *GetFirstChild() const = 0;
  124. virtual IUIPanel *GetLastChild() const = 0;
  125. // Return index of child in creation/panel vector order (also default tab order)
  126. virtual int GetChildIndex( const IUIPanel *pChild ) const = 0;
  127. // Get child count of specific type
  128. virtual uint32 GetChildCountOfType( CPanoramaSymbol symPanelType ) = 0;
  129. // For special children to be rendered in debugger
  130. virtual int GetHiddenChildCount() const = 0;
  131. virtual IUIPanel *GetHiddenChild( int i ) = 0;
  132. // Find ancestor with matching id
  133. virtual IUIPanel *FindAncestor( const char *pchID ) = 0;
  134. // Set the panels repaint state
  135. virtual void SetRepaint( panorama::EPanelRepaint eRepaintNeeded ) = 0;
  136. // Check if we should draw this child
  137. virtual bool BShouldDrawChild( panorama::IUIPanel *pChild ) = 0;
  138. // Apply layout file to panel
  139. virtual bool BAppyLayoutFile( panorama::CLayoutFile *pLayoutFile, CUtlVector< panorama::IUIPanel * > *pvecExistingPanels ) = 0;
  140. // Enable or disable background movies on panel
  141. virtual void EnableBackgroundMovies( bool bEnabled ) = 0;
  142. // Access panel's style information
  143. virtual panorama::IUIPanelStyle * AccessIUIStyle() = 0;
  144. // Returns potentially dirty styles data, use for setting during initial construction/setup - or if you want to explicitly ignore transitions, but never for getting and generally not for setting!
  145. virtual panorama::IUIPanelStyle *AccessIUIStyleDirty() = 0;
  146. // Apply styles on the panel, resolving them all fully and updating actual panel style
  147. virtual void ApplyStyles( bool bTraverse ) = 0;
  148. // Set that we want an on styles changed event when styles are applied even if styles aren't actually dirty
  149. virtual void SetOnStylesChangedNeeded() = 0;
  150. // Access all children directly
  151. virtual CUtlVector<panorama::IUIPanel *> const &AccessChildren() = 0;
  152. // Measure self and children. First pass of layout
  153. virtual void DesiredLayoutSizeTraverse( float flMaxWidth, float flMaxHeight ) = 0;
  154. virtual void DesiredLayoutSizeTraverse( float *pflDesiredWidth, float *pflDesiredHeight, float flMaxWidth, float flMaxHeight, bool bFinalDimensions ) = 0;
  155. // Tell us what your content size is
  156. virtual void OnContentSizeTraverse( float *pflContentWidth, float *pflContentHeight, float flMaxWidth, float flMaxHeight, bool bFinalDimensions ) = 0;
  157. // Arrange children. Second pass of layout
  158. virtual void LayoutTraverse( float x, float y, float flFinalWidth, float flFinalHeight ) = 0;
  159. // Tell us how to actually layout children
  160. virtual void OnLayoutTraverse( float flFinalWidth, float flFinalHeight ) = 0;
  161. // called by flowing and custom layout passes to set position. Will properly handle transition being applied with styles
  162. virtual void SetPositionFromLayoutTraverse( CUILength x, CUILength y, CUILength z ) = 0;
  163. // methods to invalid certain parts of layout
  164. virtual void InvalidateSizeAndPosition() = 0;
  165. virtual void InvalidatePosition() = 0;
  166. virtual void SetActiveSizeAndPositionTransition() = 0;
  167. virtual void SetActivePositionTransition() = 0;
  168. virtual bool IsSizeValid() = 0;
  169. virtual bool IsPositionValid() = 0;
  170. virtual bool IsChildSizeValid() = 0;
  171. virtual bool IsChildPositionValid() = 0;
  172. virtual bool IsSizeTransitioning() = 0;
  173. virtual bool IsPositionTransitioning() = 0;
  174. virtual bool IsChildPositionTransitioning() = 0;
  175. virtual bool IsChildSizeTransitioning() = 0;
  176. virtual void TransitionPositionApplied( bool bImmediate ) = 0;
  177. // size getters
  178. virtual float GetDesiredLayoutWidth() const = 0;
  179. virtual float GetDesiredLayoutHeight() const = 0;
  180. // Content size is what our contents actually take up, not accounting for fixed/relative
  181. // size set on us in styles which affect desired layout size
  182. virtual float GetContentWidth() const = 0;
  183. virtual float GetContentHeight() const = 0;
  184. // Actual size is the size given to the panel after layout, hopefully as big as its desired size.
  185. // Actual size does NOT include margins (which are really in the parent).
  186. virtual float GetActualLayoutWidth() const = 0;
  187. virtual float GetActualLayoutHeight() const = 0;
  188. // Render size is the size of the content for rendering, this is either the actual layout size, or if
  189. // that is smaller than the content size + padding then it's the content size + padding.
  190. virtual float GetActualRenderWidth() = 0;
  191. virtual float GetActualRenderHeight() = 0;
  192. // Offset will include position, alignment, and margin adjustments
  193. virtual float GetActualXOffset() const = 0;
  194. virtual float GetActualYOffset() const = 0;
  195. // returns offset for drawing minus position
  196. virtual float GetRawActualXOffset() const = 0;
  197. virtual float GetRawActualYOffset() const = 0;
  198. // Offset to apply to contents for scrolling
  199. virtual float GetContentsYScrollOffset() const = 0;
  200. virtual float GetContentsXScrollOffset() const = 0;
  201. virtual float GetContentsYScrollOffsetTarget() const = 0;
  202. virtual float GetContentsXScrollOffsetTarget() const = 0;
  203. virtual double GetContentsXScrollTransitionStart() const = 0;
  204. virtual double GetContentsYScrollTransitionStart() const = 0;
  205. virtual float GetInterpolatedXScrollOffset() = 0;
  206. virtual float GetInterpolatedYScrollOffset() = 0;
  207. // Can the panel scroll further?
  208. virtual bool BCanScrollUp() = 0;
  209. virtual bool BCanScrollDown() = 0;
  210. virtual bool BCanScrollLeft() = 0;
  211. virtual bool BCanScrollRight() = 0;
  212. // style class management
  213. virtual void AddClass( const char *pchName ) = 0;
  214. virtual void AddClass( CPanoramaSymbol symbol ) = 0;
  215. virtual void AddClasses( const char *pchName ) = 0;
  216. virtual void AddClasses( CPanoramaSymbol *pSymbols, uint cSymbols ) = 0;
  217. virtual void RemoveClass( const char *pchName ) = 0;
  218. virtual void RemoveClass( CPanoramaSymbol symName ) = 0;
  219. virtual void RemoveClasses( const CPanoramaSymbol *pSymbols, uint cSymbols ) = 0;
  220. virtual void RemoveClasses( const char *pchName ) = 0;
  221. virtual void RemoveAllClasses() = 0;
  222. virtual const CUtlVector< CPanoramaSymbol > &GetClasses() const = 0;
  223. virtual bool BHasClass( const char *pchName ) = 0;
  224. virtual bool BHasClass( CPanoramaSymbol symName ) = 0;
  225. virtual bool BAscendantHasClass( const char *pchName ) = 0;
  226. virtual bool BAscendantHasClass( CPanoramaSymbol symName ) = 0;
  227. virtual void ToggleClass( const char *pchName ) = 0;
  228. virtual void ToggleClass( CPanoramaSymbol symName ) = 0;
  229. virtual void SetHasClass( const char *pchName, bool bHasClass ) = 0;
  230. virtual void SetHasClass( CPanoramaSymbol symName, bool bHasClass ) = 0;
  231. virtual void SwitchClass( const char *pchAttribute, const char *pchName ) = 0;
  232. virtual void SwitchClass( const char *pchAttribute, CPanoramaSymbol symName ) = 0;
  233. virtual bool BAcceptsInput() = 0;
  234. virtual void SetAcceptsInput( bool bAllowInput ) = 0;
  235. virtual bool BAcceptsFocus() const = 0;
  236. virtual void SetAcceptsFocus( bool bAllowFocus ) = 0;
  237. // true if it would normally sink input, but may not right now if disabled
  238. virtual bool BCanAcceptInput() = 0;
  239. virtual void SetDefaultFocus( const char *pchChildID ) = 0;
  240. virtual const char *GetDefaultFocus() const = 0;
  241. virtual void SetDisableFocusOnMouseDown( bool bDisable ) = 0;
  242. virtual bool BFocusOnMouseDown() = 0;
  243. // Should this panel be the top of an input hierarchy and keep track of focus within itself, not losing focus when a panel in some
  244. // other hierarchy changes focus? Use this for panels that are peers like friends vs browser vs mainmenu in tenfoot
  245. virtual bool BTopOfInputContext() = 0;
  246. virtual void SetTopOfInputContext( bool bIsTopOfInputContext ) = 0;
  247. virtual IUIPanel *GetParentInputContext() = 0;
  248. // Get the default input focus child within this panel, may be null
  249. virtual IUIPanel *GetDefaultInputFocus() = 0;
  250. // Set focus to this panel, which will auto-scroll it into full view as well if parent has overflow: scroll
  251. virtual bool SetFocus() = 0;
  252. // Set the focus to this panel in it's input context, but do not make the context change if some other context currently
  253. // has focus
  254. virtual bool UpdateFocusInContext() = 0;
  255. // Set the focus in response to receiving hover (on panels that a parent sets childfocusonhover), this will
  256. // never scroll the parent.
  257. virtual bool SetFocusDueToHover() = 0;
  258. virtual void SetInputContextFocus() = 0;
  259. // retrieve the style flags (map to CSS psuedo-classes) for this panel
  260. virtual uint GetStyleFlags() const = 0;
  261. virtual void AddStyleFlag( EStyleFlags eStyleFlag ) = 0;
  262. virtual void RemoveStyleFlag( EStyleFlags eStyleFlag ) = 0;
  263. virtual bool IsInspected() const = 0;
  264. virtual bool BHasHoverStyle() const = 0;
  265. virtual void SetSelected( bool bSelected ) = 0;
  266. virtual bool IsSelected() const = 0;
  267. virtual bool BHasKeyFocus() const = 0;
  268. virtual bool BHasDescendantKeyFocus() const = 0;
  269. virtual bool IsLayoutLoading() const = 0;
  270. // enable/disable
  271. virtual void SetEnabled( bool bEnabled ) = 0;
  272. virtual bool IsEnabled() const = 0;
  273. virtual bool IsActivationEnabled() = 0;
  274. // Set activation disabled on this panel, input/focus still generally work, but Activate events won't be handled, useful to prevent a button
  275. // being clicked when out of focus, but leave it able to be focused for later activation or such
  276. virtual void SetActivationEnabled( bool bEnabled ) = 0;
  277. // Set all our immediate children enabled/disabled
  278. virtual void SetAllChildrenActivationEnabled( bool bEnabled ) = 0;
  279. // Enable/disable hit testing of this panel, you may want a parent that is never hit test that has a large region, but clicks
  280. // just pass through to other things behind it. Children may still hit test.
  281. virtual void SetHitTestEnabled( bool bEnabled ) = 0;
  282. virtual bool BHitTestEnabled() const = 0;
  283. virtual void SetHitTestEnabledTraverse( bool bEnabled ) = 0;
  284. // drag/drop
  285. virtual void SetDraggable( bool bEnabled ) = 0;
  286. virtual bool IsDraggable() const = 0;
  287. // the input namespace to use for this panel
  288. virtual const char *GetInputNamespace() const = 0;
  289. virtual void SetInputNamespace( const char *pchNamespace ) = 0;
  290. // Mark styles dirty for the panel
  291. virtual void MarkStylesDirty( bool bIncludeChildren ) = 0;
  292. // Check if styles are dirty for the panel
  293. virtual bool BStylesDirty() const = 0;
  294. // Check if styles are possibly dirty for any of our children
  295. virtual bool BChildStylesDirty() = 0;
  296. // Parse panel event for this panel
  297. virtual bool BParsePanelEvent( CPanoramaSymbol symPanelEvent, const char *pchValue ) = 0;
  298. // Check if panel event is set on panel for event type
  299. virtual bool BIsPanelEventSet( CPanoramaSymbol symPanelEvent ) = 0;
  300. // Check if the event is a valid panel event type
  301. virtual bool BIsPanelEvent( CPanoramaSymbol symPanelEvent ) const = 0;
  302. // Dispatch the panel event if the panel has something set for it now
  303. virtual bool DispatchPanelEvent( CPanoramaSymbol symPanelEvent ) = 0;
  304. // Get the containing panel for this panels javascript context
  305. virtual panorama::IUIPanel *GetJavaScriptContextParent() const = 0;
  306. // Accessor for appropriate image manager for panel
  307. virtual panorama::IUIImageManager* UIImageManager() = 0;
  308. // Accessor for appropriate 3d surface interface for this panel
  309. virtual panorama::IUIRenderEngine *UIRenderEngine() = 0;
  310. // Explicit call to paint the panel and all it's children, normally called internally by window
  311. virtual void PaintTraverse() = 0;
  312. // Tab index setting
  313. virtual void SetTabIndex( float flTabIndex ) = 0;
  314. virtual float GetTabIndex() const = 0;
  315. virtual void SetSelectionPosition( float flXPos, float flYPos ) = 0;
  316. virtual void SetSelectionPositionX( float flXPos ) = 0;
  317. virtual void SetSelectionPositionY( float flYPos ) = 0;
  318. virtual float GetSelectionPositionX() const = 0;
  319. virtual float GetSelectionPositionY() const = 0;
  320. // Tab index and selection position backing values rather than interpreted (ie. will return k_flSelectionPosAuto rather than the auto-calculated value)
  321. virtual float GetTabIndex_Raw() const = 0;
  322. virtual float GetSelectionPositionX_Raw() const = 0;
  323. virtual float GetSelectionPositionY_Raw() const = 0;
  324. // Tell the panel to set focus to the next panel in specified movement/order method
  325. virtual bool SetFocusToNextPanel( int nRepeats, EFocusMoveDirection moveType, bool bAllowWrap, float flTabIndexCurrent, float flXPosCurrent, float flYPosCurrent, float flXStart, float flYStart ) = 0;
  326. virtual bool SetInputFocusToFirstOrLastChildInFocusOrder( EFocusMoveDirection moveType, float flXStart, float flYStart ) = 0;
  327. // Is this panel a selection pos repeat boundary?
  328. virtual bool BSelectionPosVerticalBoundary() = 0;
  329. virtual bool BSelectionPosHorizontalBoundary() = 0;
  330. // controls if clicking on an unfocused panel should set focus
  331. virtual void SetChildFocusOnHover( bool bEnable ) = 0;
  332. virtual bool GetChildFocusOnHover() = 0;
  333. // Panel scrolling
  334. virtual void ScrollToTop() = 0;
  335. virtual void ScrollToBottom() = 0;
  336. virtual void ScrollToLeftEdge() = 0;
  337. virtual void ScrollToRightEdge() = 0;
  338. virtual void ScrollParentToMakePanelFit( ScrollBehavior_t behavior = SCROLL_BEHAVIOR_DEFAULT, bool bImmediateScroll = false ) = 0;
  339. virtual void ScrollToFitRegion( float x0, float x1, float y0, float y1, ScrollBehavior_t behavior = SCROLL_BEHAVIOR_DEFAULT, bool bDirectParentScrollOnly = false, bool bImmediateScroll = false ) = 0;
  340. virtual bool BCanSeeInParentScroll() = 0;
  341. virtual void OnScrollPositionChanged() = 0;
  342. virtual void SetSendChildScrolledIntoViewEvents( bool bSendChildReadyEvents ) = 0; // this must be enabled on your parent for ScrolledIntoView events to fire and IsScrolledIntoView state to be set
  343. virtual bool OnCheckChildrenScrolledIntoView() = 0;
  344. virtual void FireScrolledIntoViewEvent() = 0;
  345. virtual void FireScrolledOutOfViewEvent() = 0;
  346. virtual bool IsScrolledIntoView() const = 0;
  347. // Direct child management
  348. virtual void SortChildren( int( __cdecl *pfnCompare )(const ClientPanelPtr_t *, const ClientPanelPtr_t *) ) = 0;
  349. // child management, use with caution! normally always managed internally.
  350. virtual void AddChild( IUIPanel *pChild ) = 0;
  351. // child management, use with caution! normally always managed internally. Returns child index we inserted at.
  352. virtual int AddChildSorted( bool( __cdecl *pfnLessFunc )(ClientPanelPtr_t const &p1, ClientPanelPtr_t const &p2), IUIPanel *pChild ) = 0;
  353. // child management, use with caution! normally always managed internally.
  354. virtual void RemoveChild( IUIPanel *pChild ) = 0;
  355. // Move child after another child
  356. virtual void MoveChildAfter( IUIPanel *pChildToMove, IUIPanel *pBefore ) = 0;
  357. // Move child before another child
  358. virtual void MoveChildBefore( IUIPanel *pChildToMove, IUIPanel *pAfter ) = 0;
  359. virtual void SetMouseCanActivate( EMouseCanActivate eMouseCanActivate, const char *pchOptionalParent = NULL ) = 0;
  360. virtual EMouseCanActivate GetMouseCanActivate() = 0;
  361. virtual IUIPanel *FindParentForMouseCanActivate() = 0;
  362. virtual bool BReloadLayout( CPanoramaSymbol symPath ) = 0;
  363. virtual void ReloadStyleFileTraverse( CPanoramaSymbol symPath ) = 0;
  364. virtual bool BHasOnActivateEvent() = 0;
  365. virtual bool BHasOnMouseActivateEvent() = 0;
  366. // Called to ask us to setup object template for Javascript, you can implement this in a child class and then call
  367. // the base method (so all the normal panel2d stuff gets exposed), plus call the various RegisterJS helpers yourself
  368. // to expose additional panel type specific data/methods.
  369. virtual void SetupJavascriptObjectTemplate() = 0;
  370. virtual void SetLayoutFile( CPanoramaSymbol symLayoutFile ) = 0;
  371. // Low level build matching style list for debugger use
  372. virtual bool BBuildMatchingStyleList( CUtlVector< CascadeStyleFileInfo_t > *pvecStyles ) = 0;
  373. // Getter for panel attributes
  374. virtual int GetAttribute( const char *pchAttrName, int nDefaultValue ) = 0;
  375. // Getter for panel attributes
  376. virtual const char *GetAttribute( const char *pchAttrName, const char * pchDefaultValue ) = 0;
  377. // Getter for panel attributes
  378. virtual uint32 GetAttribute( const char *pchAttrName, uint32 unDefaultValue ) = 0;
  379. // Getter for panel attributes
  380. virtual uint64 GetAttribute( const char *pchAttrName, uint64 unDefaultValue ) = 0;
  381. // Setter for panel attributes
  382. virtual void SetAttribute( const char *pchAttrName, int nValue ) = 0;
  383. // Setter for panel attributes
  384. virtual void SetAttribute( const char *pchAttrName, const char * pchValue ) = 0;
  385. // Setter for panel attributes
  386. virtual void SetAttribute( const char *pchAttrName, uint32 unValue ) = 0;
  387. // Setter for panel attributes
  388. virtual void SetAttribute( const char *pchAttrName, uint64 unValue ) = 0;
  389. // Set animation property on panel
  390. virtual void SetAnimation( const char *pchAnimationName, float flDuration, float flDelay, EAnimationTimingFunction eTimingFunc, EAnimationDirection eDirection, float flIterations ) = 0;
  391. // Force an immediate update of the visibility list on our window for our current visibility
  392. virtual void UpdateVisibility( bool bUseDirtyStyles ) = 0;
  393. // Base class implementation for valid XML properties to be set
  394. virtual bool BSetProperty( CPanoramaSymbol symName, const char *pchValue ) = 0;
  395. // Builds a string of properties and values to display in the debugger
  396. virtual void GetDebugPropertyInfo( CUtlVector< DebugPropertyOutput_t *> *pvecProperties ) = 0;
  397. // Populates a vector with all immediate children matching a class
  398. virtual void FindChildrenWithClass( const char *pchClass, CUtlVector<IUIPanel *> &vecMatchingChildren ) = 0;
  399. // Populates a vector with all children matching a class
  400. virtual void FindChildrenWithClassTraverse( const char *pchClass, CUtlVector<IUIPanel *> &vecMatchingChildren ) = 0;
  401. // Play focus change sound accounting for fast scroll volume fade effects, etc
  402. virtual void PlayFocusChangeSound( int nRepeats, float flPan ) = 0;
  403. // Clear all panel events
  404. virtual void ClearPanelEvents() = 0;
  405. // Clear specific panel event
  406. virtual void ClearPanelEvents( CPanoramaSymbol symPanelEvent ) = 0;
  407. // panel events
  408. virtual void SetPanelEvent( CPanoramaSymbol symPanelEvent, IUIEvent *pEvent ) = 0;
  409. virtual void SetPanelEvent( CPanoramaSymbol symPanelEvent, VecUIEvents_t *pEvents ) = 0;
  410. // Should analog stick be able to scroll this panel?
  411. virtual bool BEnableAnalogStickScrolling() = 0;
  412. // Set mouse tracking state
  413. virtual void SetMouseTracking( bool bState ) = 0;
  414. // Should only be called in the very limited cases where we are creating scrollbars within a layout pass,
  415. // exposed for HTML but should really only be used inside UIPanel normally
  416. virtual void SetInScrollbarConstruction( bool bConstructing ) = 0;
  417. // Get the scrollbar for this panel if it exists
  418. virtual IUIScrollBar *GetVerticalScrollBar() = 0;
  419. virtual IUIScrollBar *GetHorizontalScrollBar() = 0;
  420. // Get panel events set on panel
  421. virtual VecUIEvents_t * GetPanelEvents( CPanoramaSymbol symEvent ) = 0;
  422. // Has this panel ever been layed out
  423. virtual bool BHasBeenLayedOut() const = 0;
  424. // Callback that styles have cleaned up some transitions, we should update cached state about what styles are present
  425. virtual void OnStyleTransitionsCleanup() = 0;
  426. #ifdef DBGFLAG_VALIDATE
  427. virtual void Validate( CValidator &validator, const char *pchName ) = 0;
  428. #endif
  429. };
  430. }
  431. #endif // IUIPANEL_H