You.i Engine
YiScrollingView.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_SCROLLING_VIEW_H_
3 #define _YI_SCROLLING_VIEW_H_
4 
5 #include "signal/YiSignal.h"
6 #include "utility/YiTime.h"
7 #include "view/YiSceneView.h"
9 
10 #include <glm/gtc/epsilon.hpp>
11 
12 #include <set>
13 
14 class CYIMagnetScrollController;
17 class CYIScrollingViewPriv;
18 
148 {
149  friend class CYIScrollingViewPriv;
150 
151 public:
152  enum class OverpullRule
153  {
154  Always,
156  };
157 
158  enum class LayoutMode
159  {
160  FitContent,
161  FitContentIfOverflowing,
162  FillView
163  };
164 
165  enum class CarouselRule
166  {
167  Never,
168  Always,
169  IfOverflowing
170  };
171 
172  enum class TimelineType
173  {
174  In = 0,
175  Out
176  };
177 
178  enum class MagnetsType
179  {
180  None,
181  Edges,
182  Center,
183  Begin,
184  End
185  };
186 
187  enum class ScrollDirection
188  {
189  Closest,
190  Forward,
191  Reverse
192  };
193 
194  enum class CameraType
195  {
196  Perspective,
197  Orthographic
198  };
199 
203  struct Magnets
204  {
208  static Magnets CreateNone();
209 
215  static Magnets CreateCenter(float centerOffset);
216 
222  static Magnets CreateBegin(float beginningOffset);
223 
229  static Magnets CreateEnd(float endOffset);
230 
238  static Magnets CreateEdges(float beginningOffset, float endOffset);
239 
241  const float beginningOffset;
242  const float centerOffset;
243  const float endOffset;
244 
245  private:
246  Magnets(MagnetsType type, float beginningOffset, float centerOffset, float endOffset);
247  };
248 
255  {
256  public:
257  friend class CYIScrollingView;
258 
259  PagingStrategy();
260  virtual ~PagingStrategy();
261 
262  protected:
263  /*
264  \details Returns the current page of the scrolling view. Must be overridden by implementing classes to implement logic.
265  */
266  virtual size_t GetPage() = 0;
267 
268  /*
269  \details Returns the page count of the scrolling view. Must be overridden by implementing classes to implement logic.
270  */
271  virtual size_t GetPageCount() = 0;
272 
273  /*
274  \details Gets the current scroll position. Implementing classes may use this method when implementing paging functions.
275  */
276  float GetScrollPosition() const;
277 
278  /*
279  \details Gets the total scrolling region size. Implementing classes may use this method when implementing paging functions.
280  */
281  float GetScrollRegionSize() const;
282 
283  private:
284  float m_scrollPosition;
285  float m_scrollRegionSize;
286  };
287 
289  virtual ~CYIScrollingView();
290 
291  virtual bool Init() override;
292 
314  void ScrollToHorizontalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator = nullptr);
315 
321  void ScrollToHorizontalPosition(float normalizedPosition);
322 
344  void ScrollToVerticalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator = nullptr);
345 
351  void ScrollToVerticalPosition(float normalizedPosition);
352 
357  void ScrollToPosition(const glm::vec2 &normalizedPositions, uint32_t durationMs = 0, CYITimeInterpolator *pInterpolator = nullptr);
358 
365  void ScrollByHorizontalViewSize(ScrollDirection scrollDirection, uint32_t durationMs = 0, CYITimeInterpolator *pInterpolator = nullptr);
366 
373  void ScrollByVerticalViewSize(ScrollDirection scrollDirection, uint32_t durationMs = 0, CYITimeInterpolator *pInterpolator = nullptr);
374 
378  float GetHorizontalPosition() const;
379 
383  float GetVerticalPosition() const;
384 
396  void Reveal(CYISceneNode *pNode, uint32_t durationMs, CYITimeInterpolator *pInterpolator = nullptr);
397 
404 
411 
416  void SetHorizontalScrollingEnabled(bool enabled);
417 
421  bool IsHorizontalScrollingEnabled() const;
422 
429 
436 
441  void SetVerticalScrollingEnabled(bool enabled);
442 
446  bool IsVerticalScrollingEnabled() const;
447 
453  void SetHorizontalOverpullDistance(float distance);
454 
458  float GetHorizontalOverpullDistance() const;
459 
465  void SetVerticalOverpullDistance(float distance);
466 
470  float GetVerticalOverpullDistance() const;
471 
476 
481 
486 
491 
496 
501 
506 
511 
515  bool HasHorizontalOverflow() const;
516 
520  bool HasVerticalOverflow() const;
521 
527  const CYIAABB &GetScrollableRegion() const;
528 
532  void StopScrolling();
533 
538 
542  void StopVerticalScrolling();
543 
557  void SetHorizontalCarouselRule(CarouselRule carouselRule);
558 
572  void SetVerticalCarouselRule(CarouselRule carouselRule);
573 
578 
583 
591  void SetCascadeTimelineGroupDelay(uint32_t delayMs);
592 
596  uint32_t GetCascadeTimelineGroupDelay() const;
597 
606 
615  bool IsInVisibleRegion(const CYISceneNode *pCandidate) const;
616 
625  void SetHorizontalMagnets(const Magnets &magnets);
626 
633 
638 
642  void SetHorizontalSwipeOneItemEnabled(bool swipeOneItem);
643 
647  bool IsHorizontalSwipeOneItemEnabled() const;
648 
657  void SetVerticalMagnets(const Magnets &magnets);
658 
664  void RemoveVerticalMagnets();
665 
669  Magnets GetVerticalMagnets() const;
670 
674  void SetVerticalSwipeOneItemEnabled(bool swipeOneItem);
675 
679  bool IsVerticalSwipeOneItemEnabled() const;
680 
689  void EnableMagnetism(CYISceneNode *pNode);
690 
694  void DisableMagnetism(CYISceneNode *pChild);
695 
699  bool IsMagnetic(const CYISceneNode *pNode) const;
700 
707  bool IsScrollingHorizontally() const;
708 
715  bool IsScrollingVertically() const;
716 
722 
727  void SetHorizontalTrackpadLeaveFriction(float friction);
728 
733  float GetVerticalTrackpadLeaveFriction() const;
734 
739  void SetVerticalTrackpadLeaveFriction(float friction);
740 
745  size_t GetHorizontalPageCount() const;
746 
751  size_t GetCurrentHorizontalPage() const;
752 
757  size_t GetVerticalPageCount() const;
758 
763  size_t GetCurrentVerticalPage() const;
764 
765  /*
766  \details Sets the horizontal paging strategy of the view. Setting a paging strategy is required for horizontal paging APIs to be enabled.
767  \sa #GetHorizontalPageCount
768  \sa #GetCurrentHorizontalPage
769  */
770  void SetHorizontalPagingStrategy(std::unique_ptr<PagingStrategy> PagingStrategy);
771 
772  /*
773  \details Sets the vertical paging strategy of the view. Setting a paging strategy is required for vertical paging APIs to be enabled.
774  \sa #GetVerticalPageCount
775  \sa #GetCurrentVerticalPage
776  */
777  void SetVerticalPagingStrategy(std::unique_ptr<PagingStrategy> PagingStrategy);
778 
782  const std::set<CYISceneNode *> &GetVisibleChildren() const;
783 
784  virtual void OnPreBuildDrawList(std::vector<IYIRenderer::Command> *pDrawList, std::vector<CYIAbstractCameraSceneNode *> *pDrawWithCameraList) override;
785 
789  CameraType GetCameraType() const;
790 
794  virtual bool HandlesFocusInDescendants() const override;
795 
803  virtual bool ContainsFocusableDescendant(const CYIFocusSearchOptions &options = CYIFocusSearchOptions()) const override;
804 
810 
814  virtual CYISceneView *FindNextFocusInDescendants(const CYISceneView *pCurrentFocusView, CYIFocus::Direction direction, CYIAABB &screenSpaceFocusRegion, const CYIFocusSearchOptions &options = CYIFocusSearchOptions()) const override;
815 
819  virtual void FocusChangedInDescendants(CYISceneNode *pNewNodeWithFocus, CYISceneNode *pPreviousNodeWithFocus) override;
820 
824  virtual void FocusGainedInDescendants(CYISceneNode *pNewNodeWithFocus, CYISceneNode *pPreviousNodeWithFocus) override;
825 
850 protected:
851  enum class Direction
852  {
853  Horizontal,
854  Vertical,
855 
856  DirectionsCount // Represents the size of the enum
857  };
858 
863  {
866  };
867 
869 
878 
879  virtual bool BroadcastEvent(const std::shared_ptr<CYIEventDispatcher> &pDispatcher, CYIEvent *pEvent) override;
880 
881  void ConfigureScrollingRange(Direction direction, float contentSize);
882  void ConfigureOverpull(Direction direction, float viewSize);
883  void ConfigureMagnets(Direction direction, float viewSize, float oldViewSize);
884 
888  virtual void ParseProperties();
889 
890  virtual bool HandleEvent(const std::shared_ptr<CYIEventDispatcher> &pEventDispatcher, CYIEvent *pEvent) override;
891  virtual void Measure(const MeasureSpec &widthSpec, const MeasureSpec &heightSpec, const MeasureSpec &depthSpec) override;
892  virtual void ApplyMeasurements() override;
893  virtual void SizeChanged() override;
894  virtual void WorldBoundingBoxUpdated() override;
895 
899  virtual void ChildAdded(CYISceneNode *pChild) override;
900 
904  virtual void ChildRemoved(CYISceneNode *pChild) override;
905 
920  virtual void Reveal(CYISceneNode *pNode, uint32_t durationMs, ScrollDirection horizontalDirection, ScrollDirection verticalDirection, CYITimeInterpolator *pInterpolator = nullptr);
921 
930  virtual CYIAABB CalculateScrollableRegion() const;
931 
940 
948  bool IsInExpandedVisibleRegion(const CYISceneNode *pCandidate, float visibleRegionMultiplier) const;
949 
954 
961  virtual void ChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion);
962 
968  virtual void OnChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion);
969 
970  virtual void ChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition);
971  virtual void OnChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition);
972 
973  virtual void OnScrollAuto(CYIScrollController *pController) override;
974  virtual void OnScrollStarted(CYIScrollController *pController) override;
975  virtual void OnScrolled(CYIScrollController *pController, YI_SCROLLED_INFO scrolledInfo) override;
976  virtual void OnScrollEnded(CYIScrollController *pController) override;
977 
978  virtual void UpdateEnd() override;
979 
987  bool IsCarouseling(Direction direction) const;
988 
994  CYITimelineGroup *GetCascadeTimelineGroup(TimelineType type, bool updateTimeline);
995 
1000 
1010  virtual std::map<CYISceneView *, uint64_t> GetTotalCascadeDelayFor(TimelineType type, const std::vector<ViewAndDistance> &visibleViews);
1011 
1015  static const CYIString &DirectionToString(Direction direction);
1016 
1017  virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override;
1018 
1019  virtual CYIAbstractCameraSceneNode *FindActiveCamera(const CYISceneNode *pTargetSceneNode = nullptr) const override;
1020 
1024  float GetScrollDeltaToNodeInFocusPosition(Direction direction, CYISceneNode *pNode) const;
1025 
1030 
1035 
1039  virtual void UpdateHorizontalPagingStrategyImpl();
1040 
1044  virtual void UpdateVerticalPagingStrategyImpl();
1045 
1047 
1048  std::unique_ptr<PagingStrategy> m_horizontalPagingStrategy;
1049  std::unique_ptr<PagingStrategy> m_verticalPagingStrategy;
1050 
1051 private:
1052  enum class Cameras
1053  {
1054  TopLeft = 0,
1055  TopRight,
1056  BottomLeft,
1057  BottomRight,
1058  CamerasCount // Represents the size of the enum
1059  };
1060 
1061  // Magnet indicies
1062  static constexpr size_t LEFT = 0;
1063  static constexpr size_t RIGHT = 1;
1064  static constexpr size_t UP = LEFT;
1065  static constexpr size_t DOWN = RIGHT;
1066  static constexpr size_t POSITIVE = LEFT;
1067  static constexpr size_t NEGATIVE = RIGHT;
1068 
1069  // Direction indices
1070  static constexpr size_t HORIZONTAL = (size_t)Direction::Horizontal;
1071  static constexpr size_t VERTICAL = (size_t)Direction::Vertical;
1072 
1073  bool GetNodeLocalSpaceInfo(Direction direction, CYISceneNode *pNode, float *pPosition, float *pSize) const;
1074 
1075  void InitializeCameras();
1076  void PlaceCameras(const CYIAABB &scrollRegion);
1077  void UpdateCameras(float cameraDistance, const glm::vec3 &viewSize);
1078 
1082  bool HasOverflow(Direction direction) const;
1083 
1084  /*
1085  Camera placement and carousel handling
1086  */
1087  void InitializeScrollPosition();
1088  void OffsetCameraByRegionTopLeft();
1089  void CheckAndUpdateCameraRootPositionInDirection(Direction direction);
1090  void CheckAndUpdateCarouselState();
1091  void EnableHorizontalCarousel();
1092  void EnableVerticalCarousel();
1093  void DisableHorizontalCarousel();
1094  void DisableVerticalCarousel();
1095  bool ShouldCarousel(Direction direction) const;
1099  virtual void CarouselStatusChanged(Direction direction, bool isCarousel);
1100 
1101  /*
1102  Scrolling Behaviour
1103  */
1104  void ScrollStart(const glm::vec3 &position, uint64_t timeMs, uint8_t pointerID);
1105  void ScrollMove(const glm::vec3 &position, uint64_t timeMs, uint8_t pointerID);
1106  void ScrollEnd(const glm::vec3 &position, uint64_t timeMs, uint8_t pointerID);
1107  bool InterpretEventForScroll(CYIActionEvent *pEvent);
1108 
1109  void ScrollToHorizontalPosition(float normalizedPosition, uint32_t durationMs, ScrollDirection direction, CYITimeInterpolator *pInterpolator = nullptr);
1110  void ScrollToVerticalPosition(float normalizedPosition, uint32_t durationMs, ScrollDirection direction, CYITimeInterpolator *pInterpolator = nullptr);
1111  void ScrollToPosition(Direction direction, float normalizedPosition, uint32_t durationMs, ScrollDirection scrollDirection, CYITimeInterpolator *pInterpolator = nullptr);
1112  void ScrollByViewSize(Direction listDirection, ScrollDirection scrollDirection, uint32_t durationMs, CYITimeInterpolator *pInterpolator);
1113 
1117  void CheckAndNotifyOverflowChanged();
1118 
1119  void OnScrollRegionChanged();
1120 
1121  void ApplySnapBackInDirectionIfNecessary(Direction direction);
1122 
1123  void NotifyPositionInVisibilityRegion();
1124  void NotifyPositionInVisibilityRegion(CYISceneNode *pNode);
1125 
1126  void UpdateMagneticPoints();
1127  void AddMagneticPoints(Direction direction, CYISceneNode *pNode);
1128 
1129  glm::vec2 CalculateDistanceFromTopLeft(CYISceneNode *pChild) const;
1130  void InitializeTimelineGroups();
1131  void UpdateCascadeIn();
1132  void UpdateCascadeOut();
1133 
1134  bool FindFocusCandidatesInViewsScreenSpaceRegion(CYIFocus::Direction direction, const CYIAABB &previousFocusRect, const CYIFocusSearchOptions &options, void *pFoundCandidates = nullptr) const;
1135 
1136  void SetSwipeOneItemEnabled(Direction direction, bool swipeOneItem);
1137  bool IsSwipeOneItemEnabled(Direction direction) const;
1138 
1139  void HandleHorizontalPositionChanged(float position);
1140  void CheckForHorizontalPageChange(size_t previousPage, size_t previousPageCount);
1141  void HandleVerticalPositionChanged(float position);
1142  void CheckForVerticalPageChange(size_t previousPage, size_t previousPageCount);
1143 
1144  CYISceneNode *GetDrawChildAncestorOfNode(CYISceneNode *pNode) const;
1145 
1146  void ScrollToNode(CYISceneNode *pNode, bool startOfMove, uint32_t durationMs, ScrollDirection horizontalDirection, ScrollDirection verticalDirection, CYITimeInterpolator *pInterpolator);
1147 
1148  CYIAABB GetDecoratedItemBounds(const CYISceneNode *pNode) const;
1149  CYIScrollingView::Cameras FindClosestCamera(const CYISceneNode *pCandidate) const;
1150 
1173  float GetRequiredScrollDeltaToAlignment(Direction scrollDirection, float dataPosition, float viewPosition) const;
1174 
1175  static const uint32_t s_defaultFocusScrollDuration;
1176 
1177  bool m_scrolling;
1178  bool m_visibilityCheckRequired;
1179  bool m_magnetSnapRequired;
1180  glm::vec3 m_DownPosition;
1181  glm::vec2 m_ScreenDownPosition;
1182  glm::vec3 m_PreviousSize;
1183  bool m_down;
1184  float m_horizontalLeaveFriction;
1185  float m_verticalLeaveFriction;
1186 
1187  /*
1188  Scrolling View
1189  */
1190  bool m_scrollingEnabled[(size_t)Direction::DirectionsCount];
1192  float m_overpullDistance[(size_t)Direction::DirectionsCount];
1193  bool m_overflowState[(size_t)Direction::DirectionsCount];
1195  glm::vec3 m_measuredScrollingArea;
1196  CYIAABB m_scrollRegion;
1197 
1198  CYIAbstractCameraSceneNode *m_pCameras[(size_t)Cameras::CamerasCount];
1199  CYISceneNode *m_pCameraRoot;
1200  CameraType m_cameraType;
1202  bool m_isCarousel[(size_t)Direction::DirectionsCount];
1203  mutable ScrollDirection m_scrollDirectionsForReveal[(size_t)Direction::DirectionsCount];
1204 
1205  std::unique_ptr<CYIMagnetScrollController> m_pScrollController[(size_t)Direction::DirectionsCount];
1206 
1207  MagnetsType m_currentMagnetTypes[(size_t)Direction::DirectionsCount];
1208  float m_magnetOffsets[(size_t)Direction::DirectionsCount][2]; //Offsets for {left, right} and {up, down} magnets
1209 
1210  std::set<CYISceneNode *> m_visibleChildren;
1211 
1212  std::unique_ptr<CYITimelineGroup> m_pTimelineGroup[2];
1213  std::unique_ptr<CYITimelineGroup> m_pCascadeTimeline[2];
1214  uint32_t m_cascadeDelayMs;
1215 
1216  ScrollDirection m_magnetsTargetHorizontalDirection;
1217  ScrollDirection m_magnetsTargetVerticalDirection;
1218  CYISceneNode *m_pMagnetsTargetNode;
1219  bool m_scrollControllerAnimating[(size_t)Direction::DirectionsCount];
1220  bool m_isHorizontalScrollingReversed;
1221 
1222  bool m_cachedScreenReaderEnabled;
1223  void OnScreenReaderStatusChanged(bool screenReaderEnabled);
1224 
1226 };
1227 
1229 {
1230  return lhs.type == rhs.type &&
1231  glm::epsilonEqual(rhs.centerOffset, lhs.centerOffset, glm::epsilon<float>()) &&
1232  glm::epsilonEqual(rhs.beginningOffset, lhs.beginningOffset, glm::epsilon<float>()) &&
1233  glm::epsilonEqual(rhs.endOffset, lhs.endOffset, glm::epsilon<float>());
1234 }
1235 
1237 {
1238  return !(lhs == rhs);
1239 }
1240 
1243 #endif // _YI_SCROLLING_VIEW_H_
void DisableVerticalScrolling()
virtual std::map< CYISceneView *, uint64_t > GetTotalCascadeDelayFor(TimelineType type, const std::vector< ViewAndDistance > &visibleViews)
size_t GetHorizontalPageCount() const
void SetCascadeTimelineGroupDelay(uint32_t delayMs)
CYISignal< CYISceneNode * > ChildEnteredVisibleRegion
Definition: YiScrollingView.h:842
Magnets GetHorizontalMagnets() const
The base class for the timeline framework.
Definition: YiAbstractTimeline.h:29
virtual void ChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition)
void SetHorizontalSwipeOneItemEnabled(bool swipeOneItem)
void CheckAndNotifyVisibilityInVisibilityRegion(CYISceneNode *pChild)
Container for basic interpolator functions.
Definition: YiTimeInterpolator.h:20
Definition: YiScrollingView.h:862
void SetHorizontalOverpullDistance(float distance)
bool IsInVisibleRegion(const CYISceneNode *pCandidate) const
LayoutMode GetHorizontalScrollingAreaLayoutMode() const
virtual void ChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion)
void SetVerticalCarouselRule(CarouselRule carouselRule)
A class containing focus search options.
Definition: YiFocusSearchOptions.h:21
OverpullRule GetHorizontalOverpullRule() const
CYIScrollController * GetScrollController(Direction direction) const
void SetHorizontalTrackpadLeaveFriction(float friction)
CYISignal< size_t, size_t > HorizontalPageChanged
Definition: YiScrollingView.h:845
Base class for events.
Definition: YiEvent.h:28
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
virtual bool RequestFocus(CYIFocus::Direction direction=CYIFocus::Direction::Forward, CYIFocus::FocusRootRule focusRootRule=CYIFocus::FocusRootRule::DescendantsUpdateContext, const CYIAABB &previousFocusRect=CYIAABB(), const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) override
CYISignal HorizontalScrollingEnded
Definition: YiScrollingView.h:836
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
virtual void Measure(const MeasureSpec &widthSpec, const MeasureSpec &heightSpec, const MeasureSpec &depthSpec) override
bool operator!=(const CYIScrollingView::Magnets &lhs, const CYIScrollingView::Magnets &rhs)
Definition: YiScrollingView.h:1236
void SetVerticalScrollingAreaLayoutMode(LayoutMode mode)
void Reveal(CYISceneNode *pNode, uint32_t durationMs, CYITimeInterpolator *pInterpolator=nullptr)
virtual void UpdateHorizontalPagingStrategyImpl()
CYISceneView * view
Definition: YiScrollingView.h:864
float GetHorizontalTrackpadLeaveFriction() const
virtual bool BroadcastEvent(const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
CYISignal< float > VerticalPositionChanged
Definition: YiScrollingView.h:832
uint32_t GetCascadeTimelineGroupDelay() const
The base class for types of timeline groups.
Definition: YiTimelineGroup.h:25
CameraType
Definition: YiScrollingView.h:194
void EnableHorizontalScrolling()
void StopHorizontalScrolling()
virtual CYIAbstractCameraSceneNode * FindActiveCamera(const CYISceneNode *pTargetSceneNode=nullptr) const override
Provides a base for the definition of camera objects.
Definition: YiAbstractCameraSceneNode.h:31
bool IsVerticalSwipeOneItemEnabled() const
Direction
Definition: YiScrollingView.h:851
void StopVerticalScrolling()
void ScrollToHorizontalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator=nullptr)
friend class CYIScrollingViewPriv
Definition: YiScrollingView.h:149
uint32_t m_focusScrollDuration
Definition: YiScrollingView.h:1046
float GetScrollDeltaToNodeInFocusPosition(Direction direction, CYISceneNode *pNode) const
virtual void ChildRemoved(CYISceneNode *pChild) override
Direction
Definition: YiFocus.h:44
const float centerOffset
The center offset. Applicable only when type is CYIScrollingView::MagnetsType::Center.
Definition: YiScrollingView.h:242
ScrollDirection
Definition: YiScrollingView.h:187
bool IsHorizontalSwipeOneItemEnabled() const
CYISignal InteractionBegan
Definition: YiScrollingView.h:826
virtual ~CYIScrollingView()
bool IsScrollingVertically() const
size_t GetCurrentHorizontalPage() const
void UpdateVerticalPagingStrategy()
const MagnetsType type
The magnets type.
Definition: YiScrollingView.h:240
CYISignal InteractionEnded
Definition: YiScrollingView.h:834
bool IsHorizontalScrollingEnabled() const
Definition: YiScrollingView.h:254
float GetHorizontalPosition() const
virtual CYIAABB CalculateScrollableRegion() const
virtual void OnPreBuildDrawList(std::vector< IYIRenderer::Command > *pDrawList, std::vector< CYIAbstractCameraSceneNode *> *pDrawWithCameraList) override
constexpr std::enable_if< YiEnableBitmaskOperators< E >::enable, bool >::type None(E a)
Definition: YiEnumBitmaskOperators.h:136
void SetHorizontalScrollingAreaLayoutMode(LayoutMode mode)
virtual void OnScrolled(CYIScrollController *pController, YI_SCROLLED_INFO scrolledInfo) override
virtual void OnChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion)
void SetHorizontalScrollingEnabled(bool enabled)
CameraType GetCameraType() const
Definition: YiScrollController.h:15
const CYIAABB & GetScrollableRegion() const
std::unique_ptr< PagingStrategy > m_horizontalPagingStrategy
Definition: YiScrollingView.h:1048
bool IsScrollingHorizontally() const
virtual void SizeChanged() override
void SetVerticalTrackpadLeaveFriction(float friction)
virtual void FocusGainedInDescendants(CYISceneNode *pNewNodeWithFocus, CYISceneNode *pPreviousNodeWithFocus) override
void UpdateHorizontalPagingStrategy()
size_t GetCurrentVerticalPage() const
virtual void UpdateEnd() override
CYITimelineGroup * GetCascadeTimelineGroup(TimelineType type=TimelineType::In)
TimelineType
Definition: YiScrollingView.h:172
CYISignal< bool > HorizontalOverflowChanged
Definition: YiScrollingView.h:839
CYIScrollController provides scrolling behaviour to views.
Definition: YiScrollController.h:36
void ConfigureScrollControllers()
Definition: YiTime.h:28
bool IsCarouseling(Direction direction) const
virtual CYISceneView * FindNextFocusInDescendants(const CYISceneView *pCurrentFocusView, CYIFocus::Direction direction, CYIAABB &screenSpaceFocusRegion, const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const override
virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override
bool IsMagnetic(const CYISceneNode *pNode) const
virtual void OnScrollAuto(CYIScrollController *pController) override
virtual void OnScrollStarted(CYIScrollController *pController) override
virtual CYIAbstractTimeline * GetCascadeTimelineFor(TimelineType type, CYISceneView *pView)
bool HasHorizontalOverflow() const
CYISignal< float > HorizontalPositionChanged
Definition: YiScrollingView.h:831
virtual void WorldBoundingBoxUpdated() override
CYISignal< CYISceneNode * > ChildLeftVisibleRegion
Definition: YiScrollingView.h:843
void ScrollToVerticalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator=nullptr)
void RemoveVerticalMagnets()
Definition: YiScrollingView.h:203
void SetHorizontalPagingStrategy(std::unique_ptr< PagingStrategy > PagingStrategy)
void RemoveHorizontalMagnets()
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:105
Definition: YiSceneNode.h:374
virtual void ChildAdded(CYISceneNode *pChild) override
void SetHorizontalMagnets(const Magnets &magnets)
float GetVerticalPosition() const
void ConfigureScrollingRange(Direction direction, float contentSize)
void DisableHorizontalScrolling()
FocusRootRule
Definition: YiFocus.h:60
void EnableVerticalScrolling()
virtual bool HandleEvent(const std::shared_ptr< CYIEventDispatcher > &pEventDispatcher, CYIEvent *pEvent) override
size_t GetVerticalPageCount() const
float GetVerticalTrackpadLeaveFriction() const
virtual bool Init() override
LayoutMode GetVerticalScrollingAreaLayoutMode() const
virtual bool HandlesFocusInDescendants() const override
static const CYIString & DirectionToString(Direction direction)
CYISignal VerticalScrollingEnded
Definition: YiScrollingView.h:837
CarouselRule GetVerticalCarouselRule() const
Definition: YiScrollController.h:43
CYISignal HorizontalScrollingBegan
Definition: YiScrollingView.h:828
virtual void UpdateVerticalPagingStrategyImpl()
void ConfigureOverpull(Direction direction, float viewSize)
void SetVerticalScrollingEnabled(bool enabled)
void DisableMagnetism(CYISceneNode *pChild)
void SetVerticalMagnets(const Magnets &magnets)
const float endOffset
The end offset. Applicable only when type is CYIScrollingView::MagnetsType::Edges or CYIScrollingView...
Definition: YiScrollingView.h:243
OverpullRule
Definition: YiScrollingView.h:152
CarouselRule GetHorizontalCarouselRule() const
virtual void ParseProperties()
const float beginningOffset
The beginning offset. Applicable only when type is CYIScrollingView::MagnetsType::Edges or CYIScrolli...
Definition: YiScrollingView.h:241
This class represents an Axis-Aligned Bounding Box.
Definition: YiAABB.h:22
This kind of timeline group will play its children in parallel, possibly with specified offsets (dela...
Definition: YiParallelTimelineGroup.h:21
Allows users to scroll and pan through content inside.
Definition: YiScrollingView.h:147
CYISignal< size_t, size_t > HorizontalPageCountChanged
Definition: YiScrollingView.h:846
bool IsVerticalScrollingEnabled() const
virtual void OnChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition)
void ScrollByVerticalViewSize(ScrollDirection scrollDirection, uint32_t durationMs=0, CYITimeInterpolator *pInterpolator=nullptr)
virtual bool ContainsFocusableDescendant(const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const override
unsigned int size_t
Definition: YiPredefLinux.h:10
OverpullRule GetVerticalOverpullRule() const
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:259
MagnetsType
Definition: YiScrollingView.h:178
bool operator==(const CYIScrollingView::Magnets &lhs, const CYIScrollingView::Magnets &rhs)
Definition: YiScrollingView.h:1228
CarouselRule
Definition: YiScrollingView.h:165
void EnableMagnetism(CYISceneNode *pNode)
CYISignal< size_t, size_t > VerticalPageChanged
Definition: YiScrollingView.h:847
void SetHorizontalOverpullRule(OverpullRule rule)
LayoutMode
Definition: YiScrollingView.h:158
CYISignal< bool > VerticalOverflowChanged
Definition: YiScrollingView.h:840
void ScrollByHorizontalViewSize(ScrollDirection scrollDirection, uint32_t durationMs=0, CYITimeInterpolator *pInterpolator=nullptr)
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:169
Magnets GetVerticalMagnets() const
std::unique_ptr< PagingStrategy > m_verticalPagingStrategy
Definition: YiScrollingView.h:1049
void SetVerticalOverpullRule(OverpullRule rule)
float GetHorizontalOverpullDistance() const
glm::vec2 distanceFromTopLeft
Definition: YiScrollingView.h:865
void SetVerticalSwipeOneItemEnabled(bool swipeOneItem)
void SetVerticalOverpullDistance(float distance)
const std::set< CYISceneNode * > & GetVisibleChildren() const
Stores data related to a user Action event.
Definition: YiActionEvent.h:19
void ConfigureMagnets(Direction direction, float viewSize, float oldViewSize)
virtual void FocusChangedInDescendants(CYISceneNode *pNewNodeWithFocus, CYISceneNode *pPreviousNodeWithFocus) override
CYIAABB CalculateContentSize() const
virtual void OnScrollEnded(CYIScrollController *pController) override
bool HasVerticalOverflow() const
void ScrollToPosition(const glm::vec2 &normalizedPositions, uint32_t durationMs=0, CYITimeInterpolator *pInterpolator=nullptr)
bool IsInExpandedVisibleRegion(const CYISceneNode *pCandidate, float visibleRegionMultiplier) const
void SetHorizontalCarouselRule(CarouselRule carouselRule)
virtual void ApplyMeasurements() override
void SetVerticalPagingStrategy(std::unique_ptr< PagingStrategy > PagingStrategy)
CYISignal VerticalScrollingBegan
Definition: YiScrollingView.h:829
CYISignal< size_t, size_t > VerticalPageCountChanged
Definition: YiScrollingView.h:848
float GetVerticalOverpullDistance() const